|It sure looks like the system (Service libraries) rather than application
|classloader is being used, despite your code that clearly sets the
|contextClassLoader to the container's.

And some people wonder why I loved having Rickard Oberg on the project back
in EJBoss 0.9

attached is a ObjectinputStreamWithClassLoader that rickard and monson
haefel put together one night when I ran into the same problem you did
Francisco :)

Rickard Oberg was a fucking genius make no mistakes about it ...

Francisco to use this you want to create the ObjectInputStream with this
puppy and pass the context cl as the parameter to the constructor.  Then
call readObject as you did.

BTw don't commit this, MarshalledObject operates pretty much the same way.

marcf

|
|Have you checked that poaCurrent doesn't change the context classloader and
|the classloader is really what you expect when you call toObject?
|
|david jencks
|
|
|On 2001.11.21 13:04:25 -0500 Francisco Reverbel wrote:
|> Hi,
|>
|> I have a classloader problem in the IIOP container invoker code and would
|> really appreciate some helpful hints... Classloader wizards: to
|> understand
|> the problem you do not have to know anything about CORBA/IIOP, so please
|> read on!
|>
|> The problem only shows up with entity beans. When the IIOP container
|> invoker creates a CORBA reference for such a bean, it embeds the bean�s
|> primary key into the CORBA reference. When handling a bean invocation,
|> the
|> container invoker extracts the PK from the CORBA reference and passes
|> this
|> PK to the container as the first argument of a MethodInvocation.
|>
|> A ClassNotFoundException is thrown when the container invoker attempts to
|> extract the PK from the CORBA reference (got the stack trace below
|> running
|> RMH's well-known cabin bean):
|>
|> java.lang.ClassNotFoundException: com.titan.cabin.CabinPK
|>      at
|org.jboss.system.ServiceLibraries.loadClass(ServiceLibraries.java:372)
|>      at
|org.jboss.system.URLClassLoader.loadClass(URLClassLoader.java:111)
|>      at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
|>      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
|>      at java.lang.Class.forName0(Native Method)
|>      at java.lang.Class.forName(Class.java:195)
|>      at
|java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:654)
|>      at
|java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:918)
|>      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
|>      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
|>      at
|java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
|>      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
|>      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
|>      at org.jboss.ejb.CacheKey.readExternal(CacheKey.java:118)
|>      at
|java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1212)
|>      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
|>      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
|>      at
|org.jboss.ejb.plugins.iiop.server.IIOPContainerInvoker.toObject(IIO
|PContainerInvoker.java:896)
|>      at
|org.jboss.ejb.plugins.iiop.server.IIOPContainerInvoker._invoke(IIOP
|ContainerInvoker.java:665)
|>      at
|org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:239)
|>      at
|org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:456)
|>      at org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:581)
|>
|> I've found a way of circumventing the problem, but am not satisfied with
|> it. Things work if I wrap the PK into a MarshalledObject before embedding
|> it into the CORBA reference, and do the opposite thing when extracting
|> the
|> PK from the reference. Runs fine, but is very slow... The bank test takes
|> forever to run.
|>
|> This code is in org.jboss.ejb.plugins.iiop.server.IIOPContainerInvoker,
|> under contrib/iiop. Insertion/extraction of the PK is done through the
|> methods toByteArray() and toObject(). Each of these methods has two
|> implementations, one of them commented out. The commented out
|> implementation "solves" the problem in the way described above.
|>
|> Suggestions are very welcome!
|>
|> Cheers,
|>
|> Francisco
|>
|>
|>
|>
|>
|>
|>
|>
|> _______________________________________________
|> Jboss-development mailing list
|> [EMAIL PROTECTED]
|> https://lists.sourceforge.net/lists/listinfo/jboss-development
|>
|>
|
|_______________________________________________
|Jboss-development mailing list
|[EMAIL PROTECTED]
|https://lists.sourceforge.net/lists/listinfo/jboss-development

Attachment: ObjectInputStreamWithClassLoader.java
Description: Binary data

Reply via email to