aspose file tools*
The moose likes JBoss/WildFly and the fly likes EJB lookup in JBoss 4.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "EJB lookup in JBoss 4.0" Watch "EJB lookup in JBoss 4.0" New topic
Author

EJB lookup in JBoss 4.0

adrian mills
Ranch Hand

Joined: Dec 09, 2004
Posts: 63
Hi All,
I am trying to Access an EJB from my Struts Action class in JBoss4.0.
The EJB as well as the war application is deployed properly on the same server.
But when I try to access the EJB from the Action class I get the following error.


java.lang.ClassCastException
com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
first.UserLoginAction.execute(UserLoginAction.java:48)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)


Here is my <jboss.xml>


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">

<enterprise-beans>

<ejb-name>Login</ejb-name>
<jndi-name>Login</jndi-name>

</enterprise-beans>



Here is my ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>

<ejb-name>Login</ejb-name>
first.LoginHome
first.Login
<ejb-class>first.LoginEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>

</enterprise-beans>
<assembly-descriptor>
<container-transaction>

<ejb-name>Login</ejb-name>
<method-name>*</method-name>

<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

Here is my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>InitialContextFactory</param-name>
<param-value>org.jnp.interfaces.NamingContextFactory</param-value>

</context-param>
<context-param>
<param-name>ProviderURL</param-name>
<param-value>localhost</param-value>

</context-param>
<context-param>
<param-name>SecurityPrincipal</param-name>
<param-value>admin</param-value>
Used to obtain the initial context of the JNDI tre
</context-param>
<context-param>
<param-name>SecurityCredentials</param-name>
<param-value>123</param-value>
Used to obtain the initial context of the JNDI tree
</context-param>


<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param >
<param-name >application</param-name >
<param-value >first.application</param-value >
</init-param >

<load-on-startup>2</load-on-startup>


<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>



<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>



<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>


</web-app>

Thanks a lot in advance....
Regards
Adrian
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB lookup in JBoss 4.0
 
Similar Threads
form page cannot find ActionMappings or ActionFormbeans
context root getting changed
Cannot find ActionMappings or ActionFormBeans collect
ClassCastException when casting to home interface
Problem in running Struts tutorial example by Isabelle