glassfish
  1. glassfish
  2. GLASSFISH-18813

JAXBRI of GET failure with Default JAXBContext

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0_b49
    • Component/s: jax-rs
    • Labels:
      None
    • Environment:

      RHL5, JDK1.6.0_30

      Description

      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

      1. web.xml
        0.8 kB
        Jakub Podlesak

        Issue Links

          Activity

          Hide
          sherryshen added a comment - - 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

          Show
          sherryshen added a comment - - 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
          Hide
          sherryshen added a comment -

          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

          Show
          sherryshen added a comment - 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
          Hide
          Jakub Podlesak added a comment -

          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
          ------------------------------------------------------------------------

          Show
          Jakub Podlesak added a comment - 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 ------------------------------------------------------------------------
          Hide
          sherryshen added a comment -

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

          Show
          sherryshen added a comment - Test war and source used on glassfish-4.0-b47.zip, which is promoted on 25-Jul-2012. Tests still failed.
          Hide
          sherryshen added a comment - - 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

          Show
          sherryshen added a comment - - 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
          Hide
          Jakub Podlesak added a comment -

          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.

          Show
          Jakub Podlesak added a comment - 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.
          Hide
          Jakub Podlesak added a comment -

          Updated web.xml and latest snapshot jersey modules

          Show
          Jakub Podlesak added a comment - Updated web.xml and latest snapshot jersey modules
          Hide
          Jakub Podlesak added a comment -

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

          Show
          Jakub Podlesak added a comment - updated web app (web.xml descriptor changed to become JAX-RS implementation agnostic)
          Hide
          sherryshen added a comment - - 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,

          Show
          sherryshen added a comment - - 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,
          Hide
          sherryshen added a comment -

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

          Show
          sherryshen added a comment - sqe tests of jaxrs3 passed on glassfish-4.0-b49-08_04_2012.zip.

            People

            • Assignee:
              Jakub Podlesak
              Reporter:
              sherryshen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: