[jboss-user] [JCA/JBoss] - Resource Adapter javax.naming.NamingException
pecks1976
do-not-reply at jboss.com
Fri Jan 4 12:18:10 EST 2008
Using JBoss 4.0.0, Java ee sdk 5.03.
I'm trying to write a resource adapter, with the intention of being able to call some native (C++) code from a EJB.
The EJB is in it's own project, and appears to be quite happy. I am using XDoclet, and so have included the following tags:
| * @ejb.resource-ref res-ref-name="eis/MySample"
| * res-type="com.riskaware.iwmdt.SampleConnectionFactory"
| * res-auth="Container"
| *
| * @jboss.resource-ref
| * res-ref-name="eis/MySample"
| * jndi-name="eis/ConnectorProj"
|
This sorts out the ejb-jar.xml and the jboss.xml files for this project:
ejb-jar.xml:
| <resource-ref id="ResRef_1">
| <res-ref-name>eis/MySample</res-ref-name>
| <res-type>com.riskaware.iwmdt.SampleConnectionFactory</res-type>
| <res-auth>Container</res-auth>
| </resource-ref>
|
jboss.xml:
| <resource-ref>
| <res-ref-name>eis/MySample</res-ref-name>
| <jndi-name>eis/ConnectorProj</jndi-name>
| </resource-ref>
|
Now, when the EJB tries to do a lookup:
| ctx = new InitialContext();
|
| ///////////////////////////////////////////////////////////
| NamingEnumeration ne = ctx.list("java:comp/env/eis");
| while(ne.hasMoreElements()){
| System.out.println(ne.nextElement());
| }
| ////////////////////////////////////////////////////////////
|
| ctx.lookup("java:/comp/env/eis/MySample");
|
I get the following:
16:06:24,685 INFO [STDOUT] MySample: javax.naming.LinkRef
16:06:24,685 INFO [STDOUT] javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: eis not bound]
16:06:24,685 INFO [STDOUT] at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:971)
16:06:24,685 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:614)
16:06:24,685 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:643)
16:06:24,685 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:508)
Now, in my resource adapter project, I have a ra.xml file that looks like this:
| <?xml version="1.0" encoding="UTF-8"?>
| <connector id="Connector_ID" version="1.5"
| xmlns="http://java.sun.com/xml/ns/j2ee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd">
| <description></description>
| <display-name>ConnectorProj</display-name>
| <vendor-name>RiskAware</vendor-name>
| <eis-type>GDF</eis-type>
| <resourceadapter-version>0.1</resourceadapter-version>
| <resourceadapter>
| <resourceadapter-class>
| com.riskaware.iwmdt.SampleResourceAdapter
| </resourceadapter-class>
| <outbound-resourceadapter>
| <connection-definition>
| <managedconnectionfactory-class>com.riskaware.iwmdt.SampleManagedConnectionFactory</managedconnectionfactory-class>
| <connectionfactory-interface>com.riskaware.iwmdt.SampleConnectionFactory</connectionfactory-interface>
| <connectionfactory-impl-class>com.riskaware.iwmdt.SampleConnectionFactory</connectionfactory-impl-class>
| <connection-interface>com.riskaware.iwmdt.SampleConnection</connection-interface>
| <connection-impl-class>com.riskaware.iwmdt.SampleConnection</connection-impl-class>
| </connection-definition><transaction-support>NoTransaction</transaction-support><reauthentication-support>false</reauthentication-support>
| </outbound-resourceadapter>
| </resourceadapter>
| </connector>
|
But, I don't have a .ds file. Do I need one of these to specify the jndi name for the RA? Or is there another problem here?
Thanks,
Pecks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117144#4117144
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117144
More information about the jboss-user
mailing list