0 Replies Latest reply on Feb 10, 2005 5:26 AM by Sameer Saptarishi

    EJB and Struts1.1 in JBoss 4.0

    Sameer Saptarishi Newbie

      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>


      Has anyone else faced this problem??
      Please help me....
      Thanks a lot