glassfish
  1. glassfish
  2. GLASSFISH-3772

Support JCA Connection Pools without "eis" in the name

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 9.1peur1
    • Fix Version/s: 9.1.1_dev
    • Component/s: jca
    • Labels:
      None
    • Environment:

      Operating System: Solaris
      Platform: Sun

    • Issuezilla Id:
      3,772

      Description

      This issue is being raised, after the discussion at
      http://forums.java.net/jive/thread.jspa?threadID=31643&tstart=0

      I have a ResourceAdapter implementation that supports inbound and outbound
      communication with an EIS. This ResourceAdapter holds a reference to the
      BootstrapContext instance passed to it via the start method. The adapter has
      been installed in the Glassfish v2 environment, and a Connection Pool of
      outbound adapters have been created.

      An EJB application is deployed that attempts to use the ConnectionPool.
      ResourceInjection was used to define a private variable of type
      javax.resource.cci.ConnectionFactory, and the name of the resource exception was
      "MySvConnector". Note that there is no "/eis/" in the name of the resource
      reference. The Reference was correctly associated with the pool.

      When the session bean is created, I get an error:

      [#|2007-10-08T14:23:57.493+1000|SEVERE|sun-appserver9.1|javax.enterprise.system.core.naming|_ThreadID=24;_ThreadName=httpSSLWorkerThread-16000-0;_RequestID=25c92212-20d3-4450-aa60-ad4574d75c29;|NAM0002:
      Exception in NamingManagerImpl copyMutableObject().
      java.io.NotSerializableException:
      com.sun.enterprise.connectors.inflow.ConnectorMessageBeanClient
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
      at java.util.HashMap.writeObject(HashMap.java:1038)
      at sun.reflect.GeneratedMethodAccessor342.invoke(Unknown Source)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
      at com.sun.enterprise.naming.NamingUtils.makeCopyOfObject(NamingUtils.java:64)
      at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:842)
      at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
      at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:337)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at
      com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287)
      at
      com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
      at
      com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:127)
      at
      com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:533)
      at
      com.sun.ejb.containers.StatelessSessionContainer.access$100(StatelessSessionContainer.java:111)
      at
      com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:772)
      at
      com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:199)
      at
      com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:486)
      at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:1675)
      at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1229)
      at
      com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:202)
      at
      com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:77)
      at $Proxy120.runMethod(Unknown Source)
      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
      com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:233)
      at
      com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
      at
      com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
      at
      com.intecbilling.connectorDemo.session._MySessionRemote_Remote_DynamicStub.runMethod(com/intecbilling/connectorDemo/session/_MySessionRemote_Remote_DynamicStub.java)
      at
      com.intecbilling.connectorDemo.session._MySessionRemote_Wrapper.runMethod(com/intecbilling/connectorDemo/session/_MySessionRemote_Wrapper.java)
      at svconnectordemoweb.Page1.button1_action(Page1.java:224)
      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 com.sun.el.parser.AstValue.invoke(AstValue.java:187)
      at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
      at
      javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
      at
      com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
      at
      com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:69)
      at javax.faces.component.UICommand.broadcast(UICommand.java:383)
      at com.sun.webui.jsf.component.WebuiCommand.broadcast(WebuiCommand.java:160)
      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
      at
      com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      at
      com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.execute(PartialTraversalLifecycle.java:80)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      at
      org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
      at
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
      at
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
      at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:267)
      at
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
      at
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
      at
      org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
      at
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
      at
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
      at
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
      at
      org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
      at
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
      at
      com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
      at
      com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
      at
      com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
      at
      com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
      at
      com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
      at
      com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
      at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
      at
      com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

      #]

      When I look at the bindObjects() method in the NamingManagerImplementation,
      there is the following code:

      //IMPORTANT!!! this needs to be before the test for JDBC as
      //a connector could have a type of javax.sql.DataSource
      //else if (next.isResourceConnectionFactory()) {
      else if (isConnector(logicalJndiName))

      { obj = new J2EEEnvWrapper(resJndi, J2EEEnvWrapper.RESOURCE_ADAPTER_REF); }

      where the isConnector function simply checks the name of the reference for "eis".

      So, if I rename the reference to "eis/MySVConnector", it works. But this naming
      standard is not clearly documented anywhere. I couldn't find it in the
      documents linked from the Glassfish site.

      Because the NamingManager doesn't know the object is a Connector, it defines it
      as a Mutable object. Later on in the process, it serializes the object when it
      makes a copy. And the Exception is thrown because the BootstrapContext
      (referenced by the ResourceAdapter, which is referenced by the
      ManagedConnectionFactory, which is referenced by the ConnectionFactory) is not
      Serializable.

      There are two options: one preferred by me and the other suggested by Siva in
      the discussion thread.

      1) I'd think that the best option, for this case, is to change the code in the
      bindObjects() method to better support ConnectionFactory object. So, change

      //IMPORTANT!!! this needs to be before the test for JDBC as
      //a connector could have a type of javax.sql.DataSource
      //else if (next.isResourceConnectionFactory()) {
      else if (isConnector(logicalJndiName)) { obj = new J2EEEnvWrapper(resJndi, J2EEEnvWrapper.RESOURCE_ADAPTER_REF); }

      to

      //IMPORTANT!!! this needs to be before the test for JDBC as
      //a connector could have a type of javax.sql.DataSource
      else if (next.isResourceConnectionFactory() ||
      isConnector(logicalJndiName))

      { obj = new J2EEEnvWrapper(resJndi, J2EEEnvWrapper.RESOURCE_ADAPTER_REF); }

      With this change, the correct Wrapper is used, so the container knows with what
      it is working. And, in this case, it won't try to make a copy of the
      ConnectionFactory.

      2) Siva suggested that the BootstrapContext implementation could be made
      Serializable in order to support this. I'm not very familiar with this code, so
      I don't know how much work it would be to do this.

        Activity

        Hide
        gfbugbridge added a comment -

        <BT6616690>

        Show
        gfbugbridge added a comment - <BT6616690>
        Hide
        Sivakumar Thyagarajan added a comment -

        Thanks for filing this issue. We would love to fix the BootStrapContext and
        WorkManager implementations to be Serializable to enable the "outbound CF
        instances to use WorkManager" usecase as well, as described in the forum thread.

        Transferring to Jagadish to investigate and fix.

        Show
        Sivakumar Thyagarajan added a comment - Thanks for filing this issue. We would love to fix the BootStrapContext and WorkManager implementations to be Serializable to enable the "outbound CF instances to use WorkManager" usecase as well, as described in the forum thread. Transferring to Jagadish to investigate and fix.
        Hide
        Jagadish added a comment -

        re-targeted for V3.

        Workaround can be to use "eis/RESOURCE_NAME" which will avoid the NamingManager
        issue.

        Show
        Jagadish added a comment - re-targeted for V3. Workaround can be to use "eis/RESOURCE_NAME" which will avoid the NamingManager issue.
        Hide
        Jagadish added a comment -

        re-targeted for V3

        Show
        Jagadish added a comment - re-targeted for V3
        Hide
        Jagadish added a comment -

        re-targeted for V3

        Show
        Jagadish added a comment - re-targeted for V3
        Hide
        Jagadish added a comment -

        Fix will ensure that BootstrapContext, XATerminator, WorkManager implementations
        of app.server are safe (Serializable).

        Checking in ActiveInboundResourceAdapter.java;
        /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/ActiveInboundResourceAdapter.java,v
        <-- ActiveInboundResourceAdapter.java
        new revision: 1.18.6.1; previous revision: 1.18
        done
        Checking in BootstrapContextImpl.java;
        /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/BootstrapContextImpl.java,v
        <-- BootstrapContextImpl.java
        new revision: 1.5.6.1; previous revision: 1.5
        done
        Checking in ConnectorRegistry.java;
        /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/ConnectorRegistry.java,v
        <-- ConnectorRegistry.java
        new revision: 1.7.6.1; previous revision: 1.7
        done
        Checking in ConnectorRuntime.java;
        /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/ConnectorRuntime.java,v
        <-- ConnectorRuntime.java
        new revision: 1.19.2.2; previous revision: 1.19.2.1
        done
        Checking in work/WorkManagerFactory.java;
        /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/work/WorkManagerFactory.java,v
        <-- WorkManagerFactory.java
        new revision: 1.6.6.1; previous revision: 1.6
        done
        RCS file:
        /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/Attic/XATerminatorProxy.java,v
        done
        Checking in XATerminatorProxy.java;
        /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/Attic/XATerminatorProxy.java,v
        <-- XATerminatorProxy.java
        new revision: 1.1.2.1; previous revision: 1.1
        done
        RCS file:
        /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/work/Attic/WorkManagerProxy.java,v
        done
        Checking in work/WorkManagerProxy.java;
        /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/work/Attic/WorkManagerProxy.java,v
        <-- WorkManagerProxy.java
        new revision: 1.1.2.1; previous revision: 1.1
        done

        Show
        Jagadish added a comment - Fix will ensure that BootstrapContext, XATerminator, WorkManager implementations of app.server are safe (Serializable). Checking in ActiveInboundResourceAdapter.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/ActiveInboundResourceAdapter.java,v <-- ActiveInboundResourceAdapter.java new revision: 1.18.6.1; previous revision: 1.18 done Checking in BootstrapContextImpl.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/BootstrapContextImpl.java,v <-- BootstrapContextImpl.java new revision: 1.5.6.1; previous revision: 1.5 done Checking in ConnectorRegistry.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/ConnectorRegistry.java,v <-- ConnectorRegistry.java new revision: 1.7.6.1; previous revision: 1.7 done Checking in ConnectorRuntime.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/ConnectorRuntime.java,v <-- ConnectorRuntime.java new revision: 1.19.2.2; previous revision: 1.19.2.1 done Checking in work/WorkManagerFactory.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/work/WorkManagerFactory.java,v <-- WorkManagerFactory.java new revision: 1.6.6.1; previous revision: 1.6 done RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/Attic/XATerminatorProxy.java,v done Checking in XATerminatorProxy.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/Attic/XATerminatorProxy.java,v <-- XATerminatorProxy.java new revision: 1.1.2.1; previous revision: 1.1 done RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/work/Attic/WorkManagerProxy.java,v done Checking in work/WorkManagerProxy.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/work/Attic/WorkManagerProxy.java,v <-- WorkManagerProxy.java new revision: 1.1.2.1; previous revision: 1.1 done
        Hide
        Jagadish added a comment -

        dev.test is available at
        glassfish/appserv-tests/devtests/connector/serializabletest/

        Show
        Jagadish added a comment - dev.test is available at glassfish/appserv-tests/devtests/connector/serializabletest/

          People

          • Assignee:
            Jagadish
            Reporter:
            hildo
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: