Question

I'm trying to setup a project using Jetty 8 as the server (jetty-maven-plugin:8.1.11.v20130520), Weld for CDI (weld-servlet:2.0.1.Final), Hibernate for JPA (hibernate-entitymanager:4.2.2.Final, hibernate-jpa-2.0-api:1.0.1.Final) and Jersey for JAX-RS.

It seems that injections isn't working at all. I tested whether the EntityManager is being injected, and the value was null. The log doesn't show any errors or warnings while executing the server.

Am I missing something ? If needed, I will post the log file to gist.

Here is the gist of all relevant files: https://gist.github.com/StalkingKillah/e986474b6885d83c7f8d

Était-ce utile?

La solution

This is how I got it working for Jetty 9, and it should be basically the same for Jetty 8.

http://www.eclipse.org/jetty/documentation/current/framework-weld.html

It is easier to have the weld jar outside of the webapp as then you don't have to mess with tweaking the classes exposed to the webapp classloader like you are here (with the -org.eclipse.jetty bit for the ServletContext). I suspect there are more classes that would have to be added to that in order to make it work. You should get a note in the logging that says it is all enabled and active though.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top