4 Replies Latest reply: May 18, 2012 7:19 PM by pascal salg RSS

@Resource Annotation fails to inject custom Connectionfactory

pascal salg Newbie



i'm trying to get JBoss 7 (7.1.1) hooked up with the Neo4J Database. There is already a working connector for that (http://alexsmirnov.wordpress.com/2011/05/18/neo4j-java-ee-connector/)


Deployment and startup of my application are no problem.The connectionfactory gets bound to its jndi name at startup:

[org.jboss.as.deployment.connector] (MSC service thread 1-9) JBAS010406: Registered connection factory java:/eis/Neo4j

[org.jboss.as.deployment.connector] (MSC service thread 1-9) JBAS010401: Bound JCA ConnectionFactory [java:/eis/Neo4j]


But the trouble starts when I want to use the database / the connectionfactory. I inject the connectionfactory with the @Resource Annotation like this:

(NEO4J_NAME = "java:/eis/Neo4j")



private Neo4JConnectionFactory connectionFactory;


As soon as I call any method on the connectionFactory (connectionFactory.getConnection() for example) JBoss starts beating me up:




Caused by: java.lang.IllegalArgumentException: Can not set com.netoprise.neo4j.connection.Neo4JConnectionFactory field test.Neo4jClient.connectionFactory to com.netoprise.neo4j.connection.Neo4JConnectionFactoryImpl


(Neo4JConnectionFactory obviously is the interface and *Impl is the corresponding implementing class for that interface..)



I already tried different paramters for the @Resource annotation (mappedBy, name), even tried a jndi lookup by hand (which gives me a classcastexception)


Maybe I'm missing something obvious but I've been pulling my hair out over this one..

Any hints would be greatly appreciated.


Greetings from Germany






I attached the snippet from the standalone.xml config file which I'm using, maybe this will help a little more.