LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Jboss hell with ejbs plz help (https://www.linuxquestions.org/questions/programming-9/jboss-hell-with-ejbs-plz-help-126091/)

juby 12-15-2003 02:01 PM

Jboss hell with ejbs plz help
 
Hi
i am trying to call a stateless EJB from a ActionServlet (struts) the app
server i use is jboss 2.4.x, I dont know what is wrong but .. the application
throws error during startup :'(


this is the relevant log...

[01:11:11,562,EmbeddedCatalinaServiceSX] linkEjbRefs
[01:11:11,573,EmbeddedCatalinaServiceSX] Linking ejb-ref: ejb/LoginBean to JNDI
name: null
[01:11:11,601,EmbeddedCatalinaServiceSX] Failed to setup web application ENC
javax.naming.NamingException: ejb-ref: ejb/LoginBean, expected jndi-name in
jboss-web.xml

the commands i used to make the ejb-jar, war and ear files are

jar cvfM rave.war WEB-INF/ images/ *.jsp *.css

jar cvfM rave-ejb.jar META-INF/ejb-jar.xml raveEjb/*.class

jar cvfM rave.ear META-INF/application.xml META-INF/jboss.xml
META-INF/jboss-web.xml rave.war rave-ejb.jar

the contents of the XML files are
EJB-JAR.xml
===========
<ejb-jar>
<description>EJBs for Rave</description>
<display-name>Rave EJB</display-name>
<enterprise-beans>
<session>
<ejb-name>LoginBean</ejb-name>
<home>raveEjb.LoginHome</home>
<remote>raveEjb.Login</remote>
<ejb-class>raveEjb.LoginEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>LoginBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>


JBOSS.XML
=========
<?xml version="1.0" encoding="Cp1252"?>
<jboss>
<enterprise-beans>
<session>
<ejb-name>ejb/LoginBean</ejb-name>
<jndi-name>ejb/LoginBean</jndi-name>
</session>
<secure>false</secure>
</enterprise-beans>
</jboss>

JBOSS-WEB.XML
============
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<ejb-ref>
<ejb-ref-name>ejb/LoginBean</ejb-ref-name>
<jndi-name>ejb/LoginBean</jndi-name>
</ejb-ref>
</jboss-web>

WEB.XML(relevant part)
=======
<ejb-ref>
<ejb-ref-name>ejb/LoginBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>raveEjb.LoginHome</home>
<remote>raveEjb.Login</remote>
</ejb-ref>


this is my ejb access code
=========================

//Properties for jboss
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL, "localhost:1099");

//obtain a jndi server reference
Context ctx = new InitialContext(props);

//Get a home Interface reference
Object loginEjbObj = ctx.lookup("java:comp/env/ejb/LoginBean");

//Typecast this object into a home interface type
//use this if we use remote home method
LoginHome home =
(LoginHome)PortableRemoteObject.narrow(loginEjbObj,LoginHome.class);


//Obtain a remote interface
Login loginObj = home.create();

// Call the EJB's validation method

if(loginObj.validateUser(s_user_Name, s_password))
{


Can anyone tell me why on earth do i get the exception ?????


All times are GMT -5. The time now is 04:13 PM.