Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

deploying session bean on jboss

 
suchi verma
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
suchi verma
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic