• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

ClassNotFoundException with Persistent Session

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,we're having the following setup:
WAS 4 (FP4), Win2000 and DB2 7.2 (FP7).

I seems that we have a problem with Persistent Session since we get the following log in stdout log file of WAS:
[8/16/02 10:50:30:750 CEST] 50eb91f0 SessionContex X SESN0051E: BackedHashtable:getValue - class not found. An attempt to deserialize a session object from the database has resulted in a ClassNotFoundException. The object to be deserialized must be contained in the classpath for all JVMs that can access the session. VOMUGUEGRQ4HZF2535M321Q VOMUGUEGRQ4HZF2535M321Q
[8/16/02 10:50:34:891 CEST] 50eb91f0 SessionContex X WTRN0047E: java.lang.ClassNotFoundException: com.mysap.mp.busdir.component.searchengine.ejb._SearchEngineSession_Stub
at java.net.URLClassLoader.findClass(URLClassLoader.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))

I'm a bit confused about the IBM message:
The object to be deserialized must be contained in the classpath for all JVMs that can access the session.
Does this mean that we have to set the deployed code of our EJBs also on the VM classpath of the appservers? My understanding was that it's more than enough to have these jars in the ear file?

Am I getting something wrong?
Another open issue for me is the fact that the object has been serialized but it should be problem to deserialize it?
An help is really appreciated.
Thanks in advance,
Michel
 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can I assume that you are storing a reference to an EJB in the Http Session?
I'm not sure that this is good practice since it is effectively a remote object. You are advised not to store any references to other system resources such as database and network connections in the session and this probably holds for EJBs. Maybe someone else could comment?
What type of EJB is it? Session or Entity? If it is a session bean then why do you need to store a reference to it in the session? Particularly if it is a Stateless session bean, the EJB doesn't store state so it seems pointless to try and store it in the session - just look it up each time?
Regarding classpath - you can set the manifest classpath of a Jar to refernce other Jars or classes - one way of doing this is to have all common classes in the application in a Common.jar file and have all EJBs and WARs reference this common jar. However, I don't think this is the solution you require.
Cheers,
Steve
 
Michael Laufer
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Steve, thanks for your quick reply, yeah you're
right, we're storing to an stateful EJB in our session, to be more precise we store a Business Delegate that holds that reference in the HTTP session, but we really find no other place to store that object since it corresponds to a particular user and holds the state for the user's search results within the current session. This is the only place in our application but we really found no other solution. Any other (probably better) idea? This delegate is packed in the war module.
Do we have to modify the manifest entry of the war module accordingly or do you suggest to put the particular EJB stub also on the VM classpath to support the Persistent Session feature?
I'm interested in any information and ideas;-)
Thanks in advance,
Michel
 
Steve Granton
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I've not used Stateful session beans in this manner (though I'm going to try an example as soon as I get a chance) so maybe someone with more knowledge in this area could help.
However, one thing that springs to mind - what type of reference are you storing in the session?
I found the following in the J2EE Tutorial. Are you storing the reference by calling the getEJBObject() method? Maybe this is wrong but as I say I haven't had a chance to perform an example.
I hope this helps.
Cheers,
Steve


Passing an Enterprise Bean's Object Reference
Suppose that your enterprise bean needs to pass a reference to itself to another bean. You might want to pass the reference, for example, so that the second bean can call the first bean's methods. You can't pass the this reference because it points to the bean's instance, which is running in the EJB container. Only the container may directly invoke methods on the bean's instance. Clients access the instance indirectly by invoking methods on the object whose type is the bean's remote interface. It is the reference to this object (the bean's remote reference) that the first bean would pass to the second bean.
A session bean obtains its remote reference by calling the getEJBObject method of the SessionContext interface. An entity bean would call the getEJBObject method of the EntityContext interface. These interfaces provide beans with access to the instance contexts maintained by the EJB container. Typically, the bean saves the context in the setSessionContext method. The following code fragment shows how a session bean might use these methods.
public class WagonBean implements SessionBean {

SessionContext context;
...
public void setSessionContext(SessionContext sc) {
this.context = sc;
}
...
public void passItOn(Basket basket) {
...
basket.copyItems(context.getEJBObject());
}
...


 
Michael Laufer
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, our class holds as reference to the Handle of that stateful EJB and the serialization process seems to work since we see also the entry in the database and don't get any exceptions while we serialize the object. And suddenly when Websphere's persistent session feature tries to deserialize we get the ClassNotFoundException that says that the stub is missing. But we definitly have that stub in our ear file ...Has anybody ever experinced the same problems?
Any help is really appreciated since we really need a solution for that problem and we're currently running out of time.
Thanks in advance,
Michel
 
reply
    Bookmark Topic Watch Topic
  • New Topic