Issue Details (XML | Word | Printable)

Key: GLASSFISH-18813
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jakub Podlesak
Reporter: sherryshen
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

JAXBRI of GET failure with Default JAXBContext

Created: 19/Jun/12 06:28 PM   Updated: 04/Aug/12 06:53 PM   Resolved: 04/Aug/12 06:53 PM
Component/s: jax-rs
Affects Version/s: None
Fix Version/s: 4.0_b49

Time Tracking:
Not Specified

File Attachments: 1. File jaxrs3-jaxbri.war (15 kB) 26/Jul/12 03:31 PM - Jakub Podlesak
2. Zip Archive (35 kB) 26/Jul/12 04:11 AM - sherryshen
3. Zip Archive (3.56 MB) 26/Jul/12 03:30 PM - Jakub Podlesak
4. XML File web.xml (0.8 kB) 26/Jul/12 03:30 PM - Jakub Podlesak


RHL5, JDK1.6.0_30

Issue Links:

Tags: 40-regression
Participants: Jakub Podlesak and sherryshen

 Description  « Hide

JAXBRI of GET failure with Default JAXBContext

After modifying class in web.xml
! <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>

to resolve deploy error in

the next error is http://localhost:8080/jaxrs3-jaxbri/rest/customers/1

The same tests passed on

sherryshen added a comment - 04/Aug/12 06:53 PM

sqe tests of jaxrs3 passed on

sherryshen added a comment - 26/Jul/12 08:28 PM - edited

Thank Jakub for the patch and suggested test change.
With patch and test change on,
GET is OK now, but PUT and POST still have issue in the jaxrs3 test suite.
I filed GLASSFISH-18951 to track the remaining failure,

Jakub Podlesak added a comment - 26/Jul/12 03:31 PM

updated web app (web.xml descriptor changed to become JAX-RS implementation agnostic)

Jakub Podlesak added a comment - 26/Jul/12 03:30 PM

Updated web.xml and latest snapshot jersey modules

Jakub Podlesak added a comment - 26/Jul/12 03:28 PM

Just for my record: a slightly updated create jdbc pool command, so that the db gets automatically created:

./bin/asadmin create-jdbc-connection-pool --datasourceclassname org.apache.derby.jdbc.ClientDataSource --restype javax.sql.DataSource --property User=dbuser:Password=dbpassword:dataBaseName=testdb:serverName=localhost:portNumber=1527:connectionAttributes=create
=true:retrieveMessagesFromServerOnGetMessage=true pooljaxrs3

I suggest to update the web.xml descriptor like follows, so that we get rid of Jersey specific stuff:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns=""

After the above is changed, the application works for me just fine with the latest Jersey bits (going to attach corresponding zip archive).
We need to cut another intermediary Jersey release and integrate to GF to fix this.

sherryshen added a comment - 26/Jul/12 04:17 AM - edited

After discussing with Jakub, I ran test app with script in sqe env.

The main steps from console output:
1) setup app with script
$ cd $SPS_HOME/pe/ejb/moxy/jaxrs3
$ asadmin create-jdbc-connection-pool --datasourceclassname org.apache.derby.jdbc.ClientDataSource --restype javax.sql.DataSource --property User=dbuser:Password=dbpassword:dataBaseName=testdb:serverName=localhost:portNumber=1527:create=true:retrieveMessagesFromServerOnGetMessage=true pooljaxrs3
$ asadmin create-jdbc-resource --connectionpoolid pooljaxrs3 jdbc/jaxrs
$ asadmin deploy jaxrs3-jaxbri.war

If you use your own database, please adjust db info accordingly, e.g.
The war file is in the attachment of this bug,

2) access app
For accessing app, you can use a browser.
2.1) insert customer data to database from jpa
$ lynx -dump 'http://localhost:8080/jaxrs3-jaxbri/data?tc=initData'

2.2) find customer data from jaxrs
$ lynx -dump http://localhost:8080/jaxrs3-jaxbri/rest/customers/1
HTTP Status 404 - Not Found

Test failed.

2.3) find customer data from jpa query
$ lynx -dump 'http://localhost:8080/jaxrs3-jaxbri/data?tc=queryById'

3) unsetup app
$ asadmin undeploy jaxrs3-jaxbri
$ asadmin delete-jdbc-resource jdbc/jaxrs
$ asadmin delete-jdbc-connection-pool pooljaxrs3

sherryshen added a comment - 26/Jul/12 04:11 AM

Test war and source used on,
which is promoted on 25-Jul-2012. Tests still failed.

Jakub Podlesak added a comment - 25/Jul/12 04:21 PM

Jersey 2.0 EJB support was integrated with the following change into the GF main trunk:
r55115 | jwells | 2012-07-15 00:23:40 +0200 (Sun, 15 Jul 2012) | 1 line

Put Hk2 2.0 into GlassFish trunk

sherryshen added a comment - 25/Jun/12 09:34 PM

The analysis from Jakub:

The test application utilizes EJB/JAX-RS integration. This area has not been
covered yet in the Jersey 2.0 implementation. We plan to spend some cycles on this
in the current sprint (ends up on July 30th). Corresponding JIRA record is available at

sherryshen added a comment - 19/Jun/12 06:29 PM - edited

To reproduce the problem:
Please see core test instruction section I, and II a for das tests in
--use co-ejb instead of co-core to check out source for ejb module, e.g.

% cvs co appserver-sqe/bootstrap.xml
% cd $SPS_HOME
% ant -f bootstrap.xml co-ejb
% ant start-domain
% ant startDerby
% cd $SPS_HOME/pe/ejb/moxy/jaxrs3
% ant setup build deploy run

Then see ex in client output:

[java] ***urlString=http://localhost:8080/jaxrs3-jaxbri/rest/customers/1
[java] http://localhost:8080/jaxrs3-jaxbri/rest/customers/1
[java] at
[java] at org.example.WebTest.testGet(
[java] at org.example.WebTest.doTest(
[java] at org.example.WebTest.main(
[java] Got Ex

The client code about ex:

     public void doTest() {    
        // ...
       JAXBContext  jc = JAXBContext.newInstance(Customer.class);
       testGet();           // READ operation: GET
       // ...

    private void testGet() throws Exception {
        //  ....
        try {
          HttpURLConnection  conn = (HttpURLConnection)(new URL(urlString)).openConnection();
          conn.setRequestProperty("Accept", "application/xml");
          InputStream xml = conn.getInputStream();   // ex

The test description: