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

ejb local home problems

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, hope you can help me...

i have a simple struts action and in it i try to get a local home
SupplierLocalHome see below 1.

When i try to access the local home i get a class cast exception see 2.
This class is the one generated by WSAD for deployment.
This class does indeed implement my interface i.e. com.pjs2k.spj.supplier.SupplierLocalHome

Any ideas as to why this error occurs would be appreciated. I have been stuck on this for some days and cannot see the problem.

Thanks





<< 1. >>>
Properties p = new Properties();
p.put( Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
p.put(Context.PROVIDER_URL, "corbaloc:iiop:localhost:2809");
Context ctxt = new InitialContext();
//Object o=ctxt.lookup("java:comp/env/ejb/com/pjs2k/spj/supplier/SuppliersLocalHome");
Object o=ctxt.lookup("local:ejb/ejb/com/pjs2k/spj/supplier/SupplierLocalHome");
SupplierLocalHome h1=(SupplierLocalHome)o;


<< 2. >>
action called
[07/02/05 17:26:07:814 GMT] 7e7cd4d2 RequestProces W org.apache.struts.action.RequestProcessor Unhandled Exception thrown: class java.lang.ClassCastException
[07/02/05 17:26:07:814 GMT] 7e7cd4d2 WebGroup E SRVE0026E: [Servlet Error]-[com.pjs2k.spj.supplier.EJSLocalCMPSupplierHome_846ffa9e]: java.lang.ClassCastException: com.pjs2k.spj.supplier.EJSLocalCMPSupplierHome_846ffa9e
at net.ubsw.pjs2kweb.actions.SuppliersAction.execute(SuppliersAction.java:72)

<<3>>
public class EJSLocalCMPSupplierHome_846ffa9e extends EJSLocalWrapper implements com.pjs2k.spj.supplier.SupplierLocalHome, com.pjs2k.spj.supplier.websphere_deploy.SupplierBeanInternalLocalHome_846ffa9e {
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can't you put all the stack trace of the exception? Thanks.
 
paul sinnott
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Been debugging a bit further. I noticed that I had created an erroneous duplicate reference that might have been confusing WSAD so have got rid of that. But now have other problems.

My Supplier bean has a jndi reference of:ejb/com/pjs2k/spj/supplier/SuppliersLocalHome

If i run the server up and launch the UTC i can clearly see this bean under
the Local EJB beans section.

but if i enter

local:ejb/ejb/com/pjs2k/spj/supplier/SuppliersLocalHome

in the JNDI Lookup text box i get this message

IWAD0402E Could not perform lookup with the JNDI name: Name "ejb/ejb/com/pjs2k/spj/supplier/SuppliersLocalHome" not found in context "local:".

i get the same message now from the struts action:


[09/02/05 10:03:45:588 GMT] 6d606ac7 RequestProces W org.apache.struts.action.RequestProcessor Unhandled Exception thrown: class javax.naming.NameNotFoundException
[09/02/05 10:03:45:885 GMT] 6d606ac7 WebGroup E SRVE0026E: [Servlet Error]-[Name "ejb/ejb/com/pjs2k/spj/supplier/SuppliersLocalHome" not found in context "local:".]: javax.naming.NameNotFoundException: Name "ejb/ejb/com/pjs2k/spj/supplier/SuppliersLocalHome" not found in context "local:".
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1021)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:932)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1261)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1253)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1307)
at javax.naming.InitialContext.lookup(InitialContext.java:360)
at net.ubsw.pjs2kweb.actions.SuppliersAction.execute(SuppliersAction.java:71)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:443)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you defined the <ejb-local-ref> element in the web.xml, which effectively maps the ejb refrence from ejb container to web container.

Cheers
Surendra
 
Surendra Kumar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry i mean ejb-local-ref element
 
paul sinnott
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if i try and create a reference in the web xml through the web deplyment editor i get:
"No Enterprise beans which implement local interface exist"

also

why can i not do the lookup through the jndi lookup in the UTC.

thanks for your prompt response btw-appreciated
 
Surendra Kumar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You must be able to see the local beans under the jndi home in UTC.

Generally they appear under local
 
paul sinnott
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i can see the local bean it is there defo

but there is also a text box with the label JNDI Name and a 'lookup' button

when i type into that box "local:ejb/ejb/com/pjs2k/spj/supplier/SuppliersLocalHome"

i get error
"IWAD0402E Could not perform lookup with the JNDI name: Name "ejb/ejb/com/pjs2k/spj/supplier/SuppliersLocalHome" not found in context "local:"."

thats what i get also in the java code.

the bean is there - maybe i am looking it up wrong?
 
Water! People swim in water! Even tiny ads swim in water:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic