Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Strange problem with CDI/Weld

Hello,


I encountered a strange problem with CDI on jetty.

I installed the jetty CDI module with


java -jar start.jar --add-to-start=cdi

that gives me some additinal libs and CDI support

ls  lib/cdi | cat
javax.enterprise.cdi-api-1.2.jar
javax.inject-1.0.jar
javax.interceptor-api-1.2.jar
jboss-classfilewriter-1.1.2.Final.jar
jboss-logging-3.2.1.Final.jar
weld-api-2.4.SP1.jar
weld-core-impl-2.4.3.Final.jar
weld-core-jsf-2.4.8.Final.jar
weld-environment-common-2.4.3.Final.jar
weld-servlet-core-2.4.3.Final.jar
weld-spi-2.4.SP1.jar

Then I build a very basic test application with CDI, JSF and JPA.
Everthing worked fine till I accidentally copied my app.war to app1.war
in the webapp directory.

Suddenly I got the exception

Caused by: org.jboss.weld.context.ContextNotActiveException:
WELD-001303: No active contexts for scope type
javax.enterprise.context.SessionScoped

I found out that jetty creates two contexts app and app1 but CDI only
works in one of those contexts. If I copy app.war to app2.war I have 3
Contexts but CDI works only in one.

I found this bug report regarding "WELD-2497 Weld API - make it possible
to propagate built-in contexts"

https://issues.jboss.org/browse/WELD-2497

So I have 3 questions at the moment:

a) Could somebody explain what's going on here. There are some threads
on stackoverflow but I don't understand what the real problem is.

b) Is WELD-2497 the fix for my problem?

c) I ist possible to use Weld3.1 with jetty?


Regards,
Bernhard Donaubauer


Back to the top