2 Replies Latest reply on Jan 6, 2003 4:40 AM by mikezzz

    ClassCastException when deploying *.service file.

      Hi,

      I am build a customer Resource Adapter. I have built the rar and deployed it OK. However when I deploy the associated service file I get a ClassCastException (below). The class it mentions however is the Impl class that I want to be retrieved and contains the getConnection() method that I would use to access the resource. I have included the ra.xml and lcm-service.xml files at the end of the as well as the createConnectionFactory() method. I know I am probably missing something simple.

      Thanks,
      Mike.

      2003-01-03 16:12:17,765 DEBUG [uk.co.singlepoint4u.lcm.ra.LCMManagedConnectionFactory] Create LCMContextFactory with info: host = 194.62.239.232, port = 753, view swith = 0, clerk = vss2admin
      2003-01-03 16:12:17,781 DEBUG [uk.co.singlepoint4u.lcm.ra.LCMManagedConnectionFactory.LCMAdapter] Binding object 'uk.co.singlepoint4u.lcm.ra.LCMContextFactoryImpl@690943' into JNDI at 'java:/LCMAdapter'
      2003-01-03 16:12:17,781 ERROR [org.jboss.resource.connectionmanager.NoTxConnectionManager] Starting failed
      java.lang.ClassCastException: uk.co.singlepoint4u.lcm.ra.LCMContextFactoryImpl
      at org.jboss.resource.connectionmanager.RARDeployment.startManagedConnectionFactory(RARDeployment.java:585)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.startService(BaseConnectionManager2.java:382)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:164)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)

      ... Lines omitted.



      <display-name>Vodafone LCM Adapter</display-name>
      <vendor-name>Singlepoint Solutions</vendor-name>
      <spec-version>1.0</spec-version>
      <eis-type>Vodafone Custom API</eis-type>
      1.0

      <managedconnectionfactory-class>uk.co.singlepoint4u.lcm.ra.LCMManagedConnectionFactory</managedconnectionfactory-class>
      <connectionfactory-interface>uk.co.singlepoint4u.lcm.ra.LCMContextFactory</connectionfactory-interface>
      <connectionfactory-impl-class>uk.co.singlepoint4u.lcm.ra.LCMContextFactoryImpl</connectionfactory-impl-class>
      <connection-interface>uk.co.singlepoint4u.lcm.ra.LCMContext</connection-interface>
      <connection-impl-class>uk.co.singlepoint4u.lcm.ra.LCMContextImpl</connection-impl-class>
      <transaction-support>NoTransaction</transaction-support>

      <config-property>
      <config-property-name>Hostname</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>XXX</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>Port</config-property-name>
      <config-property-type>java.lang.Short</config-property-type>
      <config-property-value>0</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>ViewSwitch</config-property-name>
      <config-property-type>java.lang.Short</config-property-type>
      <config-property-value>0</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>Clerk</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>XXX</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>Pass</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>XXX</config-property-value>
      </config-property>
      <!-- <authentication-mechanism> -->
      <reauthentication-support>false</reauthentication-support>
      <!-- </security-permission> -->
      <!--
      <authentication-mechanism>
      <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
      <credential-interface>javax.resource.security.PasswordCredential</credential-interface>
      </authentication-mechanism>


      <security-permission>
      Read/Write access is required to the contents of
      the FileSystemRootDir
      <security-permission-spec>permission java.io.FilePermission
      "/tmp/db/fs_store/*", "read,write";</security-permission-spec>
      </security-permission>
      -->






      jboss.jca:service=RARDeployer
      <depends optional-attribute-name="ManagedConnectionFactoryName">

      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Vodafone LCM Adapter



      <config-property>
      <config-property-name>Hostname</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>XXX</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>Port</config-property-name>
      <config-property-type>java.lang.Short</config-property-type>
      <config-property-value>0</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>ViewSwitch</config-property-name>
      <config-property-type>java.lang.Short</config-property-type>
      <config-property-value>0</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>Clerk</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>XXX</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>Pass</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>XXX</config-property-value>
      </config-property>


      LCMAdapter



      <depends optional-attribute-name="ManagedConnectionPool">

      0
      10
      30000
      15
      ByContainer


      <depends optional-attribute-name="CachedConnectionManager">
      jboss.jca:service=CachedConnectionManager

      <depends optional-attribute-name="JaasSecurityManagerService">
      jboss.security:service=JaasSecurityManager




      /**
      * @see javax.resource.spi.ManagedConnectionFactory#createConnectionFactory(ConnectionManager)
      */
      public Object createConnectionFactory(ConnectionManager cm)
      throws ResourceException {

      LCMRequestInfo lcmri = createLCMRequestInfo();
      log.debug("Create LCMContextFactory with info: " + lcmri);
      return new LCMContextFactoryImpl(cm, this, lcmri);
      }

        • 1. Re: ClassCastException when deploying *.service file.
          deegs_ca

          The obvious thing which you've most definitely checked is that you are returning an implementation javax.resource.cci.ConnectionFactory.

          Aside from that , under what conditions are you obtaining the class cast exception? I think you might get it during hot deploying the adapter.

          i.e. you
          1. start the server
          2. deploy .rar - no problem
          3. deploy ***-service.xml no problem
          4. identify problem in code
          5. fix, recompile, deploy .rar no problem
          6. deploy **.service - class cast exception

          I suspect this has to do with the jca-service/RarDeployer still having the old definition of your class in memory rather than loading it from scratch.

          • 2. Re: ClassCastException when deploying *.service file.

            Thanks for your help.

            I had implemented javax.naming.Referencable not javax.resource.Referenable. Knew it was something simple that I have missed.

            Regards,
            Mike.