Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-17069

[GSS](7.2.z) JBEE-204 - ClassNotFoundException over org.glassfish.jersey.client.JerseyClientBuilder when sec-mgr is enabled

XMLWordPrintable

    • +
    • Hide

      The only workaround is giving explicit access to the resteasy jars:

      <permission class="java.io.FilePermission" name="/opt/jboss/jboss-eap-7.2/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.2.1.CP/org/jboss/resteasy/resteasy-jaxrs/main/*" actions="read" />
      
      Show
      The only workaround is giving explicit access to the resteasy jars: <permission class="java.io.FilePermission" name="/opt/jboss/jboss-eap-7.2/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.2.1.CP/org/jboss/resteasy/resteasy-jaxrs/main/*" actions="read" />
    • Hide

      1. Create a client inside a simple servlet or application:

      ClientBuilder.newBuilder()
                      .build()
                      .target("http://localhost:8080")
                      .request(MediaType.TEXT_HTML)
                      .get()
                      .readEntity(String.class);
      

      2. Configure the security manager in the standalone.xml to permit the connection to localhost:

              <subsystem xmlns="urn:jboss:domain:security-manager:1.0">
                  <deployment-permissions>
                      <minimum-set>
                          <permission class="java.lang.RuntimePermission" name="accessDeclaredMembers"/>
                          <permission class="java.net.SocketPermission" name="*" actions="connect, resolve"/>
                      </minimum-set>
                  </deployment-permissions>
              </subsystem>
      

      3. Execute the EAP using the security manager:

      ./standalone.sh -secmgr
      

      4. Launch the client and check the problem with the exception.

      Show
      1. Create a client inside a simple servlet or application: ClientBuilder.newBuilder() .build() .target( "http: //localhost:8080" ) .request(MediaType.TEXT_HTML) .get() .readEntity( String .class); 2. Configure the security manager in the standalone.xml to permit the connection to localhost: <subsystem xmlns="urn:jboss:domain:security-manager:1.0"> <deployment-permissions> <minimum-set> <permission class="java.lang.RuntimePermission" name="accessDeclaredMembers"/> <permission class="java.net.SocketPermission" name="*" actions="connect, resolve"/> </minimum-set> </deployment-permissions> </subsystem> 3. Execute the EAP using the security manager: ./standalone.sh -secmgr 4. Launch the client and check the problem with the exception.

      When the security manager is enabled the resteasy client initialization fails with the following exception:

      ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /resteasy/SampleServlet: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientBuilder from [Module "javax.ws.rs.api" version 1.0.1.Final-redhat-00001 from local module loader @69d9c55 (finder: local module finder @13a57a3b (roots: /opt/jboss/jboss-eap-7.2/modules,/opt/jboss/jboss-eap-7.2/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.2.1.CP,/opt/jboss/jboss-eap-7.2/modules/system/layers/base))]
      	at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:132)
      	at com.redhat.sample.SampleServlet.processRequest(SampleServlet.java:29)
      	at com.redhat.sample.SampleServlet.doGet(SampleServlet.java:48)
              ...
      Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientBuilder from [Module "javax.ws.rs.api" version 1.0.1.Final-redhat-00001 from local module loader @69d9c55 (finder: local module finder @13a57a3b (roots: /opt/jboss/jboss-eap-7.2/modules,/opt/jboss/jboss-eap-7.2/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.2.1.CP,/opt/jboss/jboss-eap-7.2/modules/system/layers/base))]
      	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
      	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
      	at java.lang.Class.forName0(Native Method)
      	at java.lang.Class.forName(Class.java:264)
      	at javax.ws.rs.client.FactoryFinder.newInstance(FactoryFinder.java:120)
      	at javax.ws.rs.client.FactoryFinder.find(FactoryFinder.java:227)
      	at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:96)
      	... 52 more
      

      It seems that the issue is that the internal resteasy class is not found and the default org.glassfish.jersey.client.JerseyClientBuilder is tried but fails.

              rhn-support-asoldano Alessio Soldano
              rhn-support-rmartinc Ricardo Martin Camarero
              Daniel Cihak Daniel Cihak
              Daniel Cihak Daniel Cihak
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: