[jboss-user] [Remoting] - InstantiationException with client passed proxies
cdelashmutt
do-not-reply at jboss.com
Fri Aug 11 14:05:04 EDT 2006
I;m trying to code up a little example using JBoss Remoting 1.4.4 in JBoss AS 4.0.4.GA, and JBoss Serialization. This example is based on the "Trasporters sample - proxy" example in the user guide.
I've got an MBean that manages the lifecycle of a socket based Remoting server that has a few methods in it. The client can get a reference to the server (hosted at socket://localhost:5400/?serializationtype=jboss), and call a method on the server that returns a String with no problems. However, if I try to create a proxy for a pojo on the client and pass that into the server, I get an InstatiationException from within the remoting framework when I call a method on the server and pass in the proxy.
Here is a snippet from the TestClient main method:
| //Get the remote server
| remote = (TestRemote) TransporterClient.createTransporterClient(
| "socket://localhost:5400/?serializationtype=jboss",
| TestRemote.class);
|
| //Just test out getting a simple String
| String classPath = remote.getMyClasspath();
| System.out.println("Server Classpath: " + classPath);
|
| //Create a new PersonImpl which implements a Person interface
| PersonImpl aPerson = new PersonImpl("Chris DeLashmutt");
| aPerson.setAge(31);
| System.out.println("Asserting Person " + aPerson.getName()
| + " with age of " + aPerson.getAge());
|
| //Create a local server for the Person proxy
| server = TransporterServer.createTransporterServer(
| "socket://localhost:5401/?serializationtype=jboss",
| aPerson, Person.class.getName());
|
| //Create the proxy to pass to the server
| Person personProxy = (Person) TransporterClient
| .createTransporterClient(
| "socket://localhost:5401/?serializationtype=jboss",
| Person.class);
|
| //Pass the person to the server
| remote.assertFact(personProxy);
|
| //Have the server set a random age on the Person through the proxy
| System.out.println("Fireing rules");
| remote.applyRules();
|
| //Show the new age of the person
| System.out.println("Person " + aPerson.getName()
| + " now has age of " + aPerson.getAge());
|
The server is very simple, and the exception I get is on the server side, but before my method actually gets invoked. The Person interface just specifies a couple getters/setters for name and age, and the PersonImpl is just a POJO with a no-arg constructor, and a String constructor to set the name.
The exception I get is a SerializationException caused by an InstantiationException. It looks like the error is coming from the Remoting code trying to instantiate an org.jboss.remoting.transport.local.LocalClientInvoker, but there isn't any no-arg constructor for that class, so it fails.
| 13:55:11,187 ERROR [ServerThread] failed
| org.jboss.serial.exception.SerializationException: Could not create instance of org.jboss.remoting.transport.local.LocalClientInvoker - org.jboss.remoting.transport.local.LocalClientInvoker
| at org.jboss.serial.classmetamodel.ClassMetaData.newInstance(ClassMetaData.java:327)
| at org.jboss.serial.persister.RegularObjectPersister.readData(RegularObjectPersister.java:239)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:411)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:81)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:639)
| at org.jboss.serial.persister.RegularObjectPersister.readSlotWithFields(RegularObjectPersister.java:353)
| at org.jboss.serial.persister.RegularObjectPersister.defaultRead(RegularObjectPersister.java:273)
| at org.jboss.serial.persister.RegularObjectPersister.readData(RegularObjectPersister.java:241)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:411)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:81)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:639)
| at org.jboss.serial.persister.RegularObjectPersister.readSlotWithFields(RegularObjectPersister.java:353)
| at org.jboss.serial.persister.RegularObjectPersister.defaultRead(RegularObjectPersister.java:273)
| at org.jboss.serial.persister.RegularObjectPersister.readData(RegularObjectPersister.java:241)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:411)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:81)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:639)
| at org.jboss.serial.persister.ProxyPersister.readData(ProxyPersister.java:66)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:411)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:81)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:639)
| at org.jboss.serial.persister.ArrayPersister.readObjectArray(ArrayPersister.java:196)
| at org.jboss.serial.persister.ArrayPersister.readData(ArrayPersister.java:172)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:411)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:81)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:639)
| at org.jboss.serial.persister.RegularObjectPersister.readSlotWithFields(RegularObjectPersister.java:353)
| at org.jboss.serial.persister.RegularObjectPersister.defaultRead(RegularObjectPersister.java:273)
| at org.jboss.serial.persister.RegularObjectPersister.readData(RegularObjectPersister.java:241)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:411)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:81)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:639)
| at org.jboss.serial.persister.RegularObjectPersister.readSlotWithFields(RegularObjectPersister.java:353)
| at org.jboss.serial.persister.RegularObjectPersister.defaultRead(RegularObjectPersister.java:273)
| at org.jboss.serial.persister.RegularObjectPersister.readData(RegularObjectPersister.java:241)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:411)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:81)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:639)
| at org.jboss.serial.io.JBossObjectInputStream.readObjectOverride(JBossObjectInputStream.java:165)
| at java.io.ObjectInputStream.readObject(ObjectInputStream.java:333)
| at org.jboss.remoting.serialization.impl.jboss.JBossSerializationManager.receiveObject(JBossSerializationManager.java:127)
| at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:350)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
| Caused by: java.lang.InstantiationException: org.jboss.remoting.transport.local.LocalClientInvoker
| at java.lang.Class.newInstance0(Class.java:335)
| at java.lang.Class.newInstance(Class.java:303)
| at org.jboss.serial.classmetamodel.ClassMetaData.newInstance(ClassMetaData.java:319)
| ... 44 more
|
What am I doing wrong here?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964672#3964672
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964672
More information about the jboss-user
mailing list