• 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)
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Will u like to give a code sample where u r looking for EJB with details?
 
cris abanades
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
p2.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
p2.put(javax.naming.Context.PROVIDER_URL,"t3://"+servLoc);

public void init(ServletConfig config) throws ServletException {
if (homeUMon==null | | remoteUMon==null) {
java.util.Properties p2 = new java.util.Properties();
java.util.Properties p = new java.util.Properties();

try {
InitialContext ctx = new InitialContext(p2);
Object objref = ctx.lookup("UserMonitor");
homeUMon =(UserMonitorHome)PortableRemoteObject.narrow(objref,UserMonitorHome.class);
} catch (Exception NamingException) {
NamingException.printStackTrace();
}
try {
remoteUMon = homeUMon.create();
} catch (Exception NamingException) {
NamingException.printStackTrace();
}

 
Everybody's invited. Except this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic