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&nam...
name=NoTransFS,service=ConnectionFactoryBinding
*
http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&nam...
name=NoTransFS,service=ManagedConnectionFactory
*
http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&nam...
name=NoTransFS,service=ManagedConnectionPool
*
http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&nam...
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&conv...) |
No Tx ConnectionFactory
(
http://localhost:8080/admin-console/secure/summary.seam?path=-3%2FResourc...)
| 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&...]