[GLASSFISH-13236] [jersey] Jersey bundles optionally depend mandatory packages Created: 02/Sep/10  Updated: 08/Feb/13  Resolved: 08/Feb/13

Status: Resolved
Project: glassfish
Component/s: jax-rs
Affects Version/s: 3.1
Fix Version/s: 4.0_b67_ms7

Type: Bug Priority: Major
Reporter: Sanjeeb Sahoo Assignee: Jakub Podlesak
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Attachments: Text File config.properties.nojaxb    
Issue Links:
Dependency
blocks GLASSFISH-11780 Specify bundle metadata corretcly. Open
blocks JERSEY-660 NPE in com.sun.jersey.core.impl.provi... Closed
blocks GLASSFISH-16518 Jersey: Allow regular users to run di... Open
Issuezilla Id: 13,236
Tags: 3_1-exclude, 3_1-next, 3_1_1-scrubbed, 3_2prd

 Description   

I see code like this jersey-json bundle:
./1.4-ea05/src/main/java/com/sun/jersey/json/impl/reader/Jackson2StaxReader.java

import com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext;

public int getAttributeCount() {

final UnmarshallingContext uctx =
UnmarshallingContext.getInstance();
...

Yet, this bundle has optionally import com.sun.xml.bind.v2.runtime.unmarshaller
package as shown below:

Import-Package =
com.sun.jersey.api.json,com.sun.jersey.core.provider,com.sun.jersey.core.provider.jaxb,com.sun.jersey.core.util,com.sun.jersey.json.impl,com.sun.jersey.json.impl.provider.entity,com.sun.jersey.json.impl.reader,com.sun.jersey.json.impl.writer,com.sun.jersey.localization,com.sun.jersey.spi,com.sun.xml.bind.annotation;resolution:=optional,com.sun.xml.bind.v2.model.core;resolution:=optional,com.sun.xml.bind.v2.model.runtime;resolution:=optional,com.sun.xml.bind.v2.runtime;resolution:=optional,com.sun.xml.bind.v2.runtime.property;resolution:=optional,com.sun.xml.bind.v2.runtime.unmarshaller;resolution:=optional,javax.ws.rs,javax.ws.rs.core,javax.ws.rs.ext,javax.xml.bind,javax.xml.bind.annotation,javax.xml.bind.annotation.adapters,javax.xml.bind.attachment,javax.xml.namespace,javax.xml.stream,javax.xml.transform,javax.xml.validation,org.codehaus.jackson;version="1.5",org.codehaus.jackson.jaxrs;version="1.5",org.codehaus.jackson.map;version="1.5",org.codehaus.jackson.type;version="1.5",org.codehaus.jettison.badgerfish;version="1.1",org.codehaus.jettison.json;version="1.1",org.codehaus.jettison.mapped;version="1.1",org.w3c.dom,org.xml.sax

How can this class load in the absence of such a package?

This is causing OSGi class loader constraint violation when we add jaxb packages
to system bundle.

Pl. note this is a P2, as other P2 bug depends on this.
Sahoo



 Comments   
Comment by Sanjeeb Sahoo [ 02/Sep/10 ]

Updated dependency

Comment by Sanjeeb Sahoo [ 03/Sep/10 ]

The instructions to reproduce is like this:
You need GlassFish svn rev 40358 at least.
Copy the attached config.properties.nojaxb to glassfish/osgi/felix/conf/
java -jar glassfish.jar

From another terminal:
telnet localhost 6666
ss141213@Sahoo:/space/ss141213/WS/hk2/trunk$ telnet localhost 6666
Felix Remote Shell Console:
============================

-> find jersey-json
START LEVEL 1
ID State Level Name
[ 74] [Installed ] [ 1] jersey-json (1.4.0.ea06)
-> start 74
org.osgi.framework.BundleException: Constraint violation for package
'javax.xml.bind.annotation' when resolving module 74.0 between existing import
0.javax.xml.bind.annotation BLAMED ON [[74.0] package;
(package=javax.xml.bind.annotation)] and uses constraint
226.0.javax.xml.bind.annotation BLAMED ON [[74.0] package;
(package=com.sun.xml.bind.v2.runtime.property), [172.0] package;
(&(package=javax.xml.bind.annotation)(version>=2.2.1))]
->

Comment by Sanjeeb Sahoo [ 03/Sep/10 ]

Created an attachment (id=4796)
Felix config file compatible with GlassFish svn rev 40358

Comment by ludo [ 27/Sep/10 ]

Status? or M6 target?

Need a resolution to advance some internal work with Eclipse embedded server

Comment by Sanjeeb Sahoo [ 27/Sep/10 ]

We need this by 3.1_ms06, else we will be forced to repackage jersey bundles
with our own OSGi metadata in GlassFish.

Comment by Jakub Podlesak [ 07/Oct/10 ]

Sahoo, please go ahead with GlassFish specific OSGi headers as you suggested
in the above post. We won't be able to fix this in the current (GFv3.1) release.

I am also lowering priority of the bug to p4, and setting the 3.1-exclude keyword.

Comment by Jakub Podlesak [ 07/Oct/10 ]

removed 3.1-exclude keyword

Comment by Sanjeeb Sahoo [ 07/Oct/10 ]

No, it is not a p4. I am taking ownership of the bug so that I can repackage
jersey bundles to fix the OSGi metadata. It is hard to understand why Jersey
team took so long to come to the conclusion that they won't correct their
metadata in gf3.1.

Comment by Sanjeeb Sahoo [ 07/Oct/10 ]

taking ownership of the bug

Comment by Jakub Podlesak [ 12/Oct/10 ]

Just to clarify my comment from Thu Oct 7 17:10:09 +0000 2010:
re-packaging Jersey bundles itself within GlassFish workspace is not the way to go
as it would mean great impact on QA/bug-fixing process

Comment by ludo [ 12/Oct/10 ]

So what is the recommended suggestion for a fix in 3.1 product which is the most important release for
our entire group?
Sahoo to commit in Jersey?
Sahoo to provide a patch to Jersey for you to try?
What else?

Comment by Marek Potociar [ 13/Oct/10 ]

Moving to proper? component

Comment by Martin Matula [ 15/Oct/10 ]

Ludo> The way to go is fixing it properly. That we consider being too risky for 3.1, so we want to defer this

  • which will allow us to address other issues we consider being more important. Maybe if we could
    understand what practical benefits this fix brings for our end users and why it is so important for GF 3.1 as
    opposed to fixing other issues in our queue it would help us to prioritize better.
Comment by Chris Kasso [ 27/Oct/10 ]

Changed Target milestone back to not determined. MS6 has sailed.

Comment by Sanjeeb Sahoo [ 14/Dec/10 ]

needs to be fixed by jersey team

Comment by Martin Matula [ 16/Dec/10 ]

Agree with Sahoo. But not for 3.1.

Comment by scatari [ 23/Jun/11 ]

Marking this to be considered for next release. Does not affect the functionality of the release 3.1.1.

Comment by Jakub Podlesak [ 08/Feb/13 ]

This has been fixed be breaking jersey json support down into several modules. Two of them are being bundled with GF:

./bin/asadmin osgi lb jersey
START LEVEL 2
ID|State |Level|Name
164|Resolved | 1|jersey-core-client (2.0.0.m10)
165|Resolved | 1|jersey-core-common (2.0.0.m10)
166|Resolved | 1|jersey-container-grizzly2-http (2.0.0.m10)
167|Installed | 1|jersey-container-servlet-core (2.0.0.m10)
168|Installed | 1|jersey-container-servlet (2.0.0.m10)
169|Resolved | 1|jersey-gf-ejb (2.0.0.m10)
170|Resolved | 1|jersey-media-json-jackson (2.0.0.m10)
171|Resolved | 1|jersey-media-json-jettison (2.0.0.m10)
172|Installed | 1|jersey-media-moxy (2.0.0.m10)
173|Resolved | 1|jersey-media-multipart (2.0.0.m10)
174|Resolved | 1|jersey-media-sse (2.0.0.m10)
175|Resolved | 1|jersey-core-server (2.0.0.m10)

./bin/asadmin osgi start 170 171
Command osgi executed successfully.

./bin/asadmin osgi lb jersey
START LEVEL 2
ID|State |Level|Name
164|Resolved | 1|jersey-core-client (2.0.0.m10)
165|Resolved | 1|jersey-core-common (2.0.0.m10)
166|Resolved | 1|jersey-container-grizzly2-http (2.0.0.m10)
167|Installed | 1|jersey-container-servlet-core (2.0.0.m10)
168|Installed | 1|jersey-container-servlet (2.0.0.m10)
169|Resolved | 1|jersey-gf-ejb (2.0.0.m10)
170|Active | 1|jersey-media-json-jackson (2.0.0.m10)
171|Active | 1|jersey-media-json-jettison (2.0.0.m10)
172|Installed | 1|jersey-media-moxy (2.0.0.m10)
173|Resolved | 1|jersey-media-multipart (2.0.0.m10)
174|Resolved | 1|jersey-media-sse (2.0.0.m10)
175|Resolved | 1|jersey-core-server (2.0.0.m10)

Generated at Sat Dec 03 18:22:15 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.