[jboss-user] [JCA] - Another injection issue
Jens Mander
do-not-reply at jboss.com
Tue Oct 19 09:11:25 EDT 2010
Jens Mander [http://community.jboss.org/people/JensMander] created the discussion
"Another injection issue"
To view the discussion, visit: http://community.jboss.org/message/567172#567172
--------------------------------------------------------------
Hi,
I'm trying to set up the "File System Adapter" like shown here http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch7.chapt.html http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch7.chapt.html
First I build the rar-archive and moved it to the deploy-folder together with the MBean descriptor (notxfs-ds.xml). So far so good. The admin console and the jmx-console showed me that the AS now knows an the connection-factoty
JMX (jboss.jca)
* http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss.jca%3Aservice%3DConnectionFactoryBinding%2Cname%3DNoTransFS name=NoTransFS,service=ConnectionFactoryBinding
* http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss.jca%3Aservice%3DManagedConnectionFactory%2Cname%3DNoTransFS name=NoTransFS,service=ManagedConnectionFactory
* http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss.jca%3Aservice%3DManagedConnectionPool%2Cname%3DNoTransFS name=NoTransFS,service=ManagedConnectionPool
* http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss.jca%3Aservice%3DNoTxCM%2Cname%3DNoTransFS name=NoTransFS,service=NoTxCM
Admin-Console
View by Type: All Types No Tx ConnectionFactories Tx ConnectionFactories
|| Name || Type || Status || Actions ||
| %1,4% http://localhost:8080/admin-console/images/spacer.gif (http://localhost:8080/admin-console/images/spacer.gif) |
| NoTransFS (http://localhost:8080/admin-console/secure/summary.seam?path=-13&conversationId=14) | No Tx ConnectionFactory (http://localhost:8080/admin-console/secure/summary.seam?path=-3%2FResources%2FConnection+Factories%2FNo+Tx+ConnectionFactory&conversationId=14) | UP | |
Now I'd like to use it in my beans to use file access without using java.io.* so I used the following code:
import javax.annotation.Resource;
import javax.resource.cci.ConnectionFactory;
...
@Resource(name="NoTransFS")
private DirContextFactory dcf;
public String action() {
try {
DirContext dc = dcf.getConnection();
NamingEnumeration<SearchResult> res = dc.search("myFile", null);
while (res.hasMore()) {
System.out.println(res.next().toString());
}
} catch (NamingException e) {
e.printStackTrace();
}
return null;
}
...
Unfortunately I can't look up the ConnectionFactory so I'll always receive a NullPointerException.I tried several kinds of the @Resource annotation but nothing works out. Maybe the JNDIView helps somebody to give me some hints:
java: Namespace
+- securityManagement (class: org.jboss.security.integration.JNDIBasedSecurityManagement)
+- comp (class: javax.namingMain.Context)
+- DeploymentManager (class: org.jboss.aop.generatedproxies.AOPProxy$4)
+- XAConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
+- authDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
+- policyRegistration (class: org.jboss.security.plugins.JBossPolicyRegistration)
+- TransactionPropagationContextImporter (class: com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager)
+- app (class: org.jnp.interfaces.NamingContext)
| +- Manager (class: javax.inject.manager.Manager)
+- ClusteredConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- Mail (class: javax.mail.Session)
+- TransactionPropagationContextExporter (class: com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager)
+- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
+- jaas (class: javax.naming.Context) | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
| +- profileservice (class: org.jboss.security.plugins.SecurityDomainContext)
| +- jboss-web-policy (class: org.jboss.security.plugins.SecurityDomainContext)
+- ClusteredXAConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- TransactionSynchronizationRegistry (class: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple)
+- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
+- ConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory) +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
+- TransactionManager (class: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate)
+- NoTransFS (class: org.jboss.chap7.ex1.ra.DirContextFactoryImpl)
May anybody help me with this problem?`Thanks a lot
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/567172#567172]
Start a new discussion in JCA at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101019/d3353927/attachment-0001.html
More information about the jboss-user
mailing list