12 Replies Latest reply on Oct 16, 2002 9:40 PM by Adam Hamel

    Class Cast exception with prim-key-class

    Adam Hamel Newbie

      Help!!

      I have wasted many hours on this one, and could use someone's help.

      I am using JBoss 3.0, trying to run Entity beans with SQL Server 7.0

      In my ejbLoad() method I am attempting to use EntityContext.getPrimaryKey(), which I would imagine would be my ejb-jar.xml setting as follows <prim-key-class>com.hameldesigns.keeptrack.ejb.entity.user.UserPK</prim-key-class>

      Instead I get a lovely ClassCast Exception, as JBoss thinks this needs to be a string

      UserPK pk = (UserPK)entityContext.getPrimaryKey();

      Is there any other configurations besides the xml file, in order to tell JBoss to use the UserPK file. I am using Bean Managed Persistence.

      Adam

        • 1. Re: Class Cast exception with prim-key-class
          Juha Lindfors Master

          what do you return from ejbCreate()? what is in the INSERT clause of your ejbCreate()? what is in your database columns? what does the db CREATE TABLE look like?


          • 2. Re: Class Cast exception with prim-key-class
            Adam Hamel Newbie

            public UserPK ejbCreate(String name, String password, String userdispname, String email) throws RemoteException, CreateException, KeeptrackException {

            System.out.println("ejbCreate(), name=" + name);
            UserVO newUser = null;
            UserPK pk = null;
            try {
            UserDAO dao = (UserDAO)PersistenceFactory.getInstance().getDAO("UserDAO");
            BigDecimal newKey = dao.dbGetKey();
            pk = new UserPK();
            pk.userid = newKey;
            newUser = new UserVO(newKey, name, userdispname, password, email);
            dao.dbInsertUser(newUser);
            } catch (Exception ex) {
            throw new KeeptrackException("UserBean.ejbCreate(): ", ex, KeeptrackException.EJB_CREATE);
            }

            // initialize persistent data
            this.userData = newUser;
            dirty = false;
            return pk;
            }

            Database Table
            USERID NUMBER PRECISION 18
            USERNAME VARCHAR 32
            USERDISPNAME VARCHAR 32
            EMAIL VARCHAR 32
            PASSWORD VARCHAR 32

            public void dbInsertUser(UserVO newData)
            throws KeeptrackException {

            String insertStatement =
            "insert into Users values " +
            "( ? , ? , ? , ?, ? )";
            PreparedStatement prepStmt = null;
            try {
            con = EJBUtil.getConnection();
            prepStmt = con.prepareStatement(insertStatement);

            prepStmt.setBigDecimal(1, newData.getUserID());
            prepStmt.setString(2, newData.getUserName());
            prepStmt.setString(3, newData.getUserDispName());
            prepStmt.setString(4, newData.getUserPassword());
            prepStmt.setString(5, newData.getEmail());

            prepStmt.executeUpdate();
            } catch (SQLException ex) {
            throw new KeeptrackException(ex, KeeptrackException.ENTITY_BEAN_ACCESS);
            } finally {
            closeStatement(prepStmt);
            disConnect();
            }

            • 3. Re: Class Cast exception with prim-key-class
              Adam Hamel Newbie

              public class EJBUtil {

              public EJBUtil() {}

              public static Connection getConnection() throws KeeptrackException{
              LogH.log(LogH.DEBUG, "CREATING A DB Connection from SCRATCH, NON-POOLED............");
              Connection conn = null;
              try{
              Class.forName(System.getProperty("dbDriverClass"));
              conn = DriverManager.getConnection(System.getProperty("dbConnectionString"));
              }catch(Exception e){
              throw new KeeptrackException(e, KeeptrackException.ENTITY_BEAN_ACCESS);
              }
              return conn;
              }
              }



              persistenceImpl=mssql
              dbDriverClass=net.avenir.jdbc2.Driver
              dbConnectionString=jdbc:AvenirDriver://home.hameldesigns.com:9999/keeptrack;uid=adam;pwd=xxxxx

              • 4. Re: Class Cast exception with prim-key-class
                Adam Hamel Newbie

                public void ejbLoad() throws RemoteException {
                System.out.println("ejbLoad()");
                try {
                UserDAO dao = (UserDAO)PersistenceFactory.getInstance().getDAO("UserDAO");
                // Get the primary key from the context
                // and refresh persistent data from database
                UserPK pk = (UserPK)entityContext.getPrimaryKey();
                this.userData = dao.dbLoadUser(pk);
                dirty = false;
                } catch (Exception ex) {
                throw new RemoteException("UserBean.ejbLoad(): ", ex);
                }
                }

                • 5. Re: Class Cast exception with prim-key-class
                  Adam Hamel Newbie

                  <?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>
                  <display-name>UserJAR</display-name>
                  <enterprise-beans>

                  <display-name>UserSessionBean</display-name>
                  <ejb-name>UserSessionBean</ejb-name>
                  com.hameldesigns.keeptrack.ejb.session.user.UserSessionHome
                  com.hameldesigns.keeptrack.ejb.session.user.UserSession
                  <ejb-class>com.hameldesigns.keeptrack.ejb.session.user.UserSessionBean</ejb-class>
                  <session-type>Stateless</session-type>
                  <transaction-type>Container</transaction-type>
                  <ejb-local-ref>
                  <ejb-ref-name>ejb/User</ejb-ref-name>
                  <ejb-ref-type>Entity</ejb-ref-type>
                  <local-home>com.hameldesigns.keeptrack.ejb.entity.user.UserLocalHome</local-home>
                  com.hameldesigns.keeptrack.ejb.entity.user.UserLocal
                  <ejb-link>UserBean</ejb-link>
                  </ejb-local-ref>
                  <security-identity>

                  <use-caller-identity/>
                  </security-identity>


                  <display-name>UserBean</display-name>
                  <ejb-name>UserBean</ejb-name>
                  com.hameldesigns.keeptrack.ejb.entity.user.UserHome
                  com.hameldesigns.keeptrack.ejb.entity.user.User
                  <local-home>com.hameldesigns.keeptrack.ejb.entity.user.UserLocalHome</local-home>
                  com.hameldesigns.keeptrack.ejb.entity.user.UserLocal
                  <ejb-class>com.hameldesigns.keeptrack.ejb.entity.user.UserBean</ejb-class>
                  <persistence-type>Bean</persistence-type>
                  <prim-key-class>com.hameldesigns.keeptrack.ejb.entity.user.UserPK</prim-key-class>
                  False
                  <security-identity>

                  <use-caller-identity/>
                  </security-identity>

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

                  <ejb-name>UserBean</ejb-name>
                  <method-intf>Remote</method-intf>
                  <method-name>*</method-name>
                  <method-params/>

                  <trans-attribute>Required</trans-attribute>
                  </container-transaction>
                  <container-transaction>

                  <ejb-name>UserSessionBean</ejb-name>
                  <method-intf>Remote</method-intf>
                  <method-name>*</method-name>
                  <method-params/>

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

                  • 6. Re: Class Cast exception with prim-key-class
                    Corby Page Newbie

                    Have you declared use of the 'Standard BMP EntityBean' configuration in your jboss.xml?

                    • 7. Re: Class Cast exception with prim-key-class
                      Adam Hamel Newbie

                      I am fairly new to JBoss, not sure if I have this configured correctly...


                      <container-configuration>
                      <container-name>Standard BMP EntityBean</container-name>
                      <call-logging>false</call-logging>
                      <container-invoker>org.jboss.proxy.ejb.ProxyFactory</container-invoker>
                      <container-interceptors>
                      org.jboss.ejb.plugins.LogInterceptor
                      org.jboss.ejb.plugins.SecurityInterceptor
                      org.jboss.ejb.plugins.TxInterceptorCMT
                      org.jboss.ejb.plugins.MetricsInterceptor
                      org.jboss.ejb.plugins.EntityCreationInterceptor
                      org.jboss.ejb.plugins.EntityLockInterceptor
                      org.jboss.ejb.plugins.EntityInstanceInterceptor
                      org.jboss.resource.connectionmanager.CachedConnectionInterceptor
                      org.jboss.ejb.plugins.EntitySynchronizationInterceptor
                      </container-interceptors>
                      <client-interceptors>

                      org.jboss.proxy.ejb.HomeInterceptor
                      org.jboss.proxy.SecurityInterceptor
                      org.jboss.proxy.TransactionInterceptor
                      org.jboss.invocation.InvokerInterceptor


                      org.jboss.proxy.ejb.EntityInterceptor
                      org.jboss.proxy.SecurityInterceptor
                      org.jboss.proxy.TransactionInterceptor
                      org.jboss.invocation.InvokerInterceptor

                      <list-entity>
                      org.jboss.proxy.ejb.ListEntityInterceptor
                      org.jboss.proxy.SecurityInterceptor
                      org.jboss.proxy.TransactionInterceptor
                      org.jboss.invocation.InvokerInterceptor
                      </list-entity>
                      </client-interceptors>
                      <instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>
                      <instance-cache>org.jboss.ejb.plugins.EntityInstanceCache</instance-cache>
                      <persistence-manager>org.jboss.ejb.plugins.BMPPersistenceManager</persistence-manager>
                      <transaction-manager>org.jboss.tm.TxManager</transaction-manager>
                      <locking-policy>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock</locking-policy>
                      <container-invoker-conf>
                      4444
                      True
                      </container-invoker-conf>
                      <container-cache-conf>
                      <cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy>
                      <cache-policy-conf>
                      <min-capacity>50</min-capacity>
                      <max-capacity>1000000</max-capacity>
                      <overager-period>300</overager-period>
                      <max-bean-age>600</max-bean-age>
                      <resizer-period>400</resizer-period>
                      <max-cache-miss-period>60</max-cache-miss-period>
                      <min-cache-miss-period>1</min-cache-miss-period>
                      <cache-load-factor>0.75</cache-load-factor>
                      </cache-policy-conf>
                      </container-cache-conf>
                      <container-pool-conf>
                      100
                      </container-pool-conf>
                      <commit-option>A</commit-option>
                      </container-configuration>

                      • 8. Re: Class Cast exception with prim-key-class
                        Adam Hamel Newbie

                        Here is part of my stack trace



                        11:46:10,396 ERROR [LogInterceptor] TransactionRolledbackException, causedBy:
                        java.rmi.RemoteException: UserBean.ejbLoad(): ; nested exception is:
                        java.lang.ClassCastException: java.lang.String
                        java.lang.ClassCastException: java.lang.String
                        at com.hameldesigns.keeptrack.ejb.entity.user.UserBean.ejbLoad(UserBean.
                        java:195)
                        at java.lang.reflect.Method.invoke(Native Method)
                        at org.jboss.ejb.plugins.BMPPersistenceManager.loadEntity(BMPPersistence
                        Manager.java:423)
                        at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.load
                        Entity(CachedConnectionInterceptor.java:353)
                        at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntityS
                        ynchronizationInterceptor.java:310)
                        at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
                        ke(CachedConnectionInterceptor.java:186)
                        at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstance
                        Interceptor.java:193)
                        at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockIntercep
                        tor.java:107)
                        at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreation
                        Interceptor.java:69)
                        at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
                        rceptor.java:96)
                        at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
                        torCMT.java:167)
                        at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:6
                        1)
                        at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
                        java:129)
                        at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
                        at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)
                        at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLoca
                        lContainerInvoker.java:296)
                        at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
                        at $Proxy27.getUserPassword(Unknown Source)
                        at com.hameldesigns.keeptrack.ejb.session.user.UserSessionBean.identifyU
                        ser(UserSessionBean.java:109)
                        at java.lang.reflect.Method.invoke(Native Method)
                        at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(S
                        tatelessSessionContainer.java:664)
                        at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
                        ke(CachedConnectionInterceptor.java:186)
                        at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Stat
                        elessSessionInstanceInterceptor.java:77)
                        at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
                        rceptor.java:96)
                        at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
                        torCMT.java:167)
                        at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:6
                        1)
                        at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
                        java:129)
                        at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
                        at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContai
                        ner.java:313)
                        at org.jboss.ejb.Container.invoke(Container.java:705)
                        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
                        at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
                        at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.jav
                        a:102)
                        at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.
                        java:73)
                        at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:7
                        6)
                        at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessi
                        onInterceptor.java:111)
                        at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
                        at $Proxy24.identifyUser(Unknown Source)
                        at com.hameldesigns.keeptrack.client.authentication.AuthenticationAction
                        .perform(AuthenticationAction.java:49)
                        at org.apache.struts.action.ActionServlet.processActionPerform(ActionSer
                        vlet.java:1787)
                        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:158
                        6)
                        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)

                        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
                        icationFilterChain.java:247)
                        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
                        ilterChain.java:193)
                        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
                        alve.java:243)
                        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
                        .java:566)
                        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
                        a:472)
                        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

                        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
                        alve.java:190)
                        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
                        .java:566)
                        at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve
                        .java:246)
                        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
                        .java:564)
                        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
                        a:472)
                        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

                        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
                        2343)
                        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
                        ava:180)
                        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
                        .java:566)
                        at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
                        rValve.java:170)
                        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
                        .java:564)
                        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
                        ava:170)
                        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
                        .java:564)
                        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
                        468)
                        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
                        .java:564)
                        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
                        a:472)
                        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

                        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
                        ve.java:174)
                        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
                        .java:566)
                        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
                        a:472)
                        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

                        at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
                        r.java:1012)
                        at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
                        va:1107)
                        at java.lang.Thread.run(Thread.java:498)
                        11:46:13,591 ERROR [STDERR] java.rmi.ServerException: UserBean.ejbLoad(): ; nest
                        ed exception is:
                        java.lang.ClassCastException: java.lang.String; nested exception is:
                        java.rmi.RemoteException: UserBean.ejbLoad(): ; nested exception is:
                        java.lang.ClassCastException: java.lang.String
                        Embedded Exception
                        UserBean.ejbLoad(): ; nested exception is:
                        java.lang.ClassCastException: java.lang.String; nested exception is:
                        java.rmi.RemoteException: UserBean.ejbLoad(): ; nested exception is:
                        java.lang.ClassCastException: java.lang.String; nested exception is:
                        javax.ejb.TransactionRolledbackLocalException: UserBean.ejbLoad(): ; nes
                        ted exception is:
                        java.lang.ClassCastException: java.lang.String; nested exception is:
                        java.rmi.RemoteException: UserBean.ejbLoad(): ; nested exception is:
                        java.lang.ClassCastException: java.lang.String
                        Embedded Exception
                        UserBean.ejbLoad(): ; nested exception is:
                        java.lang.ClassCastException: java.lang.String; nested exception is:
                        java.rmi.RemoteException: UserBean.ejbLoad(): ; nested exception is:
                        java.lang.ClassCastException: java.lang.String
                        11:46:27,251 ERROR [STDERR] javax.ejb.TransactionRolledbackLocalException: UserB
                        ean.ejbLoad(): ; nested exception is:
                        java.lang.ClassCastException: java.lang.String; nested exception is:
                        java.rmi.RemoteException: UserBean.ejbLoad(): ; nested exception is:
                        java.lang.ClassCastException: java.lang.String
                        Embedded Exception
                        UserBean.ejbLoad(): ; nested exception is:
                        java.lang.ClassCastException: java.lang.String; nested exception is:
                        java.rmi.RemoteException: UserBean.ejbLoad(): ; nested exception is:
                        java.lang.ClassCastException: java.lang.String
                        11:46:27,501 ERROR [STDERR] at java.lang.RuntimeException.(RuntimeExce
                        ption.java:49)
                        11:46:27,551 ERROR [STDERR] at javax.ejb.EJBException.(EJBException.ja
                        va:53)
                        11:46:27,591 ERROR [STDERR] at javax.ejb.TransactionRolledbackLocalException
                        .(TransactionRolledbackLocalException.java:41)
                        11:46:27,631 ERROR [STDERR] at org.jboss.ejb.plugins.local.BaseLocalContaine
                        rInvoker.invoke(BaseLocalContainerInvoker.java:313)
                        11:46:27,681 ERROR [STDERR] at org.jboss.ejb.plugins.local.EntityProxy.invok
                        e(EntityProxy.java:38)
                        11:46:27,721 ERROR [STDERR] at $Proxy27.getUserPassword(Unknown Source)
                        11:46:27,751 ERROR [STDERR] at com.hameldesigns.keeptrack.ejb.session.user.U
                        serSessionBean.identifyUser(UserSessionBean.java:109)
                        11:46:27,801 ERROR [STDERR] at java.lang.reflect.Method.invoke(Native Method
                        )
                        11:46:27,842 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$Conta
                        inerInterceptor.invoke(StatelessSessionContainer.java:664)
                        11:46:27,892 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedCo
                        nnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
                        11:46:27,942 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanc
                        eInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
                        11:46:27,992 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.i
                        nvokeNext(AbstractTxInterceptor.java:96)
                        11:46:28,042 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWit
                        hTransactions(TxInterceptorCMT.java:167)
                        11:46:28,082 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke
                        (TxInterceptorCMT.java:61)
                        11:46:28,142 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.inv
                        oke(SecurityInterceptor.java:129)
                        11:46:28,172 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(L
                        ogInterceptor.java:166)
                        11:46:28,212 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.invok
                        e(StatelessSessionContainer.java:313)

                        • 9. Re: Class Cast exception with prim-key-class
                          Corby Page Newbie

                          Hamela,

                          If the post above is from your jboss.xml, then I don't believe you are declaring use of the container correctly. If you want to use the default settings, declare the container as such (in your jboss.xml):

                          <container-configurations>
                          <container-configuration>
                          <container-name>Standard BMP EntityBean</container-name>
                          </container-configuration>
                          </container-configurations>

                          • 10. Re: Class Cast exception with prim-key-class
                            Adam Hamel Newbie

                            Here is my current entry in my standardjboss.xml
                            I am using Stateless Sesstion and Entity Beans



                            <?xml version = "1.0" encoding = "UTF-8"?>

                            <!-- ===================================================================== -->

                            <!-- -->

                            <!-- Standard JBoss Configuration -->

                            <!-- -->

                            <!-- ===================================================================== -->

                            <!-- $Id: standardjboss.xml,v 1.1 2002/10/08 00:24:13 administrator Exp $ -->

                            <enforce-ejb-restrictions>false</enforce-ejb-restrictions>
                            <container-configurations>

                            <container-configuration>
                            <container-name>Standard Stateless SessionBean</container-name>
                            <call-logging>false</call-logging>
                            <container-invoker>org.jboss.proxy.ejb.ProxyFactory</container-invoker>
                            <container-interceptors>
                            org.jboss.ejb.plugins.LogInterceptor
                            org.jboss.ejb.plugins.SecurityInterceptor
                            org.jboss.ejb.plugins.TxInterceptorCMT
                            org.jboss.ejb.plugins.MetricsInterceptor
                            org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor
                            org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor
                            org.jboss.ejb.plugins.TxInterceptorBMT
                            org.jboss.ejb.plugins.MetricsInterceptor org.jboss.resource.connectionmanager.CachedConnectionInterceptor
                            </container-interceptors>
                            <client-interceptors>

                            org.jboss.proxy.ejb.HomeInterceptor
                            org.jboss.proxy.SecurityInterceptor
                            org.jboss.proxy.TransactionInterceptor
                            org.jboss.invocation.InvokerInterceptor


                            org.jboss.proxy.ejb.StatelessSessionInterceptor
                            org.jboss.proxy.SecurityInterceptor
                            org.jboss.proxy.TransactionInterceptor
                            org.jboss.invocation.InvokerInterceptor

                            </client-interceptors>
                            <instance-pool>org.jboss.ejb.plugins.StatelessSessionInstancePool</instance-pool>
                            <instance-cache/>
                            <persistence-manager/>
                            <transaction-manager>org.jboss.tm.TxManager</transaction-manager>
                            <container-invoker-conf>
                            4444
                            True
                            </container-invoker-conf>
                            <container-pool-conf>
                            100
                            </container-pool-conf>
                            </container-configuration>
                            <container-configuration>
                            <container-name>Standard BMP EntityBean</container-name>
                            <call-logging>true</call-logging>
                            <container-invoker>org.jboss.proxy.ejb.ProxyFactory</container-invoker>
                            <container-interceptors>
                            org.jboss.ejb.plugins.LogInterceptor
                            org.jboss.ejb.plugins.SecurityInterceptor
                            org.jboss.ejb.plugins.TxInterceptorCMT
                            org.jboss.ejb.plugins.MetricsInterceptor
                            org.jboss.ejb.plugins.EntityCreationInterceptor
                            org.jboss.ejb.plugins.EntityLockInterceptor
                            org.jboss.ejb.plugins.EntityInstanceInterceptor
                            org.jboss.resource.connectionmanager.CachedConnectionInterceptor
                            org.jboss.ejb.plugins.EntitySynchronizationInterceptor
                            </container-interceptors>
                            <client-interceptors>

                            org.jboss.proxy.ejb.HomeInterceptor
                            org.jboss.proxy.SecurityInterceptor
                            org.jboss.proxy.TransactionInterceptor
                            org.jboss.invocation.InvokerInterceptor


                            org.jboss.proxy.ejb.EntityInterceptor
                            org.jboss.proxy.SecurityInterceptor
                            org.jboss.proxy.TransactionInterceptor
                            org.jboss.invocation.InvokerInterceptor

                            <list-entity>
                            org.jboss.proxy.ejb.ListEntityInterceptor
                            org.jboss.proxy.SecurityInterceptor
                            org.jboss.proxy.TransactionInterceptor
                            org.jboss.invocation.InvokerInterceptor
                            </list-entity>
                            </client-interceptors>
                            <instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>
                            <instance-cache>org.jboss.ejb.plugins.EntityInstanceCache</instance-cache>
                            <persistence-manager>org.jboss.ejb.plugins.BMPPersistenceManager</persistence-manager>
                            <transaction-manager>org.jboss.tm.TxManager</transaction-manager>
                            <locking-policy>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock</locking-policy>
                            <container-invoker-conf>
                            4444
                            True
                            </container-invoker-conf>
                            <container-cache-conf>
                            <cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy>
                            <cache-policy-conf>
                            <min-capacity>50</min-capacity>
                            <max-capacity>1000000</max-capacity>
                            <overager-period>300</overager-period>
                            <max-bean-age>600</max-bean-age>
                            <resizer-period>400</resizer-period>
                            <max-cache-miss-period>60</max-cache-miss-period>
                            <min-cache-miss-period>1</min-cache-miss-period>
                            <cache-load-factor>0.75</cache-load-factor>
                            </cache-policy-conf>
                            </container-cache-conf>
                            <container-pool-conf>
                            100
                            </container-pool-conf>
                            <commit-option>A</commit-option>
                            </container-configuration>
                            </container-configurations>

                            • 11. Re: Class Cast exception with prim-key-class
                              Adam Hamel Newbie

                              Here is my standardjoss.xml

                              <?xml version = "1.0" encoding = "UTF-8"?>

                              <!-- ===================================================================== -->

                              <!-- -->

                              <!-- Standard JBoss Configuration -->

                              <!-- -->

                              <!-- ===================================================================== -->

                              <!-- $Id: standardjboss.xml,v 1.1 2002/10/08 00:24:13 administrator Exp $ -->

                              <enforce-ejb-restrictions>false</enforce-ejb-restrictions>
                              <container-configurations>

                              <container-configuration>
                              <container-name>Standard Stateless SessionBean</container-name>
                              <call-logging>false</call-logging>
                              <container-invoker>org.jboss.proxy.ejb.ProxyFactory</container-invoker>
                              <container-interceptors>
                              org.jboss.ejb.plugins.LogInterceptor
                              org.jboss.ejb.plugins.SecurityInterceptor
                              org.jboss.ejb.plugins.TxInterceptorCMT
                              org.jboss.ejb.plugins.MetricsInterceptor
                              org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor
                              org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor
                              org.jboss.ejb.plugins.TxInterceptorBMT
                              org.jboss.ejb.plugins.MetricsInterceptor org.jboss.resource.connectionmanager.CachedConnectionInterceptor
                              </container-interceptors>
                              <client-interceptors>

                              org.jboss.proxy.ejb.HomeInterceptor
                              org.jboss.proxy.SecurityInterceptor
                              org.jboss.proxy.TransactionInterceptor
                              org.jboss.invocation.InvokerInterceptor


                              org.jboss.proxy.ejb.StatelessSessionInterceptor
                              org.jboss.proxy.SecurityInterceptor
                              org.jboss.proxy.TransactionInterceptor
                              org.jboss.invocation.InvokerInterceptor

                              </client-interceptors>
                              <instance-pool>org.jboss.ejb.plugins.StatelessSessionInstancePool</instance-pool>
                              <instance-cache/>
                              <persistence-manager/>
                              <transaction-manager>org.jboss.tm.TxManager</transaction-manager>
                              <container-invoker-conf>
                              4444
                              True
                              </container-invoker-conf>
                              <container-pool-conf>
                              100
                              </container-pool-conf>
                              </container-configuration>
                              <container-configuration>
                              <container-name>Standard BMP EntityBean</container-name>
                              <call-logging>true</call-logging>
                              <container-invoker>org.jboss.proxy.ejb.ProxyFactory</container-invoker>
                              <container-interceptors>
                              org.jboss.ejb.plugins.LogInterceptor
                              org.jboss.ejb.plugins.SecurityInterceptor
                              org.jboss.ejb.plugins.TxInterceptorCMT
                              org.jboss.ejb.plugins.MetricsInterceptor
                              org.jboss.ejb.plugins.EntityCreationInterceptor
                              org.jboss.ejb.plugins.EntityLockInterceptor
                              org.jboss.ejb.plugins.EntityInstanceInterceptor
                              org.jboss.resource.connectionmanager.CachedConnectionInterceptor
                              org.jboss.ejb.plugins.EntitySynchronizationInterceptor
                              </container-interceptors>
                              <client-interceptors>

                              org.jboss.proxy.ejb.HomeInterceptor
                              org.jboss.proxy.SecurityInterceptor
                              org.jboss.proxy.TransactionInterceptor
                              org.jboss.invocation.InvokerInterceptor


                              org.jboss.proxy.ejb.EntityInterceptor
                              org.jboss.proxy.SecurityInterceptor
                              org.jboss.proxy.TransactionInterceptor
                              org.jboss.invocation.InvokerInterceptor

                              <list-entity>
                              org.jboss.proxy.ejb.ListEntityInterceptor
                              org.jboss.proxy.SecurityInterceptor
                              org.jboss.proxy.TransactionInterceptor
                              org.jboss.invocation.InvokerInterceptor
                              </list-entity>
                              </client-interceptors>
                              <instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>
                              <instance-cache>org.jboss.ejb.plugins.EntityInstanceCache</instance-cache>
                              <persistence-manager>org.jboss.ejb.plugins.BMPPersistenceManager</persistence-manager>
                              <transaction-manager>org.jboss.tm.TxManager</transaction-manager>
                              <locking-policy>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock</locking-policy>
                              <container-invoker-conf>
                              4444
                              True
                              </container-invoker-conf>
                              <container-cache-conf>
                              <cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy>
                              <cache-policy-conf>
                              <min-capacity>50</min-capacity>
                              <max-capacity>1000000</max-capacity>
                              <overager-period>300</overager-period>
                              <max-bean-age>600</max-bean-age>
                              <resizer-period>400</resizer-period>
                              <max-cache-miss-period>60</max-cache-miss-period>
                              <min-cache-miss-period>1</min-cache-miss-period>
                              <cache-load-factor>0.75</cache-load-factor>
                              </cache-policy-conf>
                              </container-cache-conf>
                              <container-pool-conf>
                              100
                              </container-pool-conf>
                              <commit-option>A</commit-option>
                              </container-configuration>
                              </container-configurations>

                              • 12. Re: Class Cast exception with prim-key-class
                                Adam Hamel Newbie

                                Problem Solved. I was setting a String in my DAO class.


                                public Collection dbSelectByUserName(String name)
                                throws KeeptrackException {

                                LogH.log("dbSelectByUserName for " + name);

                                String selectStatement =
                                "select distinct UserID " +
                                "from Users where UserName = ? ";
                                PreparedStatement prepStmt = null;
                                ResultSet rs = null;
                                ArrayList a = null;
                                try {
                                con = EJBUtil.getConnection();
                                prepStmt =
                                con.prepareStatement(selectStatement);

                                prepStmt.setString(1, name);
                                rs = prepStmt.executeQuery();
                                a = new ArrayList();

                                while (rs.next()) {
                                a.add(new String(rs.getString(1)));
                                }

                                } catch (Exception ex) {
                                throw new KeeptrackException(ex, KeeptrackException.ENTITY_BEAN_ACCESS);

                                } finally {
                                closeResultSet(rs);
                                closeStatement(prepStmt);
                                disConnect();
                                }
                                return a;
                                }