henrichen / zkcdi

Automatically exported from code.google.com/p/zkcdi
0 stars 0 forks source link

Application Fails to deploy in JBoss 7 #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a web app and deployed to JBoss 7, including zkcdi.jar and a simple 
@SessionScoped ZK Composer
2. Make sure there is a beans.xml file somewhere in the META-INF package of 
your classpath.
2. Since JBOSS 7 already contains CDI BeanManager, I don't have to configure 
one in web.xml. However you get an exception below when you don't.

org.zkoss.xel.XelException: Cannot locate the BeanManager for JavaEE 6
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    org.zkoss.lang.Classes.newInstance(Classes.java:73)
    org.zkoss.lang.Exceptions.wrap(Exceptions.java:206)
    org.zkoss.xel.XelException$Aide.wrap(XelException.java:47)
    org.zkoss.zkplus.cdi.CDIUtil.getBeanManager(CDIUtil.java:44)
    org.zkoss.zkplus.cdi.DelegatingVariableResolver.<init>(DelegatingVariableResolver.java:39) 

3. If you do add the ff entry, you get another exception
<resource-env-ref>
        <resource-env-ref-name>BeanManager</resource-env-ref-name>
        <resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
    </resource-env-ref>

21:26:59,429 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"C
omposite operation failed and was rolled back. Steps that failed:" => {"Operatio
n step-2" => {"Services with missing/unavailable dependencies" => ["jboss.naming
.context.java.module.\"hims-web-1.0-SNAPSHOT\".\"hims-web-1.0-SNAPSHOT\".env.Bea
nManager missing [ jboss.naming.context.java.module.\"hims-web-1.0-SNAPSHOT\".\"
hims-web-1.0-SNAPSHOT\".BeanManager ]"]}}}

I' using ZK 5.0.9

At this point I've spent too much time fighting ZK and i'm seriously thinking 
of going back to JSF.

Original issue reported on code.google.com by emo...@gmail.com on 10 Dec 2011 at 9:44

GoogleCodeExporter commented 9 years ago
I have a fix for JBoss AS7.0.2 "arc" which is zk-cdi-1.1-RC.jar the source code 
of which is zk-cdi.zip. 

Original comment by massey1...@gmail.com on 29 Jan 2012 at 8:44

Attachments:

GoogleCodeExporter commented 9 years ago
to run that fix on the AS7 version of weld you need another fix suggested here 
which is put another version of org.zkoss.zkplus.cdi.CDIUtil.java into your 
project (so that it is classloaded first) which used the AS7 jndi name of 
BeanManager which is "java:comp/BeanManager" not ""java:comp/env/BeanManager" 
which is in the following class (which was posted elsewhere). 

I have attached that file which you can put into your project. 

Original comment by massey1...@gmail.com on 29 Jan 2012 at 8:49

Attachments: