1 Reply Latest reply on Apr 23, 2007 1:56 AM by jaikiran pai

    java.lang.ClassCastException

    anan smile Newbie

      Hi ,All

      In JSC 2.1 , web call Ejb's method, run fine on sun appserver 8.2,but happend error on jboss 4.0.2,as follows:
      ==========================================================================================================================
      2007-04-11 21:04:12,093 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/yx]] Error Description
      java.lang.ClassCastException
      at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
      at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
      at czqx.menusession.MenuSessionClient.create(MenuSessionClient.java:31)
      at czqx.menusession.MenuSessionClient.authPassword(MenuSessionClient.java:45)
      at yx.login.loginButton_action(login.java:365)
      ............................
      ==========================================================================================================================

      xml files in yx.war as follows:

      ========================================================================
      web.xml

      <web-app>
      ......
      <ejb-ref>
      <ejb-ref-name>ejb/MenuSession</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      czqx.MenuSessionHome
      czqx.MenuSession
      <ejb-link>CzqxEjb.jar#MenuSession</ejb-link>
      </ejb-ref>
      <resource-ref>
      DataSource
      <res-ref-name>jdbc/MSSQLDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      </web-app>
      ========================================================================
      sun-web.xml

      <sun-web-app error-url="">
      ......
      <ejb-ref>
      <ejb-ref-name>ejb/MenuSession</ejb-ref-name>
      <jndi-name>corbaname:iiop:localhost:24700#ejb/MenuSession</jndi-name>
      </ejb-ref>

      <resource-ref>
      <res-ref-name>jdbc/MSSQLDS</res-ref-name>
      <jndi-name>jdbc/MSSQLDS</jndi-name>
      <default-resource-principal>
      sa
      1234
      </default-resource-principal>
      </resource-ref>
      ......
      </sun-web-app>
      ==========================================================================
      jboss-web.xml

      <jboss-web>

      <resource-ref>
      <res-ref-name>jdbc/MSSQLDS</res-ref-name>
      <jndi-name>jdbc/MSSQLDS</jndi-name>
      </resource-ref>

      <ejb-ref>
      <ejb-ref-name>ejb/MenuSession</ejb-ref-name>
      <jndi-name>ejb/MenuSession</jndi-name>
      </ejb-ref>

      </jboss-web>
      ==========================================================================

      xml files in CzqxEjb.jar as follows:

      ==========================================================================
      ejb-jar.xml

      <ejb-jar>
      <display-name>CzqxEjb</display-name>
      <enterprise-beans>

      <ejb-name>Menuinfo</ejb-name>
      czqx.MenuinfoRemoteHome
      czqx.MenuinfoRemote
      <ejb-class>czqx.MenuinfoBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Integer</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Menuinfo</abstract-schema-name>
      <cmp-field>
      <field-name>menuid</field-name>
      </cmp-field>
      ......

      </enterprise-beans>
      </ejb-jar>
      ==========================================================================
      jboss.xml


      <enterprise-beans>

      <ejb-name>Menuinfo</ejb-name>
      <jndi-name>ejb/Menuinfo</jndi-name>


      <ejb-name>MenuSession</ejb-name>
      <jndi-name>ejb/MenuSession</jndi-name>


      <ejb-name>Operinfo</ejb-name>
      <jndi-name>ejb/Operinfo</jndi-name>


      <ejb-name>Charcominfo</ejb-name>
      <jndi-name>ejb/Charcominfo</jndi-name>


      <ejb-name>Roleinfo</ejb-name>
      <jndi-name>ejb/Roleinfo</jndi-name>


      <ejb-name>Rolerightinfo</ejb-name>
      <jndi-name>ejb/Rolerightinfo</jndi-name>


      <ejb-name>Copyerinfo</ejb-name>
      <jndi-name>ejb/Copyerinfo</jndi-name>

      </enterprise-beans>

      ==========================================================================
      sun-ejb-jar.xml

      <sun-ejb-jar>
      <enterprise-beans>

      <ejb-name>Menuinfo</ejb-name>
      <jndi-name>ejb/Menuinfo</jndi-name>
      <ejb-name>Operinfo</ejb-name>
      <jndi-name>ejb/Operinfo</jndi-name>
      <ejb-name>Charcominfo</ejb-name>
      <jndi-name>ejb/Charcominfo</jndi-name>
      <ejb-name>Roleinfo</ejb-name>
      <jndi-name>ejb/Roleinfo</jndi-name>
      <ejb-name>Rolerightinfo</ejb-name>
      <jndi-name>ejb/Rolerightinfo</jndi-name>
      <ejb-name>Copyerinfo</ejb-name>
      <jndi-name>ejb/Copyerinfo</jndi-name>
      <pass-by-reference>false</pass-by-reference>

      <ior-security-config>
      <transport-config>
      SUPPORTED
      SUPPORTED
      <establish-trust-in-target>SUPPORTED</establish-trust-in-target>
      <establish-trust-in-client>SUPPORTED</establish-trust-in-client>
      </transport-config>
      <as-context>
      <auth-method>USERNAME_PASSWORD</auth-method>
      default
      false
      </as-context>
      <sas-context>
      <caller-propagation>SUPPORTED</caller-propagation>
      </sas-context>
      </ior-security-config>
      <is-read-only-bean>false</is-read-only-bean>
      <gen-classes/>



      <ejb-name>MenuSession</ejb-name>
      <jndi-name>ejb/MenuSession</jndi-name>


      <cmp-resource>
      <jndi-name>jdbc/MSSQLDS </jndi-name>
      <create-tables-at-deploy>false</create-tables-at-deploy>
      <drop-tables-at-undeploy>false</drop-tables-at-undeploy>
      <database-vendor-name>mssql</database-vendor-name>
      <!--<database-vendor-name>pointbase</database-vendor-name>-->
      </cmp-resource>
      </enterprise-beans>
      </sun-ejb-jar>
      ==========================================================================

      i can't find the question by as follows link
      http://forum.java.sun.com/thread.jspa?threadID=742861&messageID=4258493

      Thanks
      Smile.