• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

EJB with Weblogic 5.1

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I call a EJB in a servlet, it doesn't work but if I do this in an application client that calls EJB, it works perfectly.
What is the problem?
The exception is:
java.lang.ClassCastException at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:296)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
at src.servlet.gesServlet.init(gesServlet.java:122)
at src.servlet.mainServlet.init(mainServlet.java:38)
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:390)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:349)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:338)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:164)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:99)
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:742)
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:686)
at weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:247)
at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:361)
at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:261)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
 
Saloon Keeper
Posts: 28126
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had a LOT of fun with this one about a year back. There are several DIFFERENT CLASSPATHS within WLS5.1 - the first thing you need to do is make sure that the EJB is accessible through the right one. I believe there's a warning in the docs in particular about not putting stuff in the servlet classpath if it should be somewhere else. Or maybe it's in the comments in the model config file?
Anyway, what will happen is essentially, there are two copies of the class instantiated, which superficially are identical, but which Java considers unique. So what should be a perfectly legitimate portableObjectNarrow() will fail. I think if you pull the EJB from the servlet classpath, internal WebLogic magic will still find the EJB for the servlet, but your message will go away.
 
BWA HA HA HA HA HA HA! Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic