Using class-name with the implementation worked, but it turns out that
isn't what I needed. I am going to take a step back and try to describe
what I am trying to do.
I have a resource adapter packaged in a .rar file that includes the JCA
implementation .jar and a ra.xml in the META-INF folder. It appears to
be deploying to TomEE successfully. It makes two Resources available -
one for the <connector id="Connector_ID"> root element and one for the
<resourceadapter> using the <resourceadapter id="ra-id"> tag. These
resources are currently *not* defined in the tomee.xml file.
I need to configure two additional properties outside of the ra.xml as
they are specific to the server that the resource adapter is deployed
to. In Glassfish they are defined as properties on the
<connector-connection-pool> tag. JBoss defines them in a ra-name-ds.xml
file. These properties are configuring a
javax.resource.spi.ManagedConnectionFactory implementation.
In addition, I need to make the javax.resource.cci.ConnectionFactory
implementation class defined in the ra.xml available via a JNDI name.
Glassfish defines this a a <connector-resource> element that references
the <connector-connection-pool> element above. JBoss defines this
information in the ra-name-ds.xml file.
In my previous attempt, I configured the additional properties using a
<Resource class-name="ManagedConnectionFactory impl"> and made that
available via JNDI. It turned out that I did not need that
implementation but instead I need the javax.resource.cci.ConnectionFactory.
Thanks,
Mike Spencer
On 07/17/2015 04:00 PM, Romain Manni-Bucau wrote:
2015-07-17 12:48 GMT-07:00 Mike Spencer <[email protected]>:
Hi Romain,
Using class-name allowed it to get past the 'Cannot determine a provider'
message, but now I am encountering a new error.
This error occurs when using <Resource id="ra-jrac"
class-name"javax.resource.cci.ConnectionFactory"></Resource> in tomee.xml:
class-name should use the actual implementation - it means you instantiate
yourself the class by this definition, also means the jar in the rar needs
to be added in tomee/lib
SEVERE: FATAL ERROR: Unknown error in Assembler. Please send the
following stack trace and this message to [email protected] :
org.apache.xbean.recipe.ConstructionException: Class is an interface:
javax.resource.cci.ConnectionFactory
When I try to use the concrete implementation
(class-name="com.unisys.coms.connector.COMSManagedConnectionFactory") I get
the following error:
SEVERE: FATAL ERROR: Unknown error in Assembler. Please send the
following stack trace and this message to [email protected] :
org.apache.xbean.recipe.ConstructionException: Type class could not be
found: com.unisys.coms.connector.COMSConnectionFactory
The resource adapter I am deploying contains that class. The log says that
the .rar is loaded before this error occurs. What could be the reason that
the Resource definition can't find the class?
Thanks,
Mike
On 07/17/2015 02:04 PM, Romain Manni-Bucau wrote:
Hi
Using class-name in Resource declaration should make it.
That said <ra name as logged>.<property> =<value> in
conf/system.properties
should work IIRC.
Le 17 juil. 2015 20:32, "Mike Spencer" <[email protected]> a
écrit :
Hi all,
I am trying to migrate an application using a resource adapter in a .rar
file from Glassfish to TomEE. The resource adapter needs to be deployed
globally (so multiple application can access it) and make the
javax.resource.cci.ConnectionFactory implementation available via JNDI.
I believe I have deployed the resource adapter to TomEE by adding the
line
<Deployments dir="apps" /> in the tomee.xml file. I see the following
lines
in the logs afterwards, so I am assuming the .rar is detected and made
available.
INFO: Configuring enterprise application:
/opt/apps/tomee-plume-1.7.1/apps/jrac-tweb.rar
Jul 17, 2015 1:18:08 PM
org.apache.openejb.config.OutputGeneratedDescriptors writeRaXml
INFO: Dumping Generated ra.xml to:
/opt/apps/tomee-plume-1.7.1/temp/ra-6993024062304172339Connector_ID.xml
Jul 17, 2015 1:18:08 PM org.apache.openejb.config.ConfigurationFactory
configureService
INFO: Configuring Service(id=ra-jrac, type=Resource, provider-id=ra-jrac)
Jul 17, 2015 1:18:08 PM org.apache.openejb.config.ConfigurationFactory
configureService
INFO: Configuring Service(id=Connector_ID, type=Resource,
provider-id=Connector_ID)
Jul 17, 2015 1:18:08 PM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application
"/opt/apps/tomee-plume-1.7.1/apps/jrac-tweb.rar" loaded.
However, I cannot figure out how to configure properties on the resource
adapter. I need to specify some configuration properties (username,
password, etc). In Glassfish, I have the connector-connection-pool and
connector-resource elements in the domain.xml where I can configure this
information and set up a JNDI name for the connector.
I tried to add a <Resource> block to the tomee.xml file, but it fails
with
the following message:
SEVERE: Failed Configuring Service(id=ra-jrac)
org.apache.openejb.config.NoSuchProviderException: Cannot determine a
provider for Resource(id=ra-jrac,
type=javax.resource.cci.ConnectionFactory, provider=null).
Possible valid configurations might be:
<Resource id="ra-jrac" type="DataSource"/>
<Resource id="ra-jrac" type="javax.sql.DataSource"/>
<Resource id="ra-jrac" type="ActiveMQResourceAdapter"/>
<Resource id="ra-jrac" type="javax.jms.QueueConnectionFactory"/>
<Resource id="ra-jrac" type="TopicConnectionFactory"/>
<Resource id="ra-jrac" type="javax.jms.ConnectionFactory"/>
<Resource id="ra-jrac" type="javax.jms.TopicConnectionFactory"/>
<Resource id="ra-jrac" type="QueueConnectionFactory"/>
<Resource id="ra-jrac" type="javax.jms.Destination"/>
<Resource id="ra-jrac" type="javax.jms.Queue"/>
<Resource id="ra-jrac" type="Queue"/>
<Resource id="ra-jrac" type="javax.jms.Topic"/>
<Resource id="ra-jrac" type="Topic"/>
<Resource id="ra-jrac" type="ORB"/>
<Resource id="ra-jrac" type="org.omg.CORBA.ORB"/>
<Resource id="ra-jrac" type="javax.mail.Session"/>
<Resource id="ra-jrac"
type="javax.enterprise.concurrent.ManagedExecutorService"/>
<Resource id="ra-jrac" type="ManagedExecutorService"/>
<Resource id="ra-jrac" type="ManagedScheduledExecutorService"/>
<Resource id="ra-jrac"
type="javax.enterprise.concurrent.ManagedScheduledExecutorService"/>
<Resource id="ra-jrac"
type="javax.enterprise.concurrent.ManagedThreadFactory"/>
<Resource id="ra-jrac" type="ManagedThreadFactory"/>
<Resource id="ra-jrac" type="ContextService"/>
<Resource id="ra-jrac"
type="javax.enterprise.concurrent.ContextService"/>
at
org.apache.openejb.config.ConfigurationFactory.configureService(ConfigurationFactory.java:1092)
at
org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:484)
...
I have also tried setting up a <Resource> in the context.xml file in the
same way that I have database connections configured, hoping that would
let
me access the ConnectionFactory via JNDI, but my application fails to
find
the JNDI name.
<Resource id="ra-jrac"
name="foo/bar/baz"
auth="Container"
type="javax.resource.cci.ConnectionFactory"
username="USERNAME"
password="PASSWORD" />
I am using TomEE-plume 1.7.1. It would be greatly appreciated if anyone
can point me in the correct direction to get this configured.
Thanks,
Mike