use of java.rmi.NoSuchObjectException in project jdk8u_jdk by JetBrains.
the class NotSerializable method main.
public static void main(String[] args) throws Exception {
System.err.println("\nRegression test for bug 4460983\n");
Activatable act = new FakeActivatable();
try {
ObjectOutputStream out = new ObjectOutputStream(new ByteArrayOutputStream());
try {
out.writeObject(act);
throw new RuntimeException("TEST FAILED: " + "Activatable instance successfully serialized");
} catch (NotSerializableException e) {
System.err.println("NotSerializableException as expected:");
e.printStackTrace();
}
// other exceptions cause test failure
System.err.println("TEST PASSED");
} finally {
try {
Activatable.unexportObject(act, true);
} catch (NoSuchObjectException e) {
}
}
}
use of java.rmi.NoSuchObjectException in project jdk8u_jdk by JetBrains.
the class NoIIOP method main.
public static void main(String[] args) throws Exception {
try {
Class.forName("javax.management.remote.rmi._RMIConnectionImpl_Tie");
System.out.println("RMI/IIOP appears to be supported, test skipped");
return;
} catch (ClassNotFoundException okay) {
}
JMXServiceURL url = new JMXServiceURL("service:jmx:iiop://");
MBeanServer mbs = MBeanServerFactory.createMBeanServer();
try {
JMXConnectorFactory.connect(url);
throw new RuntimeException("connect did not throw MalformedURLException");
} catch (MalformedURLException expected) {
}
try {
JMXConnectorServerFactory.newJMXConnectorServer(url, null, null);
throw new RuntimeException("newJMXConnectorServer did not throw MalformedURLException");
} catch (MalformedURLException expected) {
}
// test RMIConnector/RMIConnectorServer
RMIConnector connector = new RMIConnector(url, null);
try {
connector.connect();
throw new RuntimeException("connect did not throw IOException");
} catch (IOException expected) {
}
RMIConnectorServer server = new RMIConnectorServer(url, null, mbs);
try {
server.start();
throw new RuntimeException("start did not throw IOException");
} catch (IOException expected) {
}
// test RMIIIOPServerImpl
MyRMIIIOPServerImpl impl = new MyRMIIIOPServerImpl();
impl.setMBeanServer(mbs);
System.out.println(impl.getProtocol());
try {
impl.export();
throw new RuntimeException("export did not throw IOException");
} catch (IOException expected) {
}
try {
impl.newClient(null);
throw new RuntimeException("newClient did not throw IOException");
} catch (IOException expected) {
}
try {
impl.toStub();
throw new RuntimeException("toStub did not throw NoSuchObjectException");
} catch (NoSuchObjectException expected) {
}
try {
impl.closeServer();
throw new RuntimeException("closeServer did not throw NoSuchObjectException");
} catch (NoSuchObjectException expected) {
}
}
use of java.rmi.NoSuchObjectException in project wildfly by wildfly.
the class IIOPNamingInContainerTestCase method testStatefulIIOPNamingInvocation.
@Test
@OperateOnDeployment("test")
public void testStatefulIIOPNamingInvocation() throws NamingException, RemoteException, RemoveException {
final Properties prope = new Properties();
final InitialContext context = new InitialContext(prope);
final Object iiopObj = context.lookup("corbaname:iiop:" + managementClient.getMgmtAddress() + ":3528#IIOPStatefulNamingBean");
final IIOPStatefulNamingHome object = (IIOPStatefulNamingHome) PortableRemoteObject.narrow(iiopObj, IIOPStatefulNamingHome.class);
final IIOPStatefulRemote result = object.create(10);
Assert.assertEquals(11, result.increment());
Assert.assertEquals(12, result.increment());
result.remove();
try {
result.increment();
Assert.fail("Expected NoSuchObjectException");
} catch (NoSuchObjectException expected) {
}
}
use of java.rmi.NoSuchObjectException in project wildfly by wildfly.
the class IIOPNamingTestCase method testStatefulIIOPNamingInvocation.
@Test
public void testStatefulIIOPNamingInvocation() throws NamingException, RemoteException, RemoveException {
final Properties prope = new Properties();
prope.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
prope.put(Context.PROVIDER_URL, "corbaloc::" + managementClient.getMgmtAddress() + ":3528/NameService");
final InitialContext context = new InitialContext(prope);
final Object iiopObj = context.lookup("IIOPStatefulNamingBean");
final IIOPStatefulNamingHome object = (IIOPStatefulNamingHome) PortableRemoteObject.narrow(iiopObj, IIOPStatefulNamingHome.class);
final IIOPStatefulRemote result = object.create(10);
Assert.assertEquals(11, result.increment());
Assert.assertEquals(12, result.increment());
result.remove();
try {
result.increment();
Assert.fail("Expected NoSuchObjectException");
} catch (NoSuchObjectException expected) {
}
}
use of java.rmi.NoSuchObjectException in project wildfly by wildfly.
the class IIOPNamingTestCase method testStatefulIIOPNamingCorbanameInvocation.
@Test
public void testStatefulIIOPNamingCorbanameInvocation() throws NamingException, RemoteException, RemoveException {
final Properties prope = new Properties();
prope.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
prope.put(Context.PROVIDER_URL, "corbaloc::" + managementClient.getMgmtAddress() + ":3528");
final InitialContext context = new InitialContext(prope);
final Object iiopObj = context.lookup("IIOPStatefulNamingBean");
final IIOPStatefulNamingHome object = (IIOPStatefulNamingHome) PortableRemoteObject.narrow(iiopObj, IIOPStatefulNamingHome.class);
final IIOPStatefulRemote result = object.create(10);
Assert.assertEquals(11, result.increment());
Assert.assertEquals(12, result.increment());
result.remove();
try {
result.increment();
Assert.fail("Expected NoSuchObjectException");
} catch (NoSuchObjectException expected) {
}
}
Aggregations