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
Operations

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

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 jaxrs3.zip (35 kB) 26/Jul/12 04:11 AM - sherryshen
3. Zip Archive jersey-gfv4_0-core-2.0-SNAPSHOT-project.zip (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

Environment:

RHL5, JDK1.6.0_30

Issue Links:
Dependency
 

Tags: 40-regression
Participants: Jakub Podlesak and sherryshen


 Description  « Hide

JAXBRI of GET failure with Default JAXBContext

glassfish-4.0-b42-06-18-2012.zip

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

to resolve deploy error in
http://java.net/jira/browse/GLASSFISH-18811

the next error is
java.io.FileNotFoundException: http://localhost:8080/jaxrs3-jaxbri/rest/customers/1

The same tests passed on glassfish-4.0-b41.zip



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

sqe tests of jaxrs3 passed on glassfish-4.0-b49-08_04_2012.zip.


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 glassfish-4.0-b47.zip,
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="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<servlet>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<persistence-context-ref>
<persistence-context-ref-name>persistence/em</persistence-context-ref-name>
<persistence-unit-name>CustomerService</persistence-unit-name>
</persistence-context-ref>
</web-app>

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.
http://bigapp-oblade-10.us.oracle.com:1080/job/sherry-core-das/24/artifact/server_das.log
http://bigapp-oblade-10.us.oracle.com:1080/job/sherry-core-das/24/artifact/cli.log
http://bigapp-oblade-10.us.oracle.com:1080/job/sherry-core-das/24/console

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.
User=dbuser:Password=dbpassword:dataBaseName=testdb:
The war file is in the attachment of this bug, jaxrs3.zip.

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'
initData:pass

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'
queryById:pass

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 glassfish-4.0-b47.zip,
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
http://java.net/jira/browse/JERSEY-1025


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
http://aseng-wiki.us.oracle.com/asengwiki/display/ASQA/4.0+Core+Test+Instructions
--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] java.io.FileNotFoundException: http://localhost:8080/jaxrs3-jaxbri/rest/customers/1
[java] at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1434)
[java] at org.example.WebTest.testGet(WebTest.java:116)
[java] at org.example.WebTest.doTest(WebTest.java:53)
[java] at org.example.WebTest.main(WebTest.java:37)
[java] Got Ex

The client code about ex:
appserver-sqe/pe/ejb/moxy/jaxrs3/src/test/WebTest.java

     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.setRequestMethod("GET");
          conn.setRequestProperty("Accept", "application/xml");
          InputStream xml = conn.getInputStream();   // ex

The test description:
jaxrs3(-jaxbri):
JAXBRI of GET/PUT/POST/DELETE with Default JAXBContext