-
1. Re: Context
waynebaylor Oct 10, 2007 9:31 AM (in response to axismundi)you have to explicitly "put" stuff in the ejb context. this is usually done with web.xml and jboss-web.xml.
-
2. Re: Context
axismundi Oct 11, 2007 3:58 AM (in response to axismundi)I am still having trouble to resolve the SLSB on the web-client (running on the same VM inside the same EAR on AS 4.2.1):
jboss-web.xml
<jboss-web>
<ejb-local-ref>
<ejb-ref-name>ejb/ImportManagerBean</ejb-ref-name>
<local-jndi-name>ImportManager</local-jndi-name>
</ejb-local-ref>
</jboss-web>
web.xml
<ejb-local-ref>
<ejb-ref-name>ejb/ImportManagerBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>mypackage.ImportManager</local-home>
mypackage.ImportManager
<ejb-link>ImportManager</ejb-link>
</ejb-local-ref>
--> the Bean/local IF should now be available in JNDI-ctx "ImportManager"
context.lookup("ImportManager");
but it IS NOT !
The ear is deployed successfully (not complaining about the config).
I understand that this trouble is due to a "conflict" between JEE5 (EJB3) and JEE1.4 (Servlet 2.4). But there should be some solution to this.
Any hint to solve this is appreciated. -
3. Re: Context
axismundi Oct 11, 2007 4:35 AM (in response to axismundi)there was a typo in web.xml. It should look like this:
<ejb-local-ref>
<ejb-ref-name>ejb/ImportManagerBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>mypkg.ImportManager</local-home>
mypkg.ImportManager
<ejb-link>ImportManager</ejb-link>
</ejb-local-ref> -
4. Re: Context
jaikiran Oct 11, 2007 5:35 AM (in response to axismundi)<ejb-ref-name>ejb/ImportManagerBean</ejb-ref-name>
context.lookup("ImportManager");
but it IS NOT !
Try this:context.lookup("java:comp/env/ejb/ImportManagerBean");
-
5. Re: Context
axismundi Oct 11, 2007 6:00 AM (in response to axismundi)"jaikiran" wrote:
Try this:context.lookup("java:comp/env/ejb/ImportManagerBean");
thanks for the hint. using the absolute JNDI-path "java:comp/env/ejb/ImportManager" I am getting the same proxy-instance like with "kportal/ImportManagerBean/local"
This proxy is not type-compatible!java.lang.ClassCastException: $Proxy356
This is really interesting, because the JNDIView reports this:kportal | +- ImportManagerBean (class: org.jnp.interfaces.NamingContext) | | +- local (proxy: $Proxy356 implements interface mypkg.ImportManager,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
According to this JNDI-report the proxy is implementing the home-IF properly, but this obviously not the case.
Anymore idea on this matter? -
6. Re: Context
jaikiran Oct 11, 2007 6:04 AM (in response to axismundi)Can you post the code where you are casting the object after the lookup? Additionally have a look at http://wiki.jboss.org/wiki/Wiki.jsp?page=ClassCastExceptions which will help you identify whether this is a classloader issue.
-
7. Re: Context
axismundi Oct 11, 2007 6:29 AM (in response to axismundi)YES, it is a classical classloader problem.
I was putting the class mypgk.ImportManager not only in the ejb.jar, but also in mywar.war/WEB-INF/lib.
After removing the class from WEB-INF/lib, no ClassCastException anymore.
I am fully aware of the type-incompatibility when loaded from different class-loaders. But I don't understand one thing.
JBoss is based on a hierarchical class-loader, right?
classes in app.ear are also available in deployment-units inside of the EAR, but not in "sibling-deployment-units".
The scenario:
mypkg.ImportManager.class is available in ejb-package.jar ONLY.
How can this class be loaded in webapp.war deployment-unit without being deployed ??
I'd expect a ClassNotFoundException !