1 Reply Latest reply on Apr 24, 2013 2:34 PM by Bryn Cooke

    Using Weld 2.0.0-CR4 with Tomcat

    Bryn Cooke Newbie


      I'm trying to upgrade a web app from Weld1.1 to Weld2 and was wondering if there anyone could give me some pointers as to how to bootstrap Weld2?


      I have WeldListener registered in my web.xml and Weld is distributed as part of my war file.


      I was getting the following error:


      java.lang.IllegalStateException: Unable to access CDI

                at javax.enterprise.inject.spi.CDI.current(CDI.java:65)

                at org.jboss.weld.servlet.WeldListener.contextInitialized(WeldListener.java:106)



      I then made a service entry for org.jboss.weld.servlet.StaticWeldProvider and get this new error:


      java.lang.IllegalStateException: Singleton is not set. Is your Thread.currentThread().getContextClassLoader() set correctly?

                at org.jboss.weld.bootstrap.api.helpers.IsolatedStaticSingletonProvider$IsolatedStaticSingleton.get(IsolatedStaticSingletonProvider.java:47)

                at org.jboss.weld.Container.instance(Container.java:54)

                at org.jboss.weld.Weld.getBeanManager(Weld.java:111)

                at org.jboss.weld.Weld.getBeanManager(Weld.java:46)

                at org.jboss.weld.servlet.WeldListener.contextInitialized(WeldListener.java:106)


      I think I must be going about this the wrong way as just adding the listener worked for Weld1.1 but I guess there is something else for Weld2.


      Does anyone have any ideas?


      Many thanks,