wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes getEJBObject ERROR!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "getEJBObject ERROR!!!" Watch "getEJBObject ERROR!!!" New topic
Author

getEJBObject ERROR!!!

Hrvoje Canzek
Greenhorn

Joined: Sep 18, 2002
Posts: 16
Hi there,
i use the BusinessDelegate and ServiceLocator pattern for the client to invoke stateless session beans. In the ServiceLocator i cache the EJBHome objects. Furthermore i use the following methods from the Core J2EE Patterns
// Converts the serialized string into EJBHandle
// then to EJBObject
public EJBObject getService(String id) throws RemoteException
{
Handle handle = null;
if (id == null)
{
System.out.println("id not available!!!");
}
try
{
byte[] bytes = new String(id).getBytes();
InputStream io = new ByteArrayInputStream(bytes);
ObjectInputStream os = new ObjectInputStream(io);
handle = (Handle)os.readObject();
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
return handle.getEJBObject();
}
}
// Returns the String that represents the given
// EJBObject's handle in serialized format.
protected String getId(EJBObject session) throws RemoteException
{
Handle handle = null;
ByteArrayOutputStream fo = null;
try
{
handle = session.getHandle();
fo = new ByteArrayOutputStream();
ObjectOutputStream so = new ObjectOutputStream(fo);
so.writeObject(handle);
so.flush();
so.close();
}
catch(RemoteException ex)
{
e.printStackTrace();
}
catch(IOException ex)
{
e.printStackTrace();
}
finally
{
return new String(fo.toByteArray());
}
}
The getID works fine, but when i call getService the following error
occured
java.lang.ClassNotFoundException:
business_layer.enterprise_beans.session_facade._Cart_Stub
at java.net.URLClassLoader.findClass(URLClassLoader.java(Inlined Compiled
Code))
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java(Compiled Code))
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:690)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:963)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:402)
......
The application runs on WebSphere App. Server V5
Can someone tell me what is wrong, and how to fix it???
Thank you
Regards
Hrvoje Canzek
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getEJBObject ERROR!!!