JSON natural on GF 3.1 b40

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

JSON natural on GF 3.1 b40

jmilkiewicz
Hi

I am not sure if this mail should not be sent to glassfish user group
but i hope i can find some help here:

I am trying to use JSON natural notation

JAXBContext context = new JSONJAXBContext(JSONConfiguration.natural().build()...

The application worked as a charm on GF 3.0.1 but on GF 3.1. b40  web
profile (current the latest one as of yesterday) i got a nasty
exception with following header message:

SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
found. For the recent builds to get this working correctly, you need
even at least JAXB version 2.1.12. Please add it to your classpath!
SEVERE: The provider class, class foo.bar.MyJAXBContextResolver, could
not be instantiated. Processing will continue but the class will not
be utilized

Generally ,how to upgrade to JAXB 2.1 provided that JAXB 2 classes are
already bundled within JDK?


How to make an upgrade on GF 3.1 which does not have any of JAXB api/
JAXB impl osgified versions at all ( GF 3.0.1 indeed had jaxb-api-osgi
and jaxb-osgi.jar )  ?

regards Jakub Milkiewicz
Reply | Threaded
Open this post in threaded view
|

Re: JSON natural on GF 3.1 b40

Pavel Bucek-2
Hello Jakub,

generally - update your java runtime; unfortunately, we currently
available jdk versions don't have that recent jaxb version, so ..

I guess putting jaxb-api-osgi.jar [1] and jaxb-osgi.jar [2] into
glassfish/modules should work that out. Or you can upgrade to full
profile, which provides newer jaxb implementation.

Or, if you don't want to update your local glassfish installation, you
could be able to package jaxb-osgi.jar into war and deploy it with your
application; you might need to set classloader delegation to false
(sun-web.xml: <class-loader delegate="false"/>).

Regards,
Pavel

[1]
http://download.java.net/maven/2/javax/xml/bind/jaxb-api-osgi/2.2.2/jaxb-api-osgi-2.2.2.jar
[2]
http://download.java.net/maven/2/com/sun/xml/bind/jaxb-osgi/2.2.3-1/jaxb-osgi-2.2.3-1.jar

On 01/31/2011 03:45 PM, [hidden email] wrote:

> Hi
>
> I am not sure if this mail should not be sent to glassfish user group
> but i hope i can find some help here:
>
> I am trying to use JSON natural notation
>
> JAXBContext context = new JSONJAXBContext(JSONConfiguration.natural().build()...
>
> The application worked as a charm on GF 3.0.1 but on GF 3.1. b40  web
> profile (current the latest one as of yesterday) i got a nasty
> exception with following header message:
>
> SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
> found. For the recent builds to get this working correctly, you need
> even at least JAXB version 2.1.12. Please add it to your classpath!
> SEVERE: The provider class, class foo.bar.MyJAXBContextResolver, could
> not be instantiated. Processing will continue but the class will not
> be utilized
>
> Generally ,how to upgrade to JAXB 2.1 provided that JAXB 2 classes are
> already bundled within JDK?
>
>
> How to make an upgrade on GF 3.1 which does not have any of JAXB api/
> JAXB impl osgified versions at all ( GF 3.0.1 indeed had jaxb-api-osgi
> and jaxb-osgi.jar )  ?
>
> regards Jakub Milkiewicz
>
>    

Reply | Threaded
Open this post in threaded view
|

Re: JSON natural on GF 3.1 b40

jmilkiewicz
Hi Pavel

Thanks for a fast answer but unfortunately it still does not work.

1 - adding jaxb-api-osgi-2.2.2.jar and jaxb-osgi-2.2.3-1.jar to GF 3.1
modules folder
    blows out glassfish: my application and admin console are not
deployed/reachable.
In my log file i can see:

SEVERE: Exception while loading the app : java.lang.RuntimeException:
java.lang.NullPointerException
com.google.common.collect.ComputationException:
java.lang.RuntimeException: java.lang.NullPointerException
        at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:218)
        at com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:100)
        at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:515)
        at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:183)
        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:96)
        at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:133)
        at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:192)
        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:364)
        at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:170)
        at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
        at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:262)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:354)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:369)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1080)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1260)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1248)
        at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:453)
        at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:220)
        at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
        at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:71)
        at org.jboss.weld.util.reflection.SecureReflections.getDeclaredFields(SecureReflections.java:111)
        at org.jboss.weld.introspector.jlr.WeldClassImpl.<init>(WeldClassImpl.java:163)
        at org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:124)
        at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:54)
        at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:42)
        at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:206)
        ... 38 more
Caused by: java.lang.NullPointerException
        at org.apache.felix.framework.resolver.ResolverImpl.permutateIfNeeded(ResolverImpl.java:1140)
        at org.apache.felix.framework.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1066)
        at org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:176)
        at org.apache.felix.framework.Felix$FelixResolver.resolve(Felix.java:4066)
        at org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1412)
        at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:734)
        at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
        at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)
        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1604)
        at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:904)
        at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$3$1.run(OSGiModuleImpl.java:399)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$3.loadClass(OSGiModuleImpl.java:395)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at com.sun.enterprise.v3.server.APIClassLoaderServiceImpl$APIClassLoader.loadClass(APIClassLoaderServiceImpl.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1465)
        at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1368)
        at java.lang.Class.getDeclaredFields0(Native Method)
        at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
        at java.lang.Class.getDeclaredFields(Class.java:1743)
        at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:116)
        at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:112)
        at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:67)
        ... 44 more

When comparing GF 3.0.1 b22 with GF 3.1 b40 i noticed that
beside the latter having jaxb jars removed from modules folder i think
there are some changes in felix config.properties file. Maybe i need
to investigate it further...


2. adding  jaxb-osgi-2.2.3-1.jar  to WEB-INF/lib and setting
class-loader delegate to false does not work either.

SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
found. For the recent builds to get this working correctly, you need
even at least JAXB version 2.1.12. Please add it to your classpath!
SEVERE: The provider class, class
pl.assetwell.demo.infrastructure.MyJAXBContextResolver, could not be
instantiated. Processing will continue but the class will not be
utilized
java.lang.RuntimeException: NATURAL JSON notation configured, but JAXB
RI 2.1.10 not found. For the recent builds to get this working
correctly, you need even at least JAXB version 2.1.12. Please add it
to your classpath!
        at com.sun.jersey.api.json.JSONConfiguration.natural(JSONConfiguration.java:447)
        at pl.assetwell.demo.infrastructure.MyJAXBContextResolver.<init>(MyJAXBContextResolver.java:25)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)


This time i think i know why it can't work:
I understand that class-loader delegate=false forces application (war)
 to first load classes itself before delegation to parent (server)
classloader (PARENT-LAST).
If my understanding is correct than this approach can not work since
it is not class within my application is trying to load JAXB RI
2.1.12.  According to stacktrace (above) JSONConfiguration tries to
check if proper version of JAXB is
present by execution of:
Class.forName("com.sun.xml.bind.annotation.OverrideAnnotationOf");

Since JSONConfiguration is bundled in jersey-json.jar withing GF
modules it will use it is own classloader or any other
parent(server)/OSGI classloader to find  OverrideAnnotationOf class.
None of these classloaders will have access to application
classloader. Am i right on this ?

I can imagine i could copy some jersey-jars along with jaxb jars to
WEB-INF/lib  and then specify class-loader delegate=false  but this is
not what i would like to do...

I will try to  check it with full GF 3.1 b40 or another/new build.


regards
Jakub Milkiewicz


2011/1/31 Pavel Bucek-2 [via Jersey]
<[hidden email]>:

> Hello Jakub,
>
> generally - update your java runtime; unfortunately, we currently
> available jdk versions don't have that recent jaxb version, so ..
>
> I guess putting jaxb-api-osgi.jar [1] and jaxb-osgi.jar [2] into
> glassfish/modules should work that out. Or you can upgrade to full
> profile, which provides newer jaxb implementation.
>
> Or, if you don't want to update your local glassfish installation, you
> could be able to package jaxb-osgi.jar into war and deploy it with your
> application; you might need to set classloader delegation to false
> (sun-web.xml: <class-loader delegate="false"/>).
>
> Regards,
> Pavel
>
> [1]
> http://download.java.net/maven/2/javax/xml/bind/jaxb-api-osgi/2.2.2/jaxb-api-osgi-2.2.2.jar
> [2]
> http://download.java.net/maven/2/com/sun/xml/bind/jaxb-osgi/2.2.3-1/jaxb-osgi-2.2.3-1.jar
>
> On 01/31/2011 03:45 PM, [hidden email] wrote:
>> Hi
>>
>> I am not sure if this mail should not be sent to glassfish user group
>> but i hope i can find some help here:
>>
>> I am trying to use JSON natural notation
>>
>> JAXBContext context = new
>> JSONJAXBContext(JSONConfiguration.natural().build()...
>>
>> The application worked as a charm on GF 3.0.1 but on GF 3.1. b40  web
>> profile (current the latest one as of yesterday) i got a nasty
>> exception with following header message:
>>
>> SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
>> found. For the recent builds to get this working correctly, you need
>> even at least JAXB version 2.1.12. Please add it to your classpath!
>> SEVERE: The provider class, class foo.bar.MyJAXBContextResolver, could
>> not be instantiated. Processing will continue but the class will not
>> be utilized
>>
>> Generally ,how to upgrade to JAXB 2.1 provided that JAXB 2 classes are
>> already bundled within JDK?
>>
>>
>> How to make an upgrade on GF 3.1 which does not have any of JAXB api/
>> JAXB impl osgified versions at all ( GF 3.0.1 indeed had jaxb-api-osgi
>> and jaxb-osgi.jar )  ?
>>
>> regards Jakub Milkiewicz
>>
>>
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://jersey.576304.n2.nabble.com/JSON-natural-on-GF-3-1-b40-tp5977358p5977495.html
> To start a new topic under Jersey, email
> [hidden email]
> To unsubscribe from Jersey, click here.
Reply | Threaded
Open this post in threaded view
|

Re: JSON natural on GF 3.1 b40

jmilkiewicz
In reply to this post by Pavel Bucek-2
Hi

I managed to run it on full GF 3.1 b40 and everything works.
Next, I have copied jaxb jars you mentioned above to the following
locations (as in GF 3.1 full)
jaxb-api-osgi.jar to modules/endorsed
jaxb-osgi to modules

from now everything works as a charm.

regards

Jakub Milkiewicz

2011/1/31 [hidden email] <[hidden email]>:

> Hi Pavel
>
> Thanks for a fast answer but unfortunately it still does not work.
>
> 1 - adding jaxb-api-osgi-2.2.2.jar and jaxb-osgi-2.2.3-1.jar to GF 3.1
> modules folder
>    blows out glassfish: my application and admin console are not
> deployed/reachable.
> In my log file i can see:
>
> SEVERE: Exception while loading the app : java.lang.RuntimeException:
> java.lang.NullPointerException
> com.google.common.collect.ComputationException:
> java.lang.RuntimeException: java.lang.NullPointerException
>        at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:218)
>        at com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:100)
>        at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:515)
>        at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:183)
>        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:96)
>        at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:133)
>        at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:192)
>        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:364)
>        at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:170)
>        at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
>        at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:262)
>        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
>        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
>        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:354)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:369)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1080)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1260)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1248)
>        at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:453)
>        at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:220)
>        at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
>        at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
>        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
>        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
>        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
>        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
>        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
>        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
>        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
>        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
>        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
>        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
>        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
>        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
>        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
>        at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.RuntimeException: java.lang.NullPointerException
>        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:71)
>        at org.jboss.weld.util.reflection.SecureReflections.getDeclaredFields(SecureReflections.java:111)
>        at org.jboss.weld.introspector.jlr.WeldClassImpl.<init>(WeldClassImpl.java:163)
>        at org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:124)
>        at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:54)
>        at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:42)
>        at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:206)
>        ... 38 more
> Caused by: java.lang.NullPointerException
>        at org.apache.felix.framework.resolver.ResolverImpl.permutateIfNeeded(ResolverImpl.java:1140)
>        at org.apache.felix.framework.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1066)
>        at org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:176)
>        at org.apache.felix.framework.Felix$FelixResolver.resolve(Felix.java:4066)
>        at org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1412)
>        at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:734)
>        at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
>        at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>        at org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)
>        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1604)
>        at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:904)
>        at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$3$1.run(OSGiModuleImpl.java:399)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$3.loadClass(OSGiModuleImpl.java:395)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>        at com.sun.enterprise.v3.server.APIClassLoaderServiceImpl$APIClassLoader.loadClass(APIClassLoaderServiceImpl.java:188)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>        at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1465)
>        at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1368)
>        at java.lang.Class.getDeclaredFields0(Native Method)
>        at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
>        at java.lang.Class.getDeclaredFields(Class.java:1743)
>        at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:116)
>        at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:112)
>        at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
>        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:67)
>        ... 44 more
>
> When comparing GF 3.0.1 b22 with GF 3.1 b40 i noticed that
> beside the latter having jaxb jars removed from modules folder i think
> there are some changes in felix config.properties file. Maybe i need
> to investigate it further...
>
>
> 2. adding  jaxb-osgi-2.2.3-1.jar  to WEB-INF/lib and setting
> class-loader delegate to false does not work either.
>
> SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
> found. For the recent builds to get this working correctly, you need
> even at least JAXB version 2.1.12. Please add it to your classpath!
> SEVERE: The provider class, class
> pl.assetwell.demo.infrastructure.MyJAXBContextResolver, could not be
> instantiated. Processing will continue but the class will not be
> utilized
> java.lang.RuntimeException: NATURAL JSON notation configured, but JAXB
> RI 2.1.10 not found. For the recent builds to get this working
> correctly, you need even at least JAXB version 2.1.12. Please add it
> to your classpath!
>        at com.sun.jersey.api.json.JSONConfiguration.natural(JSONConfiguration.java:447)
>        at pl.assetwell.demo.infrastructure.MyJAXBContextResolver.<init>(MyJAXBContextResolver.java:25)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>
>
> This time i think i know why it can't work:
> I understand that class-loader delegate=false forces application (war)
>  to first load classes itself before delegation to parent (server)
> classloader (PARENT-LAST).
> If my understanding is correct than this approach can not work since
> it is not class within my application is trying to load JAXB RI
> 2.1.12.  According to stacktrace (above) JSONConfiguration tries to
> check if proper version of JAXB is
> present by execution of:
> Class.forName("com.sun.xml.bind.annotation.OverrideAnnotationOf");
>
> Since JSONConfiguration is bundled in jersey-json.jar withing GF
> modules it will use it is own classloader or any other
> parent(server)/OSGI classloader to find  OverrideAnnotationOf class.
> None of these classloaders will have access to application
> classloader. Am i right on this ?
>
> I can imagine i could copy some jersey-jars along with jaxb jars to
> WEB-INF/lib  and then specify class-loader delegate=false  but this is
> not what i would like to do...
>
> I will try to  check it with full GF 3.1 b40 or another/new build.
>
>
> regards
> Jakub Milkiewicz
>
>
> 2011/1/31 Pavel Bucek-2 [via Jersey]
> <[hidden email]>:
>> Hello Jakub,
>>
>> generally - update your java runtime; unfortunately, we currently
>> available jdk versions don't have that recent jaxb version, so ..
>>
>> I guess putting jaxb-api-osgi.jar [1] and jaxb-osgi.jar [2] into
>> glassfish/modules should work that out. Or you can upgrade to full
>> profile, which provides newer jaxb implementation.
>>
>> Or, if you don't want to update your local glassfish installation, you
>> could be able to package jaxb-osgi.jar into war and deploy it with your
>> application; you might need to set classloader delegation to false
>> (sun-web.xml: <class-loader delegate="false"/>).
>>
>> Regards,
>> Pavel
>>
>> [1]
>> http://download.java.net/maven/2/javax/xml/bind/jaxb-api-osgi/2.2.2/jaxb-api-osgi-2.2.2.jar
>> [2]
>> http://download.java.net/maven/2/com/sun/xml/bind/jaxb-osgi/2.2.3-1/jaxb-osgi-2.2.3-1.jar
>>
>> On 01/31/2011 03:45 PM, [hidden email] wrote:
>>> Hi
>>>
>>> I am not sure if this mail should not be sent to glassfish user group
>>> but i hope i can find some help here:
>>>
>>> I am trying to use JSON natural notation
>>>
>>> JAXBContext context = new
>>> JSONJAXBContext(JSONConfiguration.natural().build()...
>>>
>>> The application worked as a charm on GF 3.0.1 but on GF 3.1. b40  web
>>> profile (current the latest one as of yesterday) i got a nasty
>>> exception with following header message:
>>>
>>> SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
>>> found. For the recent builds to get this working correctly, you need
>>> even at least JAXB version 2.1.12. Please add it to your classpath!
>>> SEVERE: The provider class, class foo.bar.MyJAXBContextResolver, could
>>> not be instantiated. Processing will continue but the class will not
>>> be utilized
>>>
>>> Generally ,how to upgrade to JAXB 2.1 provided that JAXB 2 classes are
>>> already bundled within JDK?
>>>
>>>
>>> How to make an upgrade on GF 3.1 which does not have any of JAXB api/
>>> JAXB impl osgified versions at all ( GF 3.0.1 indeed had jaxb-api-osgi
>>> and jaxb-osgi.jar )  ?
>>>
>>> regards Jakub Milkiewicz
>>>
>>>
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://jersey.576304.n2.nabble.com/JSON-natural-on-GF-3-1-b40-tp5977358p5977495.html
>> To start a new topic under Jersey, email
>> [hidden email]
>> To unsubscribe from Jersey, click here.
>
Reply | Threaded
Open this post in threaded view
|

Re: JSON natural on GF 3.1 b40

Pavel Bucek-2
Hello,

ah, my fault, sorry! I should realize sooner that api jar needs to go to endorsed dir.. it's good that you figured it out :)

we don't run tests on web profile because Jersey (or to be more precise, JSR311) is NOT part of web profile, see [1]. Nevertheless Jersey is contained in it because glassfish can't be started without jersey AFAIK (jersey is used in admin console component).. so your current setup with glassfish will work but don't be surprised if you will switch to another javaee6 web profile compliant appserver and something breaks..

Pavel

[1] http://www.oracle.com/technetwork/java/javaee/downloads/javaee6-standards-jsp-141130.html

On 01/31/2011 11:56 PM, jmilkiewicz wrote:
Hi

I managed to run it on full GF 3.1 b40 and everything works.
Next, I have copied jaxb jars you mentioned above to the following
locations (as in GF 3.1 full)
jaxb-api-osgi.jar to modules/endorsed
jaxb-osgi to modules

from now everything works as a charm.

regards

Jakub Milkiewicz

2011/1/31 [hidden email] <[hidden email]>:

> Hi Pavel
>
> Thanks for a fast answer but unfortunately it still does not work.
>
> 1 - adding jaxb-api-osgi-2.2.2.jar and jaxb-osgi-2.2.3-1.jar to GF 3.1
> modules folder
>    blows out glassfish: my application and admin console are not
> deployed/reachable.
> In my log file i can see:
>
> SEVERE: Exception while loading the app : java.lang.RuntimeException:
> java.lang.NullPointerException
> com.google.common.collect.ComputationException:
> java.lang.RuntimeException: java.lang.NullPointerException
>        at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:218)
>        at com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:100)
>        at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:515)
>        at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:183)
>        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:96)
>        at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:133)
>        at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:192)
>        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:364)
>        at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:170)
>        at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
>        at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:262)
>        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
>        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
>        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:354)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:369)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1080)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1260)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1248)
>        at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:453)
>        at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:220)
>        at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
>        at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
>        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
>        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
>        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
>        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
>        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
>        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
>        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
>        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
>        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
>        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
>        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
>        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
>        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
>        at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.RuntimeException: java.lang.NullPointerException
>        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:71)
>        at org.jboss.weld.util.reflection.SecureReflections.getDeclaredFields(SecureReflections.java:111)
>        at org.jboss.weld.introspector.jlr.WeldClassImpl.<init>(WeldClassImpl.java:163)
>        at org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:124)
>        at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:54)
>        at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:42)
>        at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:206)
>        ... 38 more
> Caused by: java.lang.NullPointerException
>        at org.apache.felix.framework.resolver.ResolverImpl.permutateIfNeeded(ResolverImpl.java:1140)
>        at org.apache.felix.framework.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1066)
>        at org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:176)
>        at org.apache.felix.framework.Felix$FelixResolver.resolve(Felix.java:4066)
>        at org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1412)
>        at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:734)
>        at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
>        at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>        at org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)
>        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1604)
>        at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:904)
>        at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$3$1.run(OSGiModuleImpl.java:399)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$3.loadClass(OSGiModuleImpl.java:395)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>        at com.sun.enterprise.v3.server.APIClassLoaderServiceImpl$APIClassLoader.loadClass(APIClassLoaderServiceImpl.java:188)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>        at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1465)
>        at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1368)
>        at java.lang.Class.getDeclaredFields0(Native Method)
>        at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
>        at java.lang.Class.getDeclaredFields(Class.java:1743)
>        at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:116)
>        at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:112)
>        at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
>        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:67)
>        ... 44 more
>
> When comparing GF 3.0.1 b22 with GF 3.1 b40 i noticed that
> beside the latter having jaxb jars removed from modules folder i think
> there are some changes in felix config.properties file. Maybe i need
> to investigate it further...
>
>
> 2. adding  jaxb-osgi-2.2.3-1.jar  to WEB-INF/lib and setting
> class-loader delegate to false does not work either.
>
> SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
> found. For the recent builds to get this working correctly, you need
> even at least JAXB version 2.1.12. Please add it to your classpath!
> SEVERE: The provider class, class
> pl.assetwell.demo.infrastructure.MyJAXBContextResolver, could not be
> instantiated. Processing will continue but the class will not be
> utilized
> java.lang.RuntimeException: NATURAL JSON notation configured, but JAXB
> RI 2.1.10 not found. For the recent builds to get this working
> correctly, you need even at least JAXB version 2.1.12. Please add it
> to your classpath!
>        at com.sun.jersey.api.json.JSONConfiguration.natural(JSONConfiguration.java:447)
>        at pl.assetwell.demo.infrastructure.MyJAXBContextResolver.<init>(MyJAXBContextResolver.java:25)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>
>
> This time i think i know why it can't work:
> I understand that class-loader delegate=false forces application (war)
>  to first load classes itself before delegation to parent (server)
> classloader (PARENT-LAST).
> If my understanding is correct than this approach can not work since
> it is not class within my application is trying to load JAXB RI
> 2.1.12.  According to stacktrace (above) JSONConfiguration tries to
> check if proper version of JAXB is
> present by execution of:
> Class.forName("com.sun.xml.bind.annotation.OverrideAnnotationOf");
>
> Since JSONConfiguration is bundled in jersey-json.jar withing GF
> modules it will use it is own classloader or any other
> parent(server)/OSGI classloader to find  OverrideAnnotationOf class.
> None of these classloaders will have access to application
> classloader. Am i right on this ?
>
> I can imagine i could copy some jersey-jars along with jaxb jars to
> WEB-INF/lib  and then specify class-loader delegate=false  but this is
> not what i would like to do...
>
> I will try to  check it with full GF 3.1 b40 or another/new build.
>
>
> regards
> Jakub Milkiewicz
>
>
> 2011/1/31 Pavel Bucek-2 [via Jersey]
> <[hidden email]>:
>> Hello Jakub,
>>
>> generally - update your java runtime; unfortunately, we currently
>> available jdk versions don't have that recent jaxb version, so ..
>>
>> I guess putting jaxb-api-osgi.jar [1] and jaxb-osgi.jar [2] into
>> glassfish/modules should work that out. Or you can upgrade to full
>> profile, which provides newer jaxb implementation.
>>
>> Or, if you don't want to update your local glassfish installation, you
>> could be able to package jaxb-osgi.jar into war and deploy it with your
>> application; you might need to set classloader delegation to false
>> (sun-web.xml: <class-loader delegate="false"/>).
>>
>> Regards,
>> Pavel
>>
>> [1]
>> http://download.java.net/maven/2/javax/xml/bind/jaxb-api-osgi/2.2.2/jaxb-api-osgi-2.2.2.jar
>> [2]
>> http://download.java.net/maven/2/com/sun/xml/bind/jaxb-osgi/2.2.3-1/jaxb-osgi-2.2.3-1.jar
>>
>> On 01/31/2011 03:45 PM, [hidden email] wrote:
>>> Hi
>>>
>>> I am not sure if this mail should not be sent to glassfish user group
>>> but i hope i can find some help here:
>>>
>>> I am trying to use JSON natural notation
>>>
>>> JAXBContext context = new
>>> JSONJAXBContext(JSONConfiguration.natural().build()...
>>>
>>> The application worked as a charm on GF 3.0.1 but on GF 3.1. b40  web
>>> profile (current the latest one as of yesterday) i got a nasty
>>> exception with following header message:
>>>
>>> SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
>>> found. For the recent builds to get this working correctly, you need
>>> even at least JAXB version 2.1.12. Please add it to your classpath!
>>> SEVERE: The provider class, class foo.bar.MyJAXBContextResolver, could
>>> not be instantiated. Processing will continue but the class will not
>>> be utilized
>>>
>>> Generally ,how to upgrade to JAXB 2.1 provided that JAXB 2 classes are
>>> already bundled within JDK?
>>>
>>>
>>> How to make an upgrade on GF 3.1 which does not have any of JAXB api/
>>> JAXB impl osgified versions at all ( GF 3.0.1 indeed had jaxb-api-osgi
>>> and jaxb-osgi.jar )  ?
>>>
>>> regards Jakub Milkiewicz
>>>
>>>
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://jersey.576304.n2.nabble.com/JSON-natural-on-GF-3-1-b40-tp5977358p5977495.html
>> To start a new topic under Jersey, email
>> [hidden email]
>> To unsubscribe from Jersey, click here.
>


View this message in context: Re: JSON natural on GF 3.1 b40
Sent from the Jersey mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: JSON natural on GF 3.1 b40

jmilkiewicz
Hi Pavel

Figuring it out took me some time but at least it works...
I didn't know that JAX-RS is not part of web profile. It's a big surprise to me.
Thx for an info.

regards
Jakub Milkiewicz


2011/2/1 Pavel Bucek-2 [via Jersey]
<[hidden email]>:

> Hello,
>
> ah, my fault, sorry! I should realize sooner that api jar needs to go to
> endorsed dir.. it's good that you figured it out :)
>
> we don't run tests on web profile because Jersey (or to be more precise,
> JSR311) is NOT part of web profile, see [1]. Nevertheless Jersey is
> contained in it because glassfish can't be started without jersey AFAIK
> (jersey is used in admin console component).. so your current setup with
> glassfish will work but don't be surprised if you will switch to another
> javaee6 web profile compliant appserver and something breaks..
>
> Pavel
>
> [1]
> http://www.oracle.com/technetwork/java/javaee/downloads/javaee6-standards-jsp-141130.html
>
> On 01/31/2011 11:56 PM, jmilkiewicz wrote:
>
> Hi
>
> I managed to run it on full GF 3.1 b40 and everything works.
> Next, I have copied jaxb jars you mentioned above to the following
> locations (as in GF 3.1 full)
> jaxb-api-osgi.jar to modules/endorsed
> jaxb-osgi to modules
>
> from now everything works as a charm.
>
> regards
>
> Jakub Milkiewicz
>
> 2011/1/31 [hidden email] <[hidden email]>:
>> Hi Pavel
>>
>> Thanks for a fast answer but unfortunately it still does not work.
>>
>> 1 - adding jaxb-api-osgi-2.2.2.jar and jaxb-osgi-2.2.3-1.jar to GF 3.1
>> modules folder
>>    blows out glassfish: my application and admin console are not
>> deployed/reachable.
>> In my log file i can see:
>>
>> SEVERE: Exception while loading the app : java.lang.RuntimeException:
>> java.lang.NullPointerException
>> com.google.common.collect.ComputationException:
>> java.lang.RuntimeException: java.lang.NullPointerException
>>        at
>> com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:218)
>>        at
>> com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:100)
>>        at
>> com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:515)
>>        at
>> org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:183)
>>        at
>> org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:96)
>>        at
>> org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:133)
>>        at
>> org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:192)
>>        at
>> org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:364)
>>        at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:170)
>>        at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
>>        at
>> org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:262)
>>        at
>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
>>        at
>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
>>        at
>> org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
>>        at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:354)
>>        at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:369)
>>        at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1080)
>>        at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
>>        at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1260)
>>        at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1248)
>>        at
>> com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:453)
>>        at
>> com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:220)
>>        at
>> com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
>>        at
>> com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
>>        at
>> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
>>        at
>> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
>>        at
>> com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
>>        at
>> com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
>>        at
>> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
>>        at
>> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
>>        at
>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>>        at
>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
>>        at
>> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
>>        at
>> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
>>        at
>> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
>>        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
>>        at
>> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
>>        at
>> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
>>        at java.lang.Thread.run(Thread.java:619)
>> Caused by: java.lang.RuntimeException: java.lang.NullPointerException
>>        at
>> org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:71)
>>        at
>> org.jboss.weld.util.reflection.SecureReflections.getDeclaredFields(SecureReflections.java:111)
>>        at
>> org.jboss.weld.introspector.jlr.WeldClassImpl.<init>(WeldClassImpl.java:163)
>>        at
>> org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:124)
>>        at
>> org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:54)
>>        at
>> org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:42)
>>        at
>> com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:206)
>>        ... 38 more
>> Caused by: java.lang.NullPointerException
>>        at
>> org.apache.felix.framework.resolver.ResolverImpl.permutateIfNeeded(ResolverImpl.java:1140)
>>        at
>> org.apache.felix.framework.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1066)
>>        at
>> org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:176)
>>        at
>> org.apache.felix.framework.Felix$FelixResolver.resolve(Felix.java:4066)
>>        at
>> org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1412)
>>        at
>> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:734)
>>        at
>> org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
>>        at
>> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>        at
>> org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)
>>        at
>> org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1604)
>>        at
>> org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:904)
>>        at
>> org.jvnet.hk2.osgiadapter.OSGiModuleImpl$3$1.run(OSGiModuleImpl.java:399)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at
>> org.jvnet.hk2.osgiadapter.OSGiModuleImpl$3.loadClass(OSGiModuleImpl.java:395)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>        at
>> com.sun.enterprise.v3.server.APIClassLoaderServiceImpl$APIClassLoader.loadClass(APIClassLoaderServiceImpl.java:188)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>        at
>> org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1465)
>>        at
>> org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1368)
>>        at java.lang.Class.getDeclaredFields0(Native Method)
>>        at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
>>        at java.lang.Class.getDeclaredFields(Class.java:1743)
>>        at
>> org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:116)
>>        at
>> org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:112)
>>        at
>> org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
>>        at
>> org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:67)
>>        ... 44 more
>>
>> When comparing GF 3.0.1 b22 with GF 3.1 b40 i noticed that
>> beside the latter having jaxb jars removed from modules folder i think
>> there are some changes in felix config.properties file. Maybe i need
>> to investigate it further...
>>
>>
>> 2. adding  jaxb-osgi-2.2.3-1.jar  to WEB-INF/lib and setting
>> class-loader delegate to false does not work either.
>>
>> SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
>> found. For the recent builds to get this working correctly, you need
>> even at least JAXB version 2.1.12. Please add it to your classpath!
>> SEVERE: The provider class, class
>> pl.assetwell.demo.infrastructure.MyJAXBContextResolver, could not be
>> instantiated. Processing will continue but the class will not be
>> utilized
>> java.lang.RuntimeException: NATURAL JSON notation configured, but JAXB
>> RI 2.1.10 not found. For the recent builds to get this working
>> correctly, you need even at least JAXB version 2.1.12. Please add it
>> to your classpath!
>>        at
>> com.sun.jersey.api.json.JSONConfiguration.natural(JSONConfiguration.java:447)
>>        at
>> pl.assetwell.demo.infrastructure.MyJAXBContextResolver.<init>(MyJAXBContextResolver.java:25)
>>        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> Method)
>>        at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>        at
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>
>>
>> This time i think i know why it can't work:
>> I understand that class-loader delegate=false forces application (war)
>>  to first load classes itself before delegation to parent (server)
>> classloader (PARENT-LAST).
>> If my understanding is correct than this approach can not work since
>> it is not class within my application is trying to load JAXB RI
>> 2.1.12.  According to stacktrace (above) JSONConfiguration tries to
>> check if proper version of JAXB is
>> present by execution of:
>> Class.forName("com.sun.xml.bind.annotation.OverrideAnnotationOf");
>>
>> Since JSONConfiguration is bundled in jersey-json.jar withing GF
>> modules it will use it is own classloader or any other
>> parent(server)/OSGI classloader to find  OverrideAnnotationOf class.
>> None of these classloaders will have access to application
>> classloader. Am i right on this ?
>>
>> I can imagine i could copy some jersey-jars along with jaxb jars to
>> WEB-INF/lib  and then specify class-loader delegate=false  but this is
>> not what i would like to do...
>>
>> I will try to  check it with full GF 3.1 b40 or another/new build.
>>
>>
>> regards
>> Jakub Milkiewicz
>>
>>
>> 2011/1/31 Pavel Bucek-2 [via Jersey]
>> <[hidden email]>:
>>> Hello Jakub,
>>>
>>> generally - update your java runtime; unfortunately, we currently
>>> available jdk versions don't have that recent jaxb version, so ..
>>>
>>> I guess putting jaxb-api-osgi.jar [1] and jaxb-osgi.jar [2] into
>>> glassfish/modules should work that out. Or you can upgrade to full
>>> profile, which provides newer jaxb implementation.
>>>
>>> Or, if you don't want to update your local glassfish installation, you
>>> could be able to package jaxb-osgi.jar into war and deploy it with your
>>> application; you might need to set classloader delegation to false
>>> (sun-web.xml: <class-loader delegate="false"/>).
>>>
>>> Regards,
>>> Pavel
>>>
>>> [1]
>>>
>>> http://download.java.net/maven/2/javax/xml/bind/jaxb-api-osgi/2.2.2/jaxb-api-osgi-2.2.2.jar
>>> [2]
>>>
>>> http://download.java.net/maven/2/com/sun/xml/bind/jaxb-osgi/2.2.3-1/jaxb-osgi-2.2.3-1.jar
>>>
>>> On 01/31/2011 03:45 PM, [hidden email] wrote:
>>>> Hi
>>>>
>>>> I am not sure if this mail should not be sent to glassfish user group
>>>> but i hope i can find some help here:
>>>>
>>>> I am trying to use JSON natural notation
>>>>
>>>> JAXBContext context = new
>>>> JSONJAXBContext(JSONConfiguration.natural().build()...
>>>>
>>>> The application worked as a charm on GF 3.0.1 but on GF 3.1. b40  web
>>>> profile (current the latest one as of yesterday) i got a nasty
>>>> exception with following header message:
>>>>
>>>> SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
>>>> found. For the recent builds to get this working correctly, you need
>>>> even at least JAXB version 2.1.12. Please add it to your classpath!
>>>> SEVERE: The provider class, class foo.bar.MyJAXBContextResolver, could
>>>> not be instantiated. Processing will continue but the class will not
>>>> be utilized
>>>>
>>>> Generally ,how to upgrade to JAXB 2.1 provided that JAXB 2 classes are
>>>> already bundled within JDK?
>>>>
>>>>
>>>> How to make an upgrade on GF 3.1 which does not have any of JAXB api/
>>>> JAXB impl osgified versions at all ( GF 3.0.1 indeed had jaxb-api-osgi
>>>> and jaxb-osgi.jar )  ?
>>>>
>>>> regards Jakub Milkiewicz
>>>>
>>>>
>>>
>>>
>>> ________________________________
>>> If you reply to this email, your message will be added to the discussion
>>> below:
>>>
>>> http://jersey.576304.n2.nabble.com/JSON-natural-on-GF-3-1-b40-tp5977358p5977495.html
>>> To start a new topic under Jersey, email
>>> [hidden email]
>>> To unsubscribe from Jersey, click here.
>>
>
> ________________________________
> View this message in context: Re: JSON natural on GF 3.1 b40
> Sent from the Jersey mailing list archive at Nabble.com.
>
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://jersey.576304.n2.nabble.com/JSON-natural-on-GF-3-1-b40-tp5977358p5980808.html
> To start a new topic under Jersey, email
> [hidden email]
> To unsubscribe from Jersey, click here.
Reply | Threaded
Open this post in threaded view
|

Re: JSON natural on GF 3.1 b40

Paul Sandoz-2
In reply to this post by Pavel Bucek-2

On Feb 1, 2011, at 1:49 PM, Pavel Bucek wrote:

Hello,

ah, my fault, sorry! I should realize sooner that api jar needs to go to endorsed dir.. it's good that you figured it out :)

we don't run tests on web profile because Jersey (or to be more precise, JSR311) is NOT part of web profile, see [1]. Nevertheless Jersey is contained in it because glassfish can't be started without jersey AFAIK (jersey is used in admin console component)..

Although JAX-RS is not included it was always the plan to bundle Jersey with the GF distribution of the EE web profile so developers could use JAX-RS/Jersey.

I suspect most other EE vendors are likely to do the same.

Paul.

so your current setup with glassfish will work but don't be surprised if you will switch to another javaee6 web profile compliant appserver and something breaks..

Pavel

[1] http://www.oracle.com/technetwork/java/javaee/downloads/javaee6-standards-jsp-141130.html

On 01/31/2011 11:56 PM, jmilkiewicz wrote:
Hi

I managed to run it on full GF 3.1 b40 and everything works.
Next, I have copied jaxb jars you mentioned above to the following
locations (as in GF 3.1 full)
jaxb-api-osgi.jar to modules/endorsed
jaxb-osgi to modules

from now everything works as a charm.

regards

Jakub Milkiewicz

2011/1/31 [hidden email] <[hidden email]>:

> Hi Pavel
>
> Thanks for a fast answer but unfortunately it still does not work.
>
> 1 - adding jaxb-api-osgi-2.2.2.jar and jaxb-osgi-2.2.3-1.jar to GF 3.1
> modules folder
>    blows out glassfish: my application and admin console are not
> deployed/reachable.
> In my log file i can see:
>
> SEVERE: Exception while loading the app : java.lang.RuntimeException:
> java.lang.NullPointerException
> com.google.common.collect.ComputationException:
> java.lang.RuntimeException: java.lang.NullPointerException
>        at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:218)
>        at com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:100)
>        at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:515)
>        at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:183)
>        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:96)
>        at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:133)
>        at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:192)
>        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:364)
>        at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:170)
>        at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
>        at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:262)
>        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
>        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
>        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:354)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:369)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1080)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1260)
>        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1248)
>        at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:453)
>        at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:220)
>        at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
>        at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
>        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
>        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
>        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
>        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
>        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
>        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
>        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
>        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
>        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
>        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
>        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
>        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
>        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
>        at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.RuntimeException: java.lang.NullPointerException
>        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:71)
>        at org.jboss.weld.util.reflection.SecureReflections.getDeclaredFields(SecureReflections.java:111)
>        at org.jboss.weld.introspector.jlr.WeldClassImpl.<init>(WeldClassImpl.java:163)
>        at org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:124)
>        at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:54)
>        at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:42)
>        at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:206)
>        ... 38 more
> Caused by: java.lang.NullPointerException
>        at org.apache.felix.framework.resolver.ResolverImpl.permutateIfNeeded(ResolverImpl.java:1140)
>        at org.apache.felix.framework.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1066)
>        at org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:176)
>        at org.apache.felix.framework.Felix$FelixResolver.resolve(Felix.java:4066)
>        at org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1412)
>        at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:734)
>        at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
>        at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>        at org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)
>        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1604)
>        at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:904)
>        at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$3$1.run(OSGiModuleImpl.java:399)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$3.loadClass(OSGiModuleImpl.java:395)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>        at com.sun.enterprise.v3.server.APIClassLoaderServiceImpl$APIClassLoader.loadClass(APIClassLoaderServiceImpl.java:188)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>        at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1465)
>        at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1368)
>        at java.lang.Class.getDeclaredFields0(Native Method)
>        at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
>        at java.lang.Class.getDeclaredFields(Class.java:1743)
>        at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:116)
>        at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:112)
>        at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
>        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:67)
>        ... 44 more
>
> When comparing GF 3.0.1 b22 with GF 3.1 b40 i noticed that
> beside the latter having jaxb jars removed from modules folder i think
> there are some changes in felix config.properties file. Maybe i need
> to investigate it further...
>
>
> 2. adding  jaxb-osgi-2.2.3-1.jar  to WEB-INF/lib and setting
> class-loader delegate to false does not work either.
>
> SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
> found. For the recent builds to get this working correctly, you need
> even at least JAXB version 2.1.12. Please add it to your classpath!
> SEVERE: The provider class, class
> pl.assetwell.demo.infrastructure.MyJAXBContextResolver, could not be
> instantiated. Processing will continue but the class will not be
> utilized
> java.lang.RuntimeException: NATURAL JSON notation configured, but JAXB
> RI 2.1.10 not found. For the recent builds to get this working
> correctly, you need even at least JAXB version 2.1.12. Please add it
> to your classpath!
>        at com.sun.jersey.api.json.JSONConfiguration.natural(JSONConfiguration.java:447)
>        at pl.assetwell.demo.infrastructure.MyJAXBContextResolver.<init>(MyJAXBContextResolver.java:25)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>
>
> This time i think i know why it can't work:
> I understand that class-loader delegate=false forces application (war)
>  to first load classes itself before delegation to parent (server)
> classloader (PARENT-LAST).
> If my understanding is correct than this approach can not work since
> it is not class within my application is trying to load JAXB RI
> 2.1.12.  According to stacktrace (above) JSONConfiguration tries to
> check if proper version of JAXB is
> present by execution of:
> Class.forName("com.sun.xml.bind.annotation.OverrideAnnotationOf");
>
> Since JSONConfiguration is bundled in jersey-json.jar withing GF
> modules it will use it is own classloader or any other
> parent(server)/OSGI classloader to find  OverrideAnnotationOf class.
> None of these classloaders will have access to application
> classloader. Am i right on this ?
>
> I can imagine i could copy some jersey-jars along with jaxb jars to
> WEB-INF/lib  and then specify class-loader delegate=false  but this is
> not what i would like to do...
>
> I will try to  check it with full GF 3.1 b40 or another/new build.
>
>
> regards
> Jakub Milkiewicz
>
>
> 2011/1/31 Pavel Bucek-2 [via Jersey]
> <[hidden email]>:
>> Hello Jakub,
>>
>> generally - update your java runtime; unfortunately, we currently
>> available jdk versions don't have that recent jaxb version, so ..
>>
>> I guess putting jaxb-api-osgi.jar [1] and jaxb-osgi.jar [2] into
>> glassfish/modules should work that out. Or you can upgrade to full
>> profile, which provides newer jaxb implementation.
>>
>> Or, if you don't want to update your local glassfish installation, you
>> could be able to package jaxb-osgi.jar into war and deploy it with your
>> application; you might need to set classloader delegation to false
>> (sun-web.xml: <class-loader delegate="false"/>).
>>
>> Regards,
>> Pavel
>>
>> [1]
>> http://download.java.net/maven/2/javax/xml/bind/jaxb-api-osgi/2.2.2/jaxb-api-osgi-2.2.2.jar
>> [2]
>> http://download.java.net/maven/2/com/sun/xml/bind/jaxb-osgi/2.2.3-1/jaxb-osgi-2.2.3-1.jar
>>
>> On 01/31/2011 03:45 PM, [hidden email] wrote:
>>> Hi
>>>
>>> I am not sure if this mail should not be sent to glassfish user group
>>> but i hope i can find some help here:
>>>
>>> I am trying to use JSON natural notation
>>>
>>> JAXBContext context = new
>>> JSONJAXBContext(JSONConfiguration.natural().build()...
>>>
>>> The application worked as a charm on GF 3.0.1 but on GF 3.1. b40  web
>>> profile (current the latest one as of yesterday) i got a nasty
>>> exception with following header message:
>>>
>>> SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
>>> found. For the recent builds to get this working correctly, you need
>>> even at least JAXB version 2.1.12. Please add it to your classpath!
>>> SEVERE: The provider class, class foo.bar.MyJAXBContextResolver, could
>>> not be instantiated. Processing will continue but the class will not
>>> be utilized
>>>
>>> Generally ,how to upgrade to JAXB 2.1 provided that JAXB 2 classes are
>>> already bundled within JDK?
>>>
>>>
>>> How to make an upgrade on GF 3.1 which does not have any of JAXB api/
>>> JAXB impl osgified versions at all ( GF 3.0.1 indeed had jaxb-api-osgi
>>> and jaxb-osgi.jar )  ?
>>>
>>> regards Jakub Milkiewicz
>>>
>>>
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://jersey.576304.n2.nabble.com/JSON-natural-on-GF-3-1-b40-tp5977358p5977495.html
>> To start a new topic under Jersey, email
>> [hidden email]
>> To unsubscribe from Jersey, click here.
>


View this message in context: Re: JSON natural on GF 3.1 b40
Sent from the Jersey mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: JSON natural on GF 3.1 b40

jmilkiewicz
Hi

Thanks Paul for a reply but I am still at the state of evaluating
various platforms for my new project and at least for the time being i
am more into embracing standards. As my problem shown it is still
safer and less time consuming to  comply with standards than making
any assumption what different vendors provide as extensions.

regards,

Jakub Milkewicz

2011/2/1 Paul Sandoz-2 [via Jersey]
<[hidden email]>:

>
> On Feb 1, 2011, at 1:49 PM, Pavel Bucek wrote:
>
> Hello,
>
> ah, my fault, sorry! I should realize sooner that api jar needs to go to
> endorsed dir.. it's good that you figured it out :)
>
> we don't run tests on web profile because Jersey (or to be more precise,
> JSR311) is NOT part of web profile, see [1]. Nevertheless Jersey is
> contained in it because glassfish can't be started without jersey AFAIK
> (jersey is used in admin console component)..
>
> Although JAX-RS is not included it was always the plan to bundle Jersey with
> the GF distribution of the EE web profile so developers could use
> JAX-RS/Jersey.
> I suspect most other EE vendors are likely to do the same.
> Paul.
>
> so your current setup with glassfish will work but don't be surprised if you
> will switch to another javaee6 web profile compliant appserver and something
> breaks..
>
> Pavel
>
> [1]
> http://www.oracle.com/technetwork/java/javaee/downloads/javaee6-standards-jsp-141130.html
>
> On 01/31/2011 11:56 PM, jmilkiewicz wrote:
>
> Hi
>
> I managed to run it on full GF 3.1 b40 and everything works.
> Next, I have copied jaxb jars you mentioned above to the following
> locations (as in GF 3.1 full)
> jaxb-api-osgi.jar to modules/endorsed
> jaxb-osgi to modules
>
> from now everything works as a charm.
>
> regards
>
> Jakub Milkiewicz
>
> 2011/1/31 [hidden email] <[hidden email]>:
>> Hi Pavel
>>
>> Thanks for a fast answer but unfortunately it still does not work.
>>
>> 1 - adding jaxb-api-osgi-2.2.2.jar and jaxb-osgi-2.2.3-1.jar to GF 3.1
>> modules folder
>>    blows out glassfish: my application and admin console are not
>> deployed/reachable.
>> In my log file i can see:
>>
>> SEVERE: Exception while loading the app : java.lang.RuntimeException:
>> java.lang.NullPointerException
>> com.google.common.collect.ComputationException:
>> java.lang.RuntimeException: java.lang.NullPointerException
>>        at
>> com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:218)
>>        at
>> com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:100)
>>        at
>> com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:515)
>>        at
>> org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:183)
>>        at
>> org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:96)
>>        at
>> org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:133)
>>        at
>> org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:192)
>>        at
>> org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:364)
>>        at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:170)
>>        at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
>>        at
>> org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:262)
>>        at
>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
>>        at
>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
>>        at
>> org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
>>        at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:354)
>>        at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:369)
>>        at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1080)
>>        at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
>>        at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1260)
>>        at
>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1248)
>>        at
>> com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:453)
>>        at
>> com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:220)
>>        at
>> com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
>>        at
>> com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
>>        at
>> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
>>        at
>> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
>>        at
>> com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
>>        at
>> com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
>>        at
>> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
>>        at
>> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
>>        at
>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>>        at
>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
>>        at
>> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
>>        at
>> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
>>        at
>> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
>>        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
>>        at
>> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
>>        at
>> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
>>        at java.lang.Thread.run(Thread.java:619)
>> Caused by: java.lang.RuntimeException: java.lang.NullPointerException
>>        at
>> org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:71)
>>        at
>> org.jboss.weld.util.reflection.SecureReflections.getDeclaredFields(SecureReflections.java:111)
>>        at
>> org.jboss.weld.introspector.jlr.WeldClassImpl.<init>(WeldClassImpl.java:163)
>>        at
>> org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:124)
>>        at
>> org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:54)
>>        at
>> org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:42)
>>        at
>> com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:206)
>>        ... 38 more
>> Caused by: java.lang.NullPointerException
>>        at
>> org.apache.felix.framework.resolver.ResolverImpl.permutateIfNeeded(ResolverImpl.java:1140)
>>        at
>> org.apache.felix.framework.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1066)
>>        at
>> org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:176)
>>        at
>> org.apache.felix.framework.Felix$FelixResolver.resolve(Felix.java:4066)
>>        at
>> org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1412)
>>        at
>> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:734)
>>        at
>> org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
>>        at
>> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>        at
>> org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)
>>        at
>> org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1604)
>>        at
>> org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:904)
>>        at
>> org.jvnet.hk2.osgiadapter.OSGiModuleImpl$3$1.run(OSGiModuleImpl.java:399)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at
>> org.jvnet.hk2.osgiadapter.OSGiModuleImpl$3.loadClass(OSGiModuleImpl.java:395)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>        at
>> com.sun.enterprise.v3.server.APIClassLoaderServiceImpl$APIClassLoader.loadClass(APIClassLoaderServiceImpl.java:188)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>        at
>> org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1465)
>>        at
>> org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1368)
>>        at java.lang.Class.getDeclaredFields0(Native Method)
>>        at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
>>        at java.lang.Class.getDeclaredFields(Class.java:1743)
>>        at
>> org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:116)
>>        at
>> org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:112)
>>        at
>> org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
>>        at
>> org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:67)
>>        ... 44 more
>>
>> When comparing GF 3.0.1 b22 with GF 3.1 b40 i noticed that
>> beside the latter having jaxb jars removed from modules folder i think
>> there are some changes in felix config.properties file. Maybe i need
>> to investigate it further...
>>
>>
>> 2. adding  jaxb-osgi-2.2.3-1.jar  to WEB-INF/lib and setting
>> class-loader delegate to false does not work either.
>>
>> SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
>> found. For the recent builds to get this working correctly, you need
>> even at least JAXB version 2.1.12. Please add it to your classpath!
>> SEVERE: The provider class, class
>> pl.assetwell.demo.infrastructure.MyJAXBContextResolver, could not be
>> instantiated. Processing will continue but the class will not be
>> utilized
>> java.lang.RuntimeException: NATURAL JSON notation configured, but JAXB
>> RI 2.1.10 not found. For the recent builds to get this working
>> correctly, you need even at least JAXB version 2.1.12. Please add it
>> to your classpath!
>>        at
>> com.sun.jersey.api.json.JSONConfiguration.natural(JSONConfiguration.java:447)
>>        at
>> pl.assetwell.demo.infrastructure.MyJAXBContextResolver.<init>(MyJAXBContextResolver.java:25)
>>        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> Method)
>>        at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>        at
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>
>>
>> This time i think i know why it can't work:
>> I understand that class-loader delegate=false forces application (war)
>>  to first load classes itself before delegation to parent (server)
>> classloader (PARENT-LAST).
>> If my understanding is correct than this approach can not work since
>> it is not class within my application is trying to load JAXB RI
>> 2.1.12.  According to stacktrace (above) JSONConfiguration tries to
>> check if proper version of JAXB is
>> present by execution of:
>> Class.forName("com.sun.xml.bind.annotation.OverrideAnnotationOf");
>>
>> Since JSONConfiguration is bundled in jersey-json.jar withing GF
>> modules it will use it is own classloader or any other
>> parent(server)/OSGI classloader to find  OverrideAnnotationOf class.
>> None of these classloaders will have access to application
>> classloader. Am i right on this ?
>>
>> I can imagine i could copy some jersey-jars along with jaxb jars to
>> WEB-INF/lib  and then specify class-loader delegate=false  but this is
>> not what i would like to do...
>>
>> I will try to  check it with full GF 3.1 b40 or another/new build.
>>
>>
>> regards
>> Jakub Milkiewicz
>>
>>
>> 2011/1/31 Pavel Bucek-2 [via Jersey]
>> <[hidden email]>:
>>> Hello Jakub,
>>>
>>> generally - update your java runtime; unfortunately, we currently
>>> available jdk versions don't have that recent jaxb version, so ..
>>>
>>> I guess putting jaxb-api-osgi.jar [1] and jaxb-osgi.jar [2] into
>>> glassfish/modules should work that out. Or you can upgrade to full
>>> profile, which provides newer jaxb implementation.
>>>
>>> Or, if you don't want to update your local glassfish installation, you
>>> could be able to package jaxb-osgi.jar into war and deploy it with your
>>> application; you might need to set classloader delegation to false
>>> (sun-web.xml: <class-loader delegate="false"/>).
>>>
>>> Regards,
>>> Pavel
>>>
>>> [1]
>>>
>>> http://download.java.net/maven/2/javax/xml/bind/jaxb-api-osgi/2.2.2/jaxb-api-osgi-2.2.2.jar
>>> [2]
>>>
>>> http://download.java.net/maven/2/com/sun/xml/bind/jaxb-osgi/2.2.3-1/jaxb-osgi-2.2.3-1.jar
>>>
>>> On 01/31/2011 03:45 PM, [hidden email] wrote:
>>>> Hi
>>>>
>>>> I am not sure if this mail should not be sent to glassfish user group
>>>> but i hope i can find some help here:
>>>>
>>>> I am trying to use JSON natural notation
>>>>
>>>> JAXBContext context = new
>>>> JSONJAXBContext(JSONConfiguration.natural().build()...
>>>>
>>>> The application worked as a charm on GF 3.0.1 but on GF 3.1. b40  web
>>>> profile (current the latest one as of yesterday) i got a nasty
>>>> exception with following header message:
>>>>
>>>> SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not
>>>> found. For the recent builds to get this working correctly, you need
>>>> even at least JAXB version 2.1.12. Please add it to your classpath!
>>>> SEVERE: The provider class, class foo.bar.MyJAXBContextResolver, could
>>>> not be instantiated. Processing will continue but the class will not
>>>> be utilized
>>>>
>>>> Generally ,how to upgrade to JAXB 2.1 provided that JAXB 2 classes are
>>>> already bundled within JDK?
>>>>
>>>>
>>>> How to make an upgrade on GF 3.1 which does not have any of JAXB api/
>>>> JAXB impl osgified versions at all ( GF 3.0.1 indeed had jaxb-api-osgi
>>>> and jaxb-osgi.jar )  ?
>>>>
>>>> regards Jakub Milkiewicz
>>>>
>>>>
>>>
>>>
>>> ________________________________
>>> If you reply to this email, your message will be added to the discussion
>>> below:
>>>
>>> http://jersey.576304.n2.nabble.com/JSON-natural-on-GF-3-1-b40-tp5977358p5977495.html
>>> To start a new topic under Jersey, email
>>> [hidden email]
>>> To unsubscribe from Jersey, click here.
>>
>
> ________________________________
> View this message in context: Re: JSON natural on GF 3.1 b40
> Sent from the Jersey mailing list archive at Nabble.com.
>
>
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://jersey.576304.n2.nabble.com/JSON-natural-on-GF-3-1-b40-tp5977358p5980930.html
> To start a new topic under Jersey, email
> [hidden email]
> To unsubscribe from Jersey, click here.