*
The moose likes JBoss/WildFly and the fly likes deploying session bean on jboss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "deploying session bean on jboss" Watch "deploying session bean on jboss" New topic
Author

deploying session bean on jboss

suchi verma
Greenhorn

Joined: Apr 06, 2004
Posts: 9
Hi i am new to jboss.
I have a session bean which I am invoking through a servlet.
The .jar file and . war file is packaged in the same .ear file.
but after deploying the .ear file on jboss server ...the error i get is
----------------------------------------------
javax.naming.NamingException: resource-ref: org.jnp.interfaces.NamingContextFactory has no valid JNDI binding. Check the jboss-web/resource-ref.
---------------------------------------------
is there a problem in the deployment descriptor??
i would also like to know where yhe vendor specific file for eg jboss.xml i s put.
please help.
Amit Ghai
Ranch Hand

Joined: Mar 24, 2004
Posts: 35
Check that your deployment descriptor(ejb-jar.xml) it should be in the META-INF folder along with your jboss.xml
ejb-jar.xml should be like
<ejb-jar >
<description>Helloworld example EJB</description>
<display-name>Helloworld EJB</display-name>
<enterprise-beans>
<session >
<ejb-name>Helloworld</ejb-name>
<home>HelloworldHome</home>
<remote>Helloworld</remote>
<ejb-class>Helloworld.HelloworldBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
jboss.xml should be like--->
<jboss>
<enterprise-beans>
<session>
<ejb-name>Helloworld</ejb-name>
<jndi-name>Helloworld</jndi-name>
</session>
</enterprise-beans>
</jboss>


Reasonable people adapt themselves to the world. Unreasonable people attempt to adapt the world to themselves. All progress, therefore, depends on unreasonable people.
suchi verma
Greenhorn

Joined: Apr 06, 2004
Posts: 9
hi amit
thnx for the help.My ejb-jar.xml n jboss.xml are fine as according to your format.
my web.xml is as follows
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE web-app>
- <web-app id="WebApp_ID">
- <servlet id="Servlet_1081713238854">
<servlet-name>ClientServlet1</servlet-name>
<servlet-class>ClientServlet1</servlet-class>
</servlet>
- <servlet-mapping id="ServletMapping_1081713305468">
<servlet-name>ClientServlet1</servlet-name>
<url-pattern>/ClientServlet1</url-pattern>
</servlet-mapping>
- <welcome-file-list id="WelcomeFileList_1081713238855">
<welcome-file>index.html</welcome-file>
</welcome-file-list>
- <ejb-ref id="EjbRef_1081713238858">
<ejb-ref-name>beans.Simple</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>beans.SimpleHome</home>
<remote>beans.Simple</remote>
<ejb-link>Simple</ejb-link>
</ejb-ref>
</web-app>
where all the beans are in beans folder.
after deployment when i try to invoke the servlet client it gives me an error
HTTP 500 NO CONTEXT CONFIGURED
.....Could there be some problem in the jndi settings???
Also is the <ejb-link> tag neccesary in web.xml when both .war n .jar files are in the same .ear file
Amit Ghai
Ranch Hand

Joined: Mar 24, 2004
Posts: 35
You dont need ejb-link in web.xml.
Hope you are clear that an ear should have .jar to keep all the class files and .war to have all jsp's
i'll give you an example.
suppose i have example.ear in the end for deployment.
its structure would be something like-
3 folders
ejb-app.jar
META-INF
web-app.war
now my ejb-app.jar has my class files in a folder hierarchy
and a META-INF which has jboss.xml and ejb-jar.xml
The META-INF has an application.xml which defines the link between war and jar. which is as follows--
<application>
<display-name>My Application</display-name>
<module>
<web>
<web-uri>web-app.war</web-uri>
<context-root>/</context-root>
</web>
</module>
<module>
<ejb>ejb-app.jar</ejb>
</module>
</application>
The web-app.war has again 2 folders namely
JSP having all jsp's and WEB-INF which has and tld's along with struts-config.xml and tiles-def.xml if you are using struts and tiles.
and ofcourse web.xml
web.xml should only have servlet mapping.
hope this helps.
 
jQuery in Action, 2nd edition
 
subject: deploying session bean on jboss
 
Similar Threads
Error in deploying stateless session bean 2.1 on Jboss 5 GA
Can we deploy Ejb3.0 as a EAR file.
SB has problem looking up the EB via JNDI.
Error deploying ejb in JBoss 5
Prevent JBoss deploying a bean