Topic
  • 7 replies
  • Latest Post - ‏2014-01-11T08:19:42Z by LaraZiosi
LaraZiosi
LaraZiosi
8 Posts

Pinned topic org.apache.wink.client.internal.BaseRequestResponse cannot be resolved

‏2014-01-09T18:02:38Z |

I am trying to use the Apache Wink Client inside a JAX-RS application on Liberty 8.5.5.1, developing with Rational Software Architect for WebSPhere 9.0.0.1.

I get the following error:


The type org.apache.wink.client.internal.BaseRequestResponse cannot be resolved. It is indirectly referenced from required .class files   

when I execute code like:

          ClientConfig clientConfig = new ClientConfig();

            RestClient client = new RestClient(clientConfig);
            Resource res = client.resource("//URL");
            
            ClientResponse response = res.get();
            response.getEntity(JSONObject.class);//error on this line

I checked the file:

C:\IBM\WebSphere\AppServer85\wlp\dev\third-party\com.ibm.websphere.appserver.thirdparty.jaxrs_1.0.1.jar

and indeed it does not contain the org.apache.wink.client.internal package. Is this a defect? What is the best resolution?

 

 

  • LaraZiosi
    LaraZiosi
    8 Posts

    Re: org.apache.wink.client.internal.BaseRequestResponse cannot be resolved

    ‏2014-01-09T19:27:56Z  

    I have been able to circumvent this by placing the following into WebContent\WEB-INF\Lib:

    wink-1.3.0.jar

    wink-1.3.0-client.jar

    wink-1.3.0-server.jar

    slf4j-api-1.6.1.jar

    slf4j-simple-1.6.1.jar

    and changing the classpath to parentLast in server.xml:

        <application id="MyJAX-RSClient" location="MyJAX-RSClient.war"
            name="MyJAX-RSClient" type="war">
            <classloader delegation="parentLast"></classloader>
        </application>

    however I am concerned that this mismatch of jars will give additional problems (possibly I should add *all* the jars contained in the Wink 1.3 lib and dist folders?

    Thank you and regards, Lara

     

  • Alasdair
    Alasdair
    55 Posts

    Re: org.apache.wink.client.internal.BaseRequestResponse cannot be resolved

    ‏2014-01-10T10:51:39Z  
    • LaraZiosi
    • ‏2014-01-09T19:27:56Z

    I have been able to circumvent this by placing the following into WebContent\WEB-INF\Lib:

    wink-1.3.0.jar

    wink-1.3.0-client.jar

    wink-1.3.0-server.jar

    slf4j-api-1.6.1.jar

    slf4j-simple-1.6.1.jar

    and changing the classpath to parentLast in server.xml:

        <application id="MyJAX-RSClient" location="MyJAX-RSClient.war"
            name="MyJAX-RSClient" type="war">
            <classloader delegation="parentLast"></classloader>
        </application>

    however I am concerned that this mismatch of jars will give additional problems (possibly I should add *all* the jars contained in the Wink 1.3 lib and dist folders?

    Thank you and regards, Lara

     

    Hi,

    Given the error you might just need to make those jars available on your classpath for Eclipse. That error typically comes from Eclipse when it wants to see more classes than the javac compiler would need. 

    Your solution should also work. You might not need to set parentLast delegation because Liberty doesn't expose the wink open source classes by default, you have to configure that.

    Thanks
    Alasdair

  • LaraZiosi
    LaraZiosi
    8 Posts

    Re: org.apache.wink.client.internal.BaseRequestResponse cannot be resolved

    ‏2014-01-10T11:13:54Z  
    • Alasdair
    • ‏2014-01-10T10:51:39Z

    Hi,

    Given the error you might just need to make those jars available on your classpath for Eclipse. That error typically comes from Eclipse when it wants to see more classes than the javac compiler would need. 

    Your solution should also work. You might not need to set parentLast delegation because Liberty doesn't expose the wink open source classes by default, you have to configure that.

    Thanks
    Alasdair

    Thank you for your feedback. I removed the parentLast story from server.xml, removed the jars from WebContent\WEB-INF\Lib, and added the same jars to the Eclipse project path. The execution then failed with:

    [ERROR   ] An unhandled exception occurred which will be propagated to the container.
     [ERROR   ] SRVE0777E: Exception thrown by application class 'org.apache.wink.server.internal.RequestProcessor.handleRequest():195'
     javax.servlet.ServletException: java.lang.NoSuchMethodError: org/apache/wink/common/internal/utils/GenericsUtils.getClassType(Ljava/lang/reflect/Type;Ljava/lang/Class;)Ljava/lang/Class;
       at org.apache.wink.server.internal.RequestProcessor.handleRequest(RequestProcessor.java:195)
       at org.apache.wink.server.internal.servlet.RestServlet.service(RestServlet.java:124)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
       at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1235)
       at [internal classes]
    [ERROR   ] SRVE0315E: An execption occurred: com.ibm.ws.webcontainer.webapp.WebAppErrorReport: javax.servlet.ServletException: java.lang.NoSuchMethodError: org/apache/wink/common/internal/utils/GenericsUtils.getClassType&#40;Ljava/lang/reflect/Type&#59;Ljava/lang/Class&#59;&#41;Ljava/lang/Class&#59;

    I have had no problems with running a JAX-RS server application on Liberty, but I think there is a defect concerning running the Wink Client.

    What is most concerning me is that when I started to add the jars one by one, I selected them based on subsequent errors I got at runtime.

    And unfortunately I had to add also the Wink Common and Wink Server jars, which means I am actually replacing the implementation that the JAX-RS server is running with. I do not think any of this should be necessary, or is a safe thing to do, just to run the Client.

    Why have most of the internal packages of Wink been stripped out of the com.ibm.websphere.appserver.thirdparty.jaxrs_1.0.1.jar?

     

     

  • Alasdair
    Alasdair
    55 Posts

    Re: org.apache.wink.client.internal.BaseRequestResponse cannot be resolved

    ‏2014-01-10T13:57:09Z  
    • LaraZiosi
    • ‏2014-01-10T11:13:54Z

    Thank you for your feedback. I removed the parentLast story from server.xml, removed the jars from WebContent\WEB-INF\Lib, and added the same jars to the Eclipse project path. The execution then failed with:

    [ERROR   ] An unhandled exception occurred which will be propagated to the container.
     [ERROR   ] SRVE0777E: Exception thrown by application class 'org.apache.wink.server.internal.RequestProcessor.handleRequest():195'
     javax.servlet.ServletException: java.lang.NoSuchMethodError: org/apache/wink/common/internal/utils/GenericsUtils.getClassType(Ljava/lang/reflect/Type;Ljava/lang/Class;)Ljava/lang/Class;
       at org.apache.wink.server.internal.RequestProcessor.handleRequest(RequestProcessor.java:195)
       at org.apache.wink.server.internal.servlet.RestServlet.service(RestServlet.java:124)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
       at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1235)
       at [internal classes]
    [ERROR   ] SRVE0315E: An execption occurred: com.ibm.ws.webcontainer.webapp.WebAppErrorReport: javax.servlet.ServletException: java.lang.NoSuchMethodError: org/apache/wink/common/internal/utils/GenericsUtils.getClassType&#40;Ljava/lang/reflect/Type&#59;Ljava/lang/Class&#59;&#41;Ljava/lang/Class&#59;

    I have had no problems with running a JAX-RS server application on Liberty, but I think there is a defect concerning running the Wink Client.

    What is most concerning me is that when I started to add the jars one by one, I selected them based on subsequent errors I got at runtime.

    And unfortunately I had to add also the Wink Common and Wink Server jars, which means I am actually replacing the implementation that the JAX-RS server is running with. I do not think any of this should be necessary, or is a safe thing to do, just to run the Client.

    Why have most of the internal packages of Wink been stripped out of the com.ibm.websphere.appserver.thirdparty.jaxrs_1.0.1.jar?

     

     

    Hi,

    Did you configure your application to be able to see the Wink classes? You do this with:

    <application id="MyJAX-RSClient" location="MyJAX-RSClient.war"
            name="MyJAX-RSClient" type="war">
            <classloader apiTypeVisibility="spec, ibm-api, third-party" />
    </application>

    The internal classes are not in that jar because they are in an internal package which by convention indicates that they are not considered part of the externals of Wink.

    Alasdair

  • LaraZiosi
    LaraZiosi
    8 Posts

    Re: org.apache.wink.client.internal.BaseRequestResponse cannot be resolved

    ‏2014-01-10T14:21:43Z  
    • Alasdair
    • ‏2014-01-10T13:57:09Z

    Hi,

    Did you configure your application to be able to see the Wink classes? You do this with:

    <application id="MyJAX-RSClient" location="MyJAX-RSClient.war"
            name="MyJAX-RSClient" type="war">
            <classloader apiTypeVisibility="spec, ibm-api, third-party" />
    </application>

    The internal classes are not in that jar because they are in an internal package which by convention indicates that they are not considered part of the externals of Wink.

    Alasdair

    Thank you, but now I am confused. I added the classloader as you indicated and now I get the runtime error:

    WebSphere Application Server
    SRVE0777E: Exception thrown by application class 'org.apache.wink.server.internal.RequestProcessor.handleRequest():195'

    javax.servlet.ServletException: java.lang.NoClassDefFoundError: org.apache.wink.client.ClientConfig
    at org.apache.wink.server.internal.RequestProcessor.handleRequest(RequestProcessor.java:195)
    at org.apache.wink.server.internal.servlet.RestServlet.service(RestServlet.java:124)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1235)

    (note that I still have those extra jars on the Eclipse classpath).

    I removed all the jars from the Eclipse classpath and I forced publishing by checking the option:

    Window>Preferences > Server > Allow applications containing errors to be published to a server

    Then I removed and re-added the application, and I reconfigured the third-party in the classloader.

    Now I just get

    500

    Internal Server Error

     

    in the Chrome developer tools

    and no stack trace on the server console.

     

     

  • AlexMulholland
    AlexMulholland
    32 Posts

    Re: org.apache.wink.client.internal.BaseRequestResponse cannot be resolved

    ‏2014-01-10T21:44:15Z  
    • LaraZiosi
    • ‏2014-01-10T14:21:43Z

    Thank you, but now I am confused. I added the classloader as you indicated and now I get the runtime error:

    WebSphere Application Server
    SRVE0777E: Exception thrown by application class 'org.apache.wink.server.internal.RequestProcessor.handleRequest():195'

    javax.servlet.ServletException: java.lang.NoClassDefFoundError: org.apache.wink.client.ClientConfig
    at org.apache.wink.server.internal.RequestProcessor.handleRequest(RequestProcessor.java:195)
    at org.apache.wink.server.internal.servlet.RestServlet.service(RestServlet.java:124)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1235)

    (note that I still have those extra jars on the Eclipse classpath).

    I removed all the jars from the Eclipse classpath and I forced publishing by checking the option:

    Window>Preferences > Server > Allow applications containing errors to be published to a server

    Then I removed and re-added the application, and I reconfigured the third-party in the classloader.

    Now I just get

    500

    Internal Server Error

     

    in the Chrome developer tools

    and no stack trace on the server console.

     

     

    Hi Lara,

    Your first post says you are using Liberty 8.5.5.1 but the version of the jaxrs API jar that you mention (com.ibm.websphere.appserver.thirdparty.jaxrs_1.0.1.jar) is actually from the 8.5.0.2 level of liberty.  

    The good news is that visibility to the wink internals packages is resolved in the 8.5.5.x version of liberty, so if you move to that you should get your application working without needing to package wink yourself (just use the class loader configuration that Alasdair posted above: <classloader apiTypeVisibility="spec, ibm-api, third-party" />).

    I suspect the reason that you have the 8.5.0.2 level of liberty when you believe it is 8.5.5.1 may be a result of using Installation Manager (IM) - is that correct?  In WAS 8.5.5.0 we separated the IM installations of the full and liberty profiles so they now install into separate locations.  If you upgraded an existing WAS 8.5.0.x installation using IM then it will have updated the full profile to 8.5.5.1 but the liberty profile will have been left at 8.5.0.2.  You now need to install the liberty profile separately using IM or the liberty archive in order to get the 8.5.5.1 version.  I'm sorry this is an inconvenience.

    I hope this solves your problem

    Regards, Alex.

  • LaraZiosi
    LaraZiosi
    8 Posts

    Re: org.apache.wink.client.internal.BaseRequestResponse cannot be resolved

    ‏2014-01-11T08:19:42Z  

    Hi Lara,

    Your first post says you are using Liberty 8.5.5.1 but the version of the jaxrs API jar that you mention (com.ibm.websphere.appserver.thirdparty.jaxrs_1.0.1.jar) is actually from the 8.5.0.2 level of liberty.  

    The good news is that visibility to the wink internals packages is resolved in the 8.5.5.x version of liberty, so if you move to that you should get your application working without needing to package wink yourself (just use the class loader configuration that Alasdair posted above: <classloader apiTypeVisibility="spec, ibm-api, third-party" />).

    I suspect the reason that you have the 8.5.0.2 level of liberty when you believe it is 8.5.5.1 may be a result of using Installation Manager (IM) - is that correct?  In WAS 8.5.5.0 we separated the IM installations of the full and liberty profiles so they now install into separate locations.  If you upgraded an existing WAS 8.5.0.x installation using IM then it will have updated the full profile to 8.5.5.1 but the liberty profile will have been left at 8.5.0.2.  You now need to install the liberty profile separately using IM or the liberty archive in order to get the 8.5.5.1 version.  I'm sorry this is an inconvenience.

    I hope this solves your problem

    Regards, Alex.

    Hi Alex,

    You nailed it. I installed a new instance of Liberty 8.5.5.1 with Installation Manager in a separate location.

    After I changed the Targeted Runtime of my project to the new Liberty, the compilation error was removed.

    When I published to the new server using the classloader including the third-party dependency, the application ran correctly.

    Thank you all for your help solving this!

    Lara