unable to read beans.xml from vaadin CDI vaadin-cdi-1.x.jar!/META-INF/beans

HI, I have not really developed anything with vaadin. But I am supposed to build a war file for my vaadin application. My build tool is ant, with ivy resolving the dependencies. I was able to build war and I am unable to deploy it on TOMEE. I was able to deploy war on TOMEE by pointing to library on my disk. But I am unable to deploy with the dependent jars in my build path. The error being
"SEVERE: Unable to read beans.xml from :jar:file:/C:/apache/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/[APPNAME]
/WEB-INF/lib/vaadin-cdi-1.0.jar!/META-INF/beans.xml
Aug 05, 2013 6:05:48 PM org.apache.openejb.config.DeploymentLoader mergeBeansXml
SEVERE: Unable to read beans.xml from :file:/C:/apache/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/[APPNAME]
/WEB-INF/beans.xml

Aug 05, 2013 6:06:33 PM org.apache.openejb.config.ReportValidationResults logResults
WARNING: WARN ā€¦ [APPNAME]
: The application [APPNAME]
uses @Inject but CDI is not enabled. Maybe youd need to add a beans.xml file.
Aug 05, 2013 6:06:33 PM org.apache.openejb.config.ReportValidationResults logResults
WARNING: 1 warning for EjbModule(path=[APPNAME]
)

When I checked my localhost.out for detailed error, it doesnot say anything clearly. As I am not the developer, I do not know what that isā€¦ but my localhost.out has following log

Aug 05, 2013 6:51:33 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.apache.catalina.deploy.ApplicationListener@6b72bb
javax.enterprise.inject.UnsatisfiedResolutionException: Api type [com.vaadin.cdi.internal.VaadinCDIServlet]
is not found with the qualifiers
Qualifiers: [@javax.enterprise.inject.Default()]

for injection into Field Injection Point, field name : vaadinCDIServlet, Bean Owner : [ContextDeployer, Name:null, WebBeans Type:DEPENDENT, API Types:[com.vaadin.cdi.internal.ContextDeployer,javax.servlet.ServletContextListener,java.util.EventListener,java.lang.Object]
, Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]
]
at org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:60)
at org.apache.webbeans.container.InjectionResolver.getInjectionPointBean(InjectionResolver.java:239)
at org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:76)
at org.apache.webbeans.inject.InjectableField.doInjection(InjectableField.java:65)
at org.apache.webbeans.portable.InjectionTargetImpl.injectFields(InjectionTargetImpl.java:333)
at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:319)
at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:308)
at org.apache.webbeans.component.AbstractOwbBean.create(AbstractOwbBean.java:123)
at org.apache.openejb.core.WebContext.newInstance(WebContext.java:137)
at org.apache.tomee.catalina.JavaeeInstanceManager.newInstance(JavaeeInstanceManager.java:56)
at org.apache.tomee.catalina.JavaeeInstanceManager.newInstance(JavaeeInstanceManager.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4854)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1653)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

Aug 05, 2013 6:51:33 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)

Can any one help me with this please?

There is no vaadin-cdi-1.0 yet for the official Vaadin CDI add-on (1.0.0.alpha1 is the latest published version) so the JAR vaadin-cdi-1.0 is probably one your project has built and thus I canā€™t know what is inside it.

The first question, though, is whether your project has a valid beans.xml (which can be an empty file) in the correct location. If it does, check also whether the vaadin-cdi-1.0.jar contains a beans.xml - it should be an almost empty XML file in the standard version.

Note also that the latest version of the add-on in the repository (and the published version 1.0.0.alpha1) no longer contains a VaadinCDIServlet, so most likely your version is built from an older branch of the repository.

Hello Henry, Thanks for tip on how to solve this. My vaadin-cdi 1.0 jar nothing but vaadin-cdi-1.0.SNAPSHOT. That jar was in the lib folder the developers are using(I was suggested to use same jars in the lib). I could not find an Ivy dependency for that. So I have uploaded that jar to our shared repo and tried to give SNAPSHOT as rev. But artifactory has been converting that to some number. So I just gave it a number 1.0. and added that dependency to ivy.xml. In short, It is nothing but vaadin-cdi 1.0.snapshot.jar

coming to these beans.xmls, vaadin cdi beans.xml has the following content


webcontent/web-Inf/beans.xml has similar namespace definition with an extra empty tag alternatives. (all the contents are commented out)

So from your suggestion, I should delete the contents of beans.xmls and change the jar to 1.0.0 alpha1. I will change those and will let you know

Thanks so much for the help

Those beans.xml files should be ok as is.

Still, Iā€™m wondering about the reference to VaadinCDIServlet in the logs above - it does not exist anymore in vaadin-cdi and as far as I can recall it had already been deleted in 1.0.0.alpha1. Please make sure you donā€™t have an older version of the add-on and that your project does not explicitly use VaadinCDIServlet anywhere.

You could also try checking out and building the CDI add-on yourself to make sure you are using the latest version.

Hello Henri, This time I have not used ivy to resolve my dependencies. I have pointed my compile task to use jars in my lib folder of Application (which my colleagues have been using and were successfully able to deploy war (which was exported from eclipse) . BUt still I am getting beans.xml cannot be read error. and when I check my localhost.out, I get the same error. Could there be any other reason??

catalina.out

Aug 07, 2013 2:00:55 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\apache\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\PerfMgr\WEB-INF\lib\javaee-api-6.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Aug 07, 2013 2:00:55 PM org.apache.tomee.catalina.TomEEClassLoaderEnricher validateJarFile
WARNING: jar ā€˜C:\apache\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\PerfMgr\WEB-INF\lib\jboss-client.jarā€™ contains offending class: javax.transaction.Transaction. It will be ignored.
Aug 07, 2013 2:00:55 PM org.apache.tomee.catalina.TomEEClassLoaderEnricher validateJarFile
WARNING: jar ā€˜C:\apache\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\PerfMgr\WEB-INF\lib\jboss-ejb-api_3.1_spec-1.0.2.Final.jarā€™ contains offending class: javax.ejb.EJB. It will be ignored.
Aug 07, 2013 2:00:55 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\apache\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\PerfMgr\WEB-INF\lib\jboss-servlet-api_3.0_spec-1.0.2.Final.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.cl
Aug 07, 2013 2:00:55 PM org.apache.tomee.catalina.TomEEClassLoaderEnricher validateJarFile
WARNING: jar ā€˜C:\apache\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\PerfMgr\WEB-INF\lib\jboss-transaction-api_1.1_spec-1.0.1.Final.jarā€™ contains offending class: javax.transaction.Transaction. It will be ignored.
Aug 07, 2013 2:00:55 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\apache\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\PerfMgr\WEB-INF\lib\servlet-api-2.5-6.1.11.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Aug 07, 2013 2:00:56 PM org.apache.openejb.config.DeploymentLoader mergeBeansXml
SEVERE: Unable to read beans.xml from :jar:file:/C:/apache/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/PerfMgr/WEB-INF/lib/vaadin-cdi-1.0-SNAPSHOT.jar!/META-INF/beans.xml
Aug 07, 2013 2:00:56 PM org.apache.openejb.config.DeploymentLoader mergeBeansXml
SEVERE: Unable to read beans.xml from :file:/C:/apache/apache-tomee-plus-1.6.0-SNAPSHOT/webapps/PerfMgr/WEB-INF/beans.xml

Aug 07, 2013 2:01:43 PM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: C:\apache\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\PerfMgr
Aug 07, 2013 2:01:50 PM org.apache.openejb.config.ReportValidationResults logResults
WARNING: WARN ā€¦ PerfMgr: The application [PerfMgr]
uses @Inject but CDI is not enabled. Maybe youd need to add a beans.xml file.
Aug 07, 2013 2:01:50 PM org.apache.openejb.config.ReportValidationResults logResults
WARNING: 1 warning for EjbModule(path=PerfMgr)
Aug 07, 2013 2:01:50 PM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application ā€œC:\apache\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\PerfMgrā€ loaded.
Aug 07, 2013 2:01:50 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: C:\apache\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\PerfMgr
Aug 07, 2013 2:01:50 PM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@2e80e1
Aug 07, 2013 2:01:50 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is startingā€¦
Aug 07, 2013 2:01:50 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]

Aug 07, 2013 2:01:50 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]

Aug 07, 2013 2:01:50 PM com.vaadin.cdi.internal.VaadinExtension afterBeanDiscovery
INFO: UIScopedContext registered
Aug 07, 2013 2:01:50 PM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Aug 07, 2013 2:01:50 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 115 ms.
Aug 07, 2013 2:01:50 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=C:\apache\apache-tomee-plus-1.6.0-SNAPSHOT\webapps\PerfMgr)
Aug 07, 2013 2:01:50 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Aug 07, 2013 2:01:50 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context
[/PerfMgr] startup failed due to previous errors

my localhost.out

Aug 07, 2013 2:01:50 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.apache.catalina.deploy.ApplicationListener@6aa20b
javax.enterprise.inject.UnsatisfiedResolutionException: Api type [com.vaadin.cdi.internal.VaadinCDIServlet]
is not found with the qualifiers
Qualifiers: [@javax.enterprise.inject.Default()]

for injection into Field Injection Point, field name : vaadinCDIServlet, Bean Owner : [ContextDeployer, Name:null, WebBeans Type:DEPENDENT, API Types:[java.lang.Object,com.vaadin.cdi.internal.ContextDeployer,javax.servlet.ServletContextListener,java.util.EventListener]
, Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]
]
at org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:60)
at org.apache.webbeans.container.InjectionResolver.getInjectionPointBean(InjectionResolver.java:239)
at org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:76)
at org.apache.webbeans.inject.InjectableField.doInjection(InjectableField.java:65)
at org.apache.webbeans.portable.InjectionTargetImpl.injectFields(InjectionTargetImpl.java:333)
at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:319)
at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:308)
at org.apache.webbeans.component.AbstractOwbBean.create(AbstractOwbBean.java:123)
at org.apache.openejb.core.WebContext.newInstance(WebContext.java:137)
at org.apache.tomee.catalina.JavaeeInstanceManager.newInstance(JavaeeInstanceManager.java:56)
at org.apache.tomee.catalina.JavaeeInstanceManager.newInstance(JavaeeInstanceManager.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4854)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1653)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

Aug 07, 2013 2:01:50 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)

Thanks

Hello Guys, I was able to solve this problem. I am just posting here incase you get the same error.It is because of the conflicting jar files. In my case, I added jboss jars and widgetset jars. Please make sure you have deleted the un necessary jars.

Thanks
Harshita