I have one application using CDI with weld 2.2.9.Final and embedded Tomcat 7.0.57 and everything works fine. After upgrading to embedded Tomcat 7.0.59, when I'm starting my application I got the following exception:
Caused by: org.jboss.weld.exceptions.IllegalStateException: WELD-001201: Error loading beans.xml jndi:/localhost/WEB-INF/beans.xml
at org.jboss.weld.xml.BeansXmlParser.parse(BeansXmlParser.java:124)
at org.jboss.weld.bootstrap.WeldBootstrap.parse(WeldBootstrap.java:131)
at org.jboss.weld.environment.servlet.deployment.WebAppBeanArchiveScanner.scan(WebAppBeanArchiveScanner.java:78)
at org.jboss.weld.environment.deployment.discovery.AbstractDiscoveryStrategy.performDiscovery(AbstractDiscoveryStrategy.java:83)
at org.jboss.weld.environment.servlet.WeldServletLifecycle.createDeployment(WeldServletLifecycle.java:230)
at org.jboss.weld.environment.servlet.WeldServletLifecycle.initialize(WeldServletLifecycle.java:120)
at org.jboss.weld.environment.servlet.EnhancedListener.onStartup(EnhancedListener.java:61)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5513)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
Caused by: java.io.FileNotFoundException: jndi:/localhost/WEB-INF/beans.xml
at org.apache.naming.resources.DirContextURLConnection.getInputStream(DirContextURLConnection.java:384)
at java.net.URL.openStream(URL.java:1037)
at org.jboss.weld.xml.BeansXmlParser.parse(BeansXmlParser.java:101)
... 14 more
The problem is java.io.FileNotFoundException: jndi:/localhost/WEB-INF/beans.xml
I just bumped into something similar today. Either the file can't be found, or you are trying to include it from your web.xml with an ENTITY declaration. If you are trying to load beans.xml with an ENTITY declaration, then the problem is caused by a new security policy in Tomcat 7.0.59 -- blocking the loading of external entities is now the default. Context parameter xmlBlockExternal is now set to "true" by default.
You have to override this in a your context: either the main context in ~Tomcat/conf/context.xml or in your application-level context file. To override, add the param like this:
<Context xmlBlockExternal="false">