2 Replies Latest reply on Jan 18, 2007 7:34 AM by Sami Männistö

    Problem with JCA Resource Adapter

    Sami Männistö Newbie

      Hi!
      I'm keep ketting this error when running my test application.
      I'm runnig this test on JBoss 4.0.5.GA-ejb3, java 1.5.0_09-b03 and Windows XP

      2007-01-18 12:17:28,763 ERROR [STDERR] javax.resource.ResourceException: Wrong ManagedConnectionFactory sent to allocateConnection!
      2007-01-18 12:17:28,903 ERROR [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:392)
      2007-01-18 12:17:28,903 ERROR [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
      2007-01-18 12:17:28,903 ERROR [STDERR] at fi.logiasoftware.jca.adapter.GenericConnectionFactoryImpl.getConnection(GenericConnectionFactoryImpl.java:43)
      2007-01-18 12:17:28,903 ERROR [STDERR] at fi.logiasoftware.jcatest.TestBean.doSomething(TestBean.java:69)
      2007-01-18 12:17:28,903 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2007-01-18 12:17:28,903 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      2007-01-18 12:17:28,903 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2007-01-18 12:17:28,903 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      2007-01-18 12:17:28,903 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      2007-01-18 12:17:28,903 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      2007-01-18 12:17:28,903 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      2007-01-18 12:17:28,903 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      2007-01-18 12:17:28,903 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
      2007-01-18 12:17:28,903 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      2007-01-18 12:17:28,903 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
      2007-01-18 12:17:28,919 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      2007-01-18 12:17:28,919 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
      2007-01-18 12:17:28,919 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
      2007-01-18 12:17:28,919 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      2007-01-18 12:17:28,919 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
      2007-01-18 12:17:28,919 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      2007-01-18 12:17:28,919 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
      2007-01-18 12:17:28,919 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      2007-01-18 12:17:28,919 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      2007-01-18 12:17:28,919 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
      2007-01-18 12:17:28,919 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      2007-01-18 12:17:28,919 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
      2007-01-18 12:17:28,919 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      2007-01-18 12:17:28,935 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      2007-01-18 12:17:28,935 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      2007-01-18 12:17:28,935 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:263)
      2007-01-18 12:17:28,935 ERROR [STDERR] at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
      2007-01-18 12:17:28,935 ERROR [STDERR] at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
      2007-01-18 12:17:28,935 ERROR [STDERR] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
      2007-01-18 12:17:28,935 ERROR [STDERR] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
      2007-01-18 12:17:28,935 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
      2007-01-18 12:17:28,935 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:398)
      2007-01-18 12:17:28,935 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
      


      My ConnectionFactory class is as follow.

      public class GenericConnectionFactoryImpl implements Serializable, GenericConnectionFactory {
      
       private static final long serialVersionUID = -1252438014002933877L;
       private final static Logger logger = Logger.getLogger(GenericConnectionFactoryImpl.class);
       private ConnectionManager connectionManager;
       private GenericManagedConnectionFactory mcf;
      
      
       public GenericConnectionFactoryImpl(GenericManagedConnectionFactory mcf, ConnectionManager connectionManager)
       {
       logger.warn("connectionManager : " + connectionManager.toString());
       logger.warn("mcf : " + mcf.getClass().getName());
       logger.warn("mcf : " + mcf.toString());
       this.mcf = mcf;
      
       this.connectionManager = connectionManager;
      
       }
      
      
       public GenericResource getConnection() throws ResourceException {
       logger.warn("GenericResource getConnection()");
       return null;
       }
      
       public GenericResource getConnection(GenericConnectionRequestInfo info) throws ResourceException {
       logger.warn("GenericResource getConnection(GenericConnectionRequestInfo)");
      
       logger.warn("mcf : " + mcf.getClass().getName());
       logger.warn("mcf : " + mcf.toString());
       logger.warn("cri : " + info.toString());
      
       Object o = connectionManager.allocateConnection(mcf, info);
      
      
       return (GenericResource) o;
      
       }
      
      }
      


      My TestBean is as follows

      @Stateless
      @LocalBinding(jndiBinding="TestLocal")
      @RemoteBinding(jndiBinding="Test")
      @Remote(Test.class)
      @Local(Test.class)
      public class TestBean implements Test {
      
       @Resource(mappedName = "java:/GRA")
       private GenericConnectionFactory gcf;
      
       private GenericConnectionRequestInfo getConnectionSpec() {
      
       GenericConnectionRequestInfo cri = new GenericConnectionRequestInfo();
      
       cri.putIntegerValue("id", 1);
       cri.putStringValue("username", "ksjfos");
       cri.putStringValue("password", "ksgiosj");
       cri.putIntegerValue("port", 21);
       cri.putIntegerValue("timeout", 20000);
       cri.putStringValue("hostname", "www.fi");
       cri.putStringValue("handlerclass", "FTPProtocolHandler");
       cri.putStringValue("transfertype", "BINARY");
       cri.putStringValue("connectmode", "ACTIVE");
       cri.putIntegerValue("as400", 0);
      
       return cri;
      
       }
       public void doSomething() {
      
       GenericConnectionRequestInfo cri = getConnectionSpec();
       GenericResource resource = null;
      
       try {
       System.out.println("TestBean.doSomething kutsuttu : jmo");
       System.out.println("gcf :" + gcf.toString());
      Fails here ----> resource = gcf.getConnection(cri);
       System.out.println("resource :" + resource.toString());
      
       System.out.println("1---------TestBean1 ID : 1 user : jmo : ---------------------------------------");
      
       AbstractProtocolHandler handler = resource.getHandler();
      
       } catch (ResourceException e) {
       e.printStackTrace();
       } finally {
       resource.close();
       }
       }
      }
      
      


      Any idea what's causing this?