0

ZK CDI Glassfish 3.0.1

asked 2010-07-01 17:48:26 +0800

nahuele gravatar image nahuele
18

updated 2010-07-01 17:49:37 +0800

Hi,

I was trying to run zkcdidemo.war in Glassfish 3.0.1. After removing some Weld-related listeners from web.xml, during the deploy the app threw an exception:

Caused by: java.lang.RuntimeException: java.lang.ClassCastException: org.jboss.weld.BeanManagerImpl cannot be cast to org.jboss.weld.manager.BeanManagerImpl
    at org.zkoss.cdi.weld.spi.ZKWeldExtension.beforeBeanDiscovery(ZKWeldExtension.java:126)

After removing the cast in that class (ZKWeldExtension.java:126):

   event.addAnnotatedType(((BeanManagerImpl)manager).createAnnotatedType(c));

for
   event.addAnnotatedType(manager.createAnnotatedType(c));

zkcdidemo worked ok. Is there any reason for that cast?

Thanks in advance,
Nahuel

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2010-07-01 20:45:38 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

Hi nahuele,
At the time ZK CDI was released createAnnotatedType(Class<T>) method was not defined on BeanManager interface but it seems to have been added to the interface in later release. The cast was removed later on but the demo was not updated. Please download the latest ZK CDI 1.0RC binary separately and replace the one in demo with it. Thanks for pointing out though. I'll update the demo.war to include latest release.

link publish delete flag offensive edit

answered 2010-07-02 06:37:45 +0800

nahuele gravatar image nahuele
18

Hi ashishd,

I've download the last ZK CDI (1.0RC) but the cast is still there in the source and replacing the binaries throws the same exception.

Caused by: java.lang.NoClassDefFoundError: org/jboss/weld/manager/BeanManagerImpl
	at org.zkoss.cdi.weld.spi.ZKWeldExtension.beforeBeanDiscovery(ZKWeldExtension.java:109)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:113)
	at org.zkoss.cdi.weld.spi.ZKWeldExtension_$$_javassist_70.beforeBeanDiscovery(ZKWeldExtension_$$_javassist_70.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:228)
	at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:64)
	at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:178)
	... 36 more

Thanks,
Nahuel

link publish delete flag offensive edit

answered 2010-07-02 07:18:37 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Seems now is a jboss lib is missing:

.NoClassDefFoundError: org/jboss/weld/manager/BeanManagerImpl

link publish delete flag offensive edit

answered 2010-07-02 07:37:05 +0800

nahuele gravatar image nahuele
18

Hi Terry,

It's the same problem of the first post. That class is part of the Weld Implementation library (not API). We should avoid using specific implementation classes instead of APIs classes.

In this case, at ZKWeldExtension.java:109 the implementation class is used only to cast the API interface (because old API didn't have that method).

ashishd, it's seems that the problem is still in the ZK CDI (1.0RC) release.


Regards,
Nahuel

link publish delete flag offensive edit

answered 2010-07-08 22:21:46 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

Hi nahuele,
My bad. It should have been updated but unfortunately it seems not. I have reported it as a bug on zkcdi issue tracker and you should see a freshly release for this fix soon.

link publish delete flag offensive edit

answered 2010-08-04 15:55:48 +0800

nahuele gravatar image nahuele
18

Hi,

I've updated Glassfish to the lastest release, which uses WELD 1.0.1. When i try to run the same HelloWorld project that works fine with an older version of Glassfish, the app don't start.

This is the stack trace:

INFO: WELD-000900 1.0.1 (SP3)
INFO: Hibernate Validator bean-validator-3.0-JBoss-4.0.2
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.

INFO: 17:43:02.750 [http-thread-pool-4848-(2)] INFO  org.reflections.Reflections - Reflections took 1906 ms to scan 27 urls, producing 4 keys and 31 values 


INFO: ZK Weld Extension 1.0RC

INFO: Starting ZK 5.0.1 CE (build: 2010031810)

INFO: Loading system default
INFO: Parsing jndi:/server/TestCDI/WEB-INF/zk.xml

INFO: Loading application TestCDI at /TestCDI
INFO: Loading application TestCDI at /TestCDI
INFO: Loading application TestCDI at /TestCDI
GRAVE: Exception while loading the app
org.glassfish.deployment.common.DeploymentException: WELD-001409 Injection point has ambiguous dependencies.  Injection point:  field com.arq.TestCDI.web.HelloWorld.sayHelloBtn;  Qualifiers:  [@org.zkoss.cdi.inject.ComponentId(value=sayHelloBtn)]; Possible dependencies: [org.jboss.weld.bean-org.zkoss.zkplus.cdi.ZKComponentProducerMethods-ProducerMethod-org.zkoss.zkplus.cdi.ZKComponentProducerMethods.method getsayHelloBtn(), org.jboss.weld.bean-org.zkoss.zkplus.cdi.ZKComponentProducerMethods-ProducerMethod-org.zkoss.zkplus.cdi.ZKComponentProducerMethods.method getsayHelloBtn()]
	at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:181)
	at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:125)
	at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:239)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
	at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
	at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
	at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
	at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
	at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
	at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
	at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
	at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
	at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
	at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
	at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
	at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
	at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
	at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
	at java.lang.Thread.run(Thread.java:619)
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001409 Injection point has ambiguous dependencies.  Injection point:  field com.arq.TestCDI.web.HelloWorld.sayHelloBtn;  Qualifiers:  [@org.zkoss.cdi.inject.ComponentId(value=sayHelloBtn)]; Possible dependencies: [org.jboss.weld.bean-org.zkoss.zkplus.cdi.ZKComponentProducerMethods-ProducerMethod-org.zkoss.zkplus.cdi.ZKComponentProducerMethods.method getsayHelloBtn(), org.jboss.weld.bean-org.zkoss.zkplus.cdi.ZKComponentProducerMethods-ProducerMethod-org.zkoss.zkplus.cdi.ZKComponentProducerMethods.method getsayHelloBtn()]
	at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:280)
	at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:122)
	at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:141)
	at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:331)
	at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:317)
	at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:399)
	at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:178)
	... 30 more

The strange thing is that the two possible dependencies are equal!

Any help?

Regards,
Nahuel

link publish delete flag offensive edit

answered 2010-12-29 21:07:49 +0800

aktejo gravatar image aktejo
155 3

i have the same exception, ambigous injection point.

any body knows why?

link publish delete flag offensive edit

answered 2010-12-30 04:50:29 +0800

aktejo gravatar image aktejo
155 3

as we know that glassfish currently implements java EE 6 spesification already, then I thing it should easier to implement zk cdi with glassfish,
any idea ?

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-07-01 17:48:26 +0800

Seen: 829 times

Last updated: Dec 30 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More