Hi,

Yes, Gerhard is right. First Weld and then OpenWebBeans calls the
AfterBeanDiscovery method, thus you have two CDI containers running at
the same time in your server. Excluding this class from Weld will
certainly help with this issue, but I guess there will be some other
issues, b/c of the two coexistent CDI containers.

Is there a way to disable Weld completely in Glassfish? Because if so,
then this is the way to go for you!

Regards,
Jakob

2011/8/10 Brendan Healey <[email protected]>:
> Hi Gerhard, I had a closer look and figured it out in the end. I found
> something in the weld reference
> that allows a class to be excluded from weld scanning, and that is allowing
> me to bypass the
> duplicate error. I seem to be having to add 'implements serializable' to
> just about everything, but it
> looks like I'm moving in the right direction.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://java.sun.com/xml/ns/javaee";
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>        xmlns:weld="http://jboss.org/schema/weld/beans";
>        xsi:schemaLocation="
>        http://java.sun.com/xml/ns/javaee
> http://docs.jboss.org/cdi/beans_1_0.xsd
>        http://jboss.org/schema/weld/beans
> http://jboss.org/schema/weld/beans_1_1.xsd";>
>     <weld:scan>
>         <weld:exclude name="testMaven2.IPNListener"/>
>     </weld:scan>
> </beans>
>
> Thanks,
> Brendan.
>
> ________________________________
> From: Gerhard Petracek <[email protected]>
> To: [email protected]
> Sent: Wed, 10 August, 2011 19:41:44
> Subject: Re: Compatibility issue with Jersey (JAX-RS) & OWB on Glassfish
> 3.1.1
>
> hi brendan,
> the first call is triggered by weld and the second one by owb.
> regards,
> gerhard
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
>
> 2011/8/10 Brendan Healey <[email protected]>
>>
>> Jakob, the method is being called twice. The problem is that in
>> BeanGenerator#createBeanClass
>> the generatedClassCounter is 0 both times, hence the duplicate name
>> (bean0), so clearly different
>> instances of BeanGenerator are being used.
>> The call stack isn't making a lot of immediate sense to me I'm afraid, but
>> this is what is shown
>> with a method breakpoint on afterBeanDiscovery:
>>
>> call stack 1st call:
>>
>>
>> com.sun.jersey.server.impl.cdi.CDIExtension.afterBeanDiscovery(CDIExtension.java:756)
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java)
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> java.lang.reflect.Method.invoke(Method.java:597)
>>
>> org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
>>
>> org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
>>
>> org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
>>
>> org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
>>
>> org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)
>>
>> org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)
>> org.jbo
>> ss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)
>>
>> org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)
>>
>> org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)
>>
>> org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)
>>
>> org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:88)
>>
>> org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:52)
>>
>> org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:43)
>> org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:372)
>> org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:170)
>> org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
>> org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:270)
>> com.sun.enterprise.v3.serv
>> er.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
>>
>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
>>
>> org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
>>
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
>>
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
>>
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
>>
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
>>
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
>>
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
>> com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459)
>> com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209)
>> com.sun.grizzly.tcp.htt
>> p11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
>> com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
>>
>> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238)
>> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
>> com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
>> com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
>>
>> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
>>
>> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
>>
>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
>> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
>>
>> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
>> com.sun.grizzly.SelectionKey
>> ContextTask.call(SelectionKeyContextTask.java:59)
>> com.sun.grizzly.ContextTask.run(ContextTask.java:71)
>>
>> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
>>
>> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
>> java.lang.Thread.run(Thread.java:662)
>>
>>
>>
>> call stack 2nd call:
>>
>>
>>
>>
>> com.sun.jersey.server.impl.cdi.CDIExtension.afterBeanDiscovery(CDIExtension.java:756)
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java)
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> java.lang.reflect.Method.invoke(Method.java:597)
>>
>> org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:256)
>>
>> org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:440)
>>
>> org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:403)
>>
>> org.apache.webbeans.config.BeansDeployer.fireAfterBeanDiscoveryEvent(BeansDeployer.java:263)
>> org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:176)
>>
>> org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:123)
>> org.apache.webbeans.web.lifecycle.WebContainerLif
>> ecycle.startApplication(WebContainerLifecycle.java:78)
>>
>> org.apache.webbeans.servlet.WebBeansConfigurationListener.contextInitialized(WebBeansConfigurationListener.java:80)
>>
>> org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:4750)
>> com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:550)
>> org.apache.catalina.core.StandardContext.start(StandardContext.java:5366)
>> com.sun.enterprise.web.WebModule.start(WebModule.java:498)
>>
>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
>> com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2000)
>> com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1651)
>> com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
>> org.glassfish.internal.da ta.EngineRef.start(EngineRef.java:130)
>> org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
>>
>> org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:294)
>>
>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:462)
>>
>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
>>
>> org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
>>
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
>>
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
>>
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
>>
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
>>
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext
>> .execute(CommandRunnerImpl.java:1232)
>> com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459)
>> com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209)
>> com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
>> com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
>>
>> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238)
>> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
>> com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
>> com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
>>
>> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
>>
>> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
>>
>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>> com.sun.grizzly.DefaultProtocolChain.execute(Default
>> ProtocolChain.java:90)
>> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
>>
>> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
>>
>> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
>> com.sun.grizzly.ContextTask.run(ContextTask.java:71)
>>
>> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
>>
>> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
>> java.lang.Thread.run(Thread.java:662)
>>
>>
>>
>> Thanks for taking the time to look at this.
>>
>>
>>
>> Regards,
>> Brendan.
>>
>> ________________________________
>> From: Jakob Korherr <[email protected]>
>> To: [email protected]
>> Sent: Wed, 10 August, 2011 15:09:58
>> Subject: Re: Compatibility issue with Jersey (JAX-RS) & OWB on Glassfish
>> 3.1.1
>>
>> Hi,
>>
>> I checked the jersey source code and this exception can only happen if
>>
>> void afterBeanDiscovery(@Observes AfterBeanDiscovery event) { ... }
>>
>> of com.sun.jersey.server.impl.cdi.CDIExtension is called twice, which
>> shouldn't happen.
>>
>> Can you set a break point into this method and check if it is called
>> twice? and from where/who?
>>
>> Regards,
>> Jakob
>>
>>
>> 2011/8/10 Brendan Healey <[email protected]>:
>> > (I had problems sending the email inline with yahoo mail, the attachment
>> > 'save.txt' hopefully
>> >
>> > will contain the intended content..)
>>
>>
>>
>> --
>> Jakob Korherr
>>
>> blog: http://www.jakobk.com
>> twitter: http://twitter.com/jakobkorherr
>> work: http://www.irian.at
>
>



-- 
Jakob Korherr

blog: http://www.jakobk.com
twitter: http://twitter.com/jakobkorherr
work: http://www.irian.at

Reply via email to