0 Replies Latest reply on May 29, 2009 6:07 PM by New EJB

    IllegalArgumentException while getting data JBoss 4.0.5GA

    New EJB Newbie

      Hello there,

      I'm working on a EJB migration from Weblogic 6.1 to JBossAS 4.0.5GA. While accessing the first EJB after user is authenticated, I'm getting following exception.

      2009-05-29 17:43:30,886 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.ImmMenu] Executing SQL: SELECT menu_name, parent_id, sequence, allow_read_only, link_server_name, link FROM IMM_WB_MENU WHERE (menu_id=?)
      2009-05-29 17:43:30,933 ERROR [org.jboss.ejb.plugins.LogInterceptor] EJBException in method: public abstract java.lang.String com.bn.merch.imm.ejb.ImmMenu.getMenuID() throws java.rmi.RemoteException, causedBy:
      java.lang.IllegalArgumentException
       at sun.reflect.UnsafeIntegerFieldAccessorImpl.set(UnsafeIntegerFieldAccessorImpl.java:62)
       at java.lang.reflect.Field.set(Field.java:656)
       at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.setInstanceValue(JDBCCMP1xFieldBridge.java:99)
       at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.loadInstanceResults(JDBCAbstractCMPFieldBridge.java:396)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:207)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:88)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:646)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:628)
       at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:406)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.loadEntity(CachedConnectionInterceptor.java:252)
       at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:243)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
       at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:126)
       at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:276)
       at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:104)
       at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:68)
       at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
       at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:527)
       at org.jboss.ejb.Container.invoke(Container.java:954)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
       at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
       at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
       at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
       at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
       at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
       at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:112)
       at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
       at $Proxy82.getMenuID(Unknown Source)
       at org.apache.jsp.jsp.imm_005fframework_005ftitle_jsp._jspService(imm_005fframework_005ftitle_jsp.java:280)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      2009-05-29 17:43:30,949 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/imm].[jsp]] Servlet.service() for servlet jsp threw exception
      java.rmi.ServerException: EJBException:; nested exception is:
       javax.ejb.EJBException: Internal error setting instance field cintSequence
       at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:365)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
       at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:527)
       at org.jboss.ejb.Container.invoke(Container.java:954)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
       at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
       at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
       at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
       at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
       at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
       at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:112)
       at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
       at $Proxy82.getMenuID(Unknown Source)
       at org.apache.jsp.jsp.imm_005fframework_005ftitle_jsp._jspService(imm_005fframework_005ftitle_jsp.java:280)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.ejb.EJBException: Internal error setting instance field cintSequence
       at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.setInstanceValue(JDBCCMP1xFieldBridge.java:107)
       at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.loadInstanceResults(JDBCAbstractCMPFieldBridge.java:396)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:207)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:88)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:646)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:628)
       at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:406)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.loadEntity(CachedConnectionInterceptor.java:252)
       at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:243)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
       at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:126)
       at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:276)
       at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:104)
       at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:68)
       at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
       ... 48 more
      Caused by: java.lang.IllegalArgumentException
       at sun.reflect.UnsafeIntegerFieldAccessorImpl.set(UnsafeIntegerFieldAccessorImpl.java:62)
       at java.lang.reflect.Field.set(Field.java:656)
       at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.setInstanceValue(JDBCCMP1xFieldBridge.java:99)
       ... 67 more
      


      This is my jbosscmp-jdbc.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC
       "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN"
       "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">
      
      <jbosscmp-jdbc>
       <defaults>
       <datasource>java:/immPool</datasource>
       <datasource-mapping>Oracle9i</datasource-mapping>
       <create-table>false</create-table>
       <remove-table>false</remove-table>
       <pk-constraint>false</pk-constraint>
       </defaults>
      
       <enterprise-beans>
       <entity>
       <ejb-name>ImmMenu</ejb-name>
       <table-name>IMM_WB_MENU</table-name>
      
       <cmp-field>
       <field-name>cstrMenuId</field-name>
       <column-name>menu_id</column-name>
       <not-null/>
       </cmp-field>
       <cmp-field>
       <field-name>cstrMenuName</field-name>
       <column-name>menu_name</column-name>
       <not-null/>
       </cmp-field>
       <cmp-field>
       <field-name>cintParentId</field-name>
       <column-name>parent_id</column-name>
       <not-null/>
       </cmp-field>
       <cmp-field>
       <field-name>cintSequence</field-name>
       <column-name>sequence</column-name>
       <!-- <not-null/> -->
       </cmp-field>
       <cmp-field>
       <field-name>cchrAllowReadOnly</field-name>
       <column-name>allow_read_only</column-name>
       <not-null/>
       </cmp-field>
       <cmp-field>
       <field-name>cstrLinkServerName</field-name>
       <column-name>link_server_name</column-name>
       <not-null/>
       </cmp-field>
       <cmp-field>
       <field-name>cstrLink</field-name>
       <column-name>link</column-name>
       <not-null/>
       </cmp-field>
      
      
      
       <query>
       <query-method>
       <method-name>findChild</method-name>
       <method-params>
       <method-param>int</method-param>
       </method-params>
       </query-method>
      
       <declared-sql>
       <where><![CDATA[(parent_id = {0})]]></where>
       <order><![CDATA[(sequence)]]></order>
       </declared-sql>
      
      
       </query>
      
       </entity>
       </enterprise-beans>
      </jbosscmp-jdbc>
      


      This is ejb-jar.xml
      <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
      
      
      <!-- Generated XML! -->
      
      <ejb-jar>
       <display-name>immejbs</display-name>
      
      <enterprise-beans>
       <entity>
       <ejb-name>ImmMenu</ejb-name>
       <home>com.bn.merch.imm.ejb.ImmMenuHome</home>
       <remote>com.bn.merch.imm.ejb.ImmMenu</remote>
       <ejb-class>com.bn.merch.imm.ejb.ImmMenuBean</ejb-class>
       <persistence-type>Container</persistence-type>
       <prim-key-class>java.lang.String</prim-key-class>
       <reentrant>False</reentrant>
       <cmp-field>
       <field-name>cstrMenuId</field-name>
       </cmp-field>
       <cmp-field>
       <field-name>cstrMenuName</field-name>
       </cmp-field>
       <cmp-field>
       <field-name>cintParentId</field-name>
       </cmp-field>
       <cmp-field>
       <field-name>cintSequence</field-name>
       </cmp-field>
       <cmp-field>
       <field-name>cchrAllowReadOnly</field-name>
       </cmp-field>
       <cmp-field>
       <field-name>cstrLinkServerName</field-name>
       </cmp-field>
       <cmp-field>
       <field-name>cstrLink</field-name>
       </cmp-field>
       <primkey-field>cstrMenuId</primkey-field>
      
       </entity>
      </enterprise-beans>
      
      
      <!-- If container managed !-->
      <assembly-descriptor>
       <container-transaction>
       <method>
       <ejb-name>ImmMenu</ejb-name>
       <method-name>*</method-name>
       </method>
       <trans-attribute>Required</trans-attribute>
       </container-transaction>
      </assembly-descriptor>
      
      
      </ejb-jar>
      


      We have a custom authenticator class defined in the login-config.xml:
      package com.bn.merch.imm.jboss;
      
      import java.security.acl.Group;
      import java.sql.Connection;
      import java.sql.SQLException;
      import java.sql.Statement;
      
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.security.auth.login.LoginException;
      
      import org.apache.log4j.Category;
      import org.jboss.security.SimpleGroup;
      import org.jboss.security.SimplePrincipal;
      import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
      
      
      /**
       *
       * This class connects JBoss with a user information repository (eg LDAP)
       * in order to perform an LDAP lookup to authenticate a user on logon
       */
      public class GenericJbossLoginModule extends UsernamePasswordLoginModule {
      
       private static Category log = org.apache.log4j.Category.getInstance(GenericJbossLoginModule.class.getName() );
       private transient SimpleGroup userRoles = new SimpleGroup("Roles");
       /**
       * Default constructor
       */
       public GenericJbossLoginModule()
       {
      
       }
       //@Override
       protected String getUsersPassword() throws LoginException {
       // TODO Auto-generated method stub
       return "";
       }
       //@Override
       protected Group[] getRoleSets() throws LoginException {
       // TODO Auto-generated method stub
       userRoles.addMember(new SimplePrincipal("immuser"));
       Group[] roleSets = {userRoles};
       log.info("list of roles: "+roleSets);
       return roleSets;
       }
      
       //@Override
       protected boolean validatePassword(String inputPassword,
       String expectedPassword) {
       // TODO Auto-generated method stub
       Connection conn = null;
       Statement stmt = null;
       boolean authenticationSuccessful = false;
       String username = getUsername();
       try{
       Context ctx = new InitialContext();
       javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("java:/immPool");
       conn = ds.getConnection();
       authenticationSuccessful = true;
       }catch(SQLException ex){
       authenticationSuccessful = false;
       }catch(Exception e){
       System.out.println(e);
       }
       return authenticationSuccessful;
       }
      
      
      
      
      
      
      }
      
      


      The login-config entry is:
      <application-policy name="imm_security">
       <authentication>
       <login-module code="org.jboss.security.ClientLoginModule" flag="required"/>
       <login-module code="com.bn.merch.imm.jboss.GenericJbossLoginModule" flag="required"/>
       </authentication>
      </application-policy>
      


      I'm not sure what is causing this error. I would appreciate if I can get some help from experts out here. Let me know if you need more information. Thank you for your help.