[ 
https://issues.apache.org/activemq/browse/AMQ-765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40920
 ] 

Kai Hudalla commented on AMQ-765:
---------------------------------

I have tried to work around the problem described by Michal by simply declaring 
the factory property of ActiveMQConnectionFactory to not be transient. However, 
after running my test driver for accessing a ConnectionFactory managed by the 
ActiveMQ RA, I ran into the following problem:

Caused by: java.lang.RuntimeException: Cant copy Serializable object:
        at 
com.sun.enterprise.naming.NamingUtils.makeCopyOfObject(NamingUtils.java:82)
        at 
com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:842)
        at 
com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        ... 66 more
Caused by: java.io.NotSerializableException: 
com.sun.enterprise.connectors.BootstrapContextImpl
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
        at 
com.sun.enterprise.naming.NamingUtils.makeCopyOfObject(NamingUtils.java:64)
        ... 68 more


After having spent some time looking at the RA source code of version 5.0.0 my 
feeling is that the ActiveMQManagedConnectionFactory violates the 
javax.resource.spi.ManagedConnectionFactory contract because it is not 
Serializable.

 ActiveMQManagedConnectionFactory has a property of type 
org.apache.activemq.ra.MessageResourceAdapter which extends the 
javax.resource.spi.ResourceAdapter interface which itself does NOT extend 
Serializable, i.e. implementors are not required to be serializable. The 
ActiveMQResourceAdapter implementing the MessageResourceAdapter interface, 
however, claims to be serializable but does have a property of type 
javax.resource.spi.BootstrapContext. But BootstrapContext implementations are 
not required to be Serializable. In case of glassfish the passed in 
com.sun.enterprise.connectors.BootstrapContextImpl class is NOT serializable.

Therefore, declaring the factory property to NOT be transient is not working 
because ActiveMQManagedConnectionFactory is not serializable as mandated by the 
JCA spec.

Any thoughts?

Kai

> ActiveMQ RA serialization issue on Glassfish
> --------------------------------------------
>
>                 Key: AMQ-765
>                 URL: https://issues.apache.org/activemq/browse/AMQ-765
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Connector
>    Affects Versions: 4.0, 4.0.1
>         Environment: Glassfish
>            Reporter: Chris Conrad
>             Fix For: 5.2.0
>
>         Attachments: finest-log.txt, log.txt
>
>
> I've been trying to work through an issue with a NullPointerException run 
> using the JCA 1.5 resource adapter on Glassfish.  In the course of debugging, 
> Siva from the Glassfish team provided this information:
> "Thanks for trying out GlassFish. Since I have only the trace snippet above, 
> I tried to debug this problem by going through ActiveMQ RA's source available 
> at 
> https://svn.apache.org/repos/asf/incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/
> This is what I understand happens. Please correct me if there are errors. 
> When ActiveMQConnectionFactory 
> [https://svn.apache.org/repos/asf/incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionFactory.java]
>  is created at the createConnectionFactory method of 
> https://svn.apache.org/repos/asf/incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java,
>  the ConnectionManager is initialized to a *transient* variable "manager". 
> Since ConnectionFactory instances can be serialized/deserialized while 
> publishing to JNDI (as is the case in Project GlassFish), the 
> connectionManager reference is lost and hence the NPE. The fix ideally should 
> be in the ActiveMQRA's code. You could copy me [sivakumart AT sun DOT com] 
> while you are discussing this with ActiveMQ, if you wish. If you still have 
> any issues, please provide a copy of your domain.xml [connector connection 
> pool, resource configuratin information] and the entire trace in server.log." 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to