-
1. Re: @Resource Annotation fails to inject custom Connectionfactory
sfcoy May 8, 2012 8:39 AM (in response to paul_)1 of 1 people found this helpfulThis looks like a classloading problem.
Does your application contain a JAR with the Neo4JConnectionFactory class file in it?
If so, try removing it from the runtime deployment.
-
2. Re: @Resource Annotation fails to inject custom Connectionfactory
paul_ May 8, 2012 4:16 PM (in response to sfcoy)Well yes, my EAR contains "neo4j-connector-api-0.3-SNAPSHOT.jar" which has Neo4jConnection.class and Neo4jConnectionFactory.class in it.
What exactly do you mean by "remove it from the runtime deployment"? I think I would need the jar in the ear so I can use the ConnectionFactory ?
Packaging in my project is as follows:
EAR
- lib
- neo4j-connector-api-0.3-SNAPSHOT.jar
WAR
- src
- Neo4jClient (Which has the @Resource Annotation in it)
- TestBean (Stateless Bean to get called from View (Richfaces 4) )
- WebContent
- index.xhtml
- WEB-INF
- beans.xml
- faces-config.xml
- web.xml
- lib
- Richfaces 4 libs & dependencies
A little confused =D
Greetings from Germany,
ps
-
3. Re: @Resource Annotation fails to inject custom Connectionfactory
paul_ May 10, 2012 2:05 PM (in response to paul_)Okay, I finally got it working.
My current solution is this:
- I removed the WAR from my EAR File,
- As Stephen suggested, I removed the neo4j-connector-api-0.3-SNAPSHOT.jar from the build path of the project
- Instead I put the neo4j-connector-api-0.3-SNAPSHOT.jar in jdk/jre/lib/endorsed directory which is used to build the project and run the server with
- deployed neo4j-connector.rar in {server-home}/standalone/deployments
- added jboss-deployment-structure.xml file in {war}/webcontent/web-inf (as seen in http://groups.google.com/group/xadisk/browse_thread/thread/47b7324ece6b884a?pli=1)
- configured the server to use the connector (see <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">)
- then injected the connectionfactory in my class with @Resource annotation (as seen in http://alexsmirnov.wordpress.com/2011/05/18/neo4j-java-ee-connector/)
I will provide a full tutorial as well as soon as I've written it.
Thanks for the help =)
Greetings from Germany
ps
-
4. Re: @Resource Annotation fails to inject custom Connectionfactory
paul_ May 18, 2012 7:19 PM (in response to paul_)I have completed the tutorial now, it can be found here:
(Though I still didn't get it working with an EAR.. will look into that again)
Greetings from Germany
ps