I have two application packed in two different ear files and I want from a
class in one ear file to access an ejb in the other file. Note that the class
is not an ejb. I know that the ejb is deployed correctly because another
application I have on Tomcat can access it.
The ejb-jar.xml in the ear file of the ejb looks like this
<session.>
<description.>NPSystemImpl</description.>
<display-name>NPSystemImpl</display-name>
<ejb-name>NPSystem</ejb-name>
<home.>cy.com.netinfo.netpins.interfaces.NPSystemHome</home.>
<remote.>cy.com.netinfo.netpins.interfaces.NPSystem</remote.>
<ejb-class>cy.com.netinfo.netpins.ejb.NPSystemImpl</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
... and the jboss.xml like this
<ejb-name>NPSystem</ejb-name>
<jndi-name>ejb/NPSystem</jndi-name>
<method-attributes>
</method-attributes>
The code in the class where I lookup the ejb is like:
private static NPSystem remoteConnect() throws Exception{
NPSystem bean;
try{
Object reference = (new
InitialContext()).lookup("java:comp/env/NPSystem");
NPSystemHome home =
(NPSystemHome)PortableRemoteObject.narrow(reference,NPSystemHome.class);
bean = home.create();
}catch(Exception e){
System.out.println(e.toString());
throw e;
}
return bean;
}//end remoteConnect
My problem is that I don't know how to configure the ejb-jar.xml and jboss.xml
in the ear file where my calling class resides so that
lookup("java:comp/env/NPSystem") would point to my ejb.
Some code I found on the internet is not accepted by jboss. For example I tried
this in ejb-jar.xml
<ejb-jar>
<enterprise-beans>
NPSystem
<ejb-ref>
<ejb-ref-name></ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home.>cy.com.netinfo.netpins.interfaces.NPSystemHome</home.>
<remote.>cy.com.netinfo.netpins.interfaces.NPSystem</remote.>
</ejb-ref>
<enterprise-beans>
<ejb-jar>
The above is not accepted because the attributes <ejb-name>,<ejb-class> etc
must be declared...
I hope you have an idea of how to solve this.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3935153#3935153
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3935153
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user