• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getEJBObject ERROR!!!

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Lasagna is spaghetti flvored cake. Just like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic