title: Unable to open resource URI while running simple RESTFUL API using JAX-RS
body: <p>I am using netbeans IDE and GlasssFish server to run simple RESTFUL web application.
  <em>Version Details : Apache NetBeans IDE 14 , Java 11, GlassFish Server 6.2.1</em>
  Process I did followed</p>
  <ol>
  <li>right click on project</li>
  <li>click on run(it will build and deploy project on server)</li>
  <li>right click on right-click on the appropriate HTTP methods, as shown in the following screenshot, and select Test Resource Uri.</li>
  </ol>
  <p>This is the error I am getting:</p>
  <p><a href="https://i.stack.imgur.com/7zvJY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7zvJY.png" alt="ResourceURLerror" /></a></p>
  <p>Glassfish Server Logs:</p>
  <pre><code>Launching GlassFish on Felix platform
  INFO: Create bundle provisioner class = class com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner.
  Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime@1d0b497e in service registry.
  #!## LogManagerService.postConstruct : rootFolder=C:\Users\Pradeep\GlassFish_Server\glassfish
  #!## LogManagerService.postConstruct : templateDir=C:\Users\Pradeep\GlassFish_Server\glassfish\lib\templates
  #!## LogManagerService.postConstruct : src=C:\Users\Pradeep\GlassFish_Server\glassfish\lib\templates\logging.properties
  #!## LogManagerService.postConstruct : dest=C:\Users\Pradeep\GlassFish_Server\glassfish\domains\domain1\config\logging.properties
    Running GlassFish Version: Eclipse GlassFish  6.2.1  (build master-b569-gad91414 2021-08-26T23:45:22+0000)|#]
    Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter|#]
    Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.|#]
    Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.|#]
    Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.|#]
    Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry|#]
    Authorization Service has successfully initialized.|#]
    Grizzly Framework 3.0.0 started in: 163ms - bound to [/0.0.0.0:8080]|#]
    visiting unvisited references|#]
    Grizzly Framework 3.0.0 started in: 105ms - bound to [/0.0.0.0:8181]|#]
    Grizzly Framework 3.0.0 started in: 81ms - bound to [/0.0.0.0:4848]|#]
    Grizzly Framework 3.0.0 started in: 3ms - bound to [/0.0.0.0:3700]|#]
    HV000001: Hibernate Validator 7.0.1.Final|#]
    Grizzly Framework 3.0.0 started in: 28ms - bound to [/0.0.0.0:8080]|#]
    Grizzly Framework 3.0.0 started in: 9ms - bound to [/0.0.0.0:8181]|#]
    Java security manager is disabled.|#]
    Entering Security Startup Service.|#]
    Loading policy provider org.glassfish.exousia.modules.locked.SimplePolicyProvider.|#]
    Security Service(s) started successfully.|#]
    Created HTTP listener http-listener-1 on host/port 0.0.0.0:8080|#]
    Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181|#]
    Created HTTP listener admin-listener on host/port 0.0.0.0:4848|#]
    Created virtual server server|#]
    Created virtual server __asadmin|#]
    Setting JAAS app name glassfish-web|#]
    Virtual server server loaded default web module |#]
    visiting unvisited references|#]
    visiting unvisited references|#]
    Loading application [rest-chapter3-service] at [/rest-chapter3-service]|#]
    Loading application rest-chapter3-service done in 15,895 ms|#]
    visiting unvisited references|#]
    visiting unvisited references|#]
    visiting unvisited references|#]
    WELD-000900: 4.0.2 (Final)|#]
    AS-CDI-00005|#]
    AS-CDI-00005|#]
    WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType&lt;T&gt;) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.|#]
    WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType&lt;T&gt;, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.|#]
    WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jersey.ext.cdi1x.internal.ProcessAllAnnotatedTypes.processAnnotatedType(@Observes ProcessAnnotatedType&lt;?&gt;, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.|#]
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class com.ibm.jbatch.container.cdi.BatchProducerBean is deprecated from CDI 1.1!|#]
    Listening to REST requests at context: /management/domain.|#]
    WELD-000119: Not generating any bean definitions from com.principal.rest.chapter.service.resources.JavaEE8Resource because of underlying class loading error: Type javax.ws.rs.core.Response not found.  If this is unexpected, enable DEBUG logging to see the full error.|#]
    WELD-000119: Not generating any bean definitions from com.principal.rest.chapter.service.resources.RestAppConfig because of underlying class loading error: Type javax.ws.rs.core.Application not found.  If this is unexpected, enable DEBUG logging to see the full error.|#]
    WELD-000119: Not generating any bean definitions from com.principal.rest.chapter.service.JAXRSConfiguration because of underlying class loading error: Type javax.ws.rs.core.Application not found.  If this is unexpected, enable DEBUG logging to see the full error.|#]
    Initializing Soteria 2.0.1 for context '/rest-chapter-3'|#]
    Loading application [rest-chapter-3-service] at [/rest-chapter-3]|#]
    Loading application rest-chapter-3-service done in 9,413 ms|#]
    Eclipse GlassFish  6.2.1  (master-b569-gad91414 2021-08-26T23:45:22+0000) startup time : Felix (54,621ms), startup services(28,203ms), total(82,824ms)|#]
    Grizzly Framework 3.0.0 started in: 44ms - bound to [/0.0.0.0:7676]|#]
    Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl@a20b94b as OSGi service registration: org.apache.felix.framework.ServiceRegistrationImpl@5cdf39b2.|#]
    Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181|#]
    Skipping registration of inhabitant for service reference [org.osgi.service.metatype.MetaTypeProvider] as the service object could not be obtained.|#]
    Grizzly Framework 3.0.0 started in: 72ms - bound to [/0.0.0.0:8181]|#]
    visiting unvisited references|#]
    visiting unvisited references|#]
    visiting unvisited references|#]
    visiting unvisited references|#]
    JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://DESKTOP-55BQ260:8686/jndi/rmi://DESKTOP-55BQ260:8686/jmxrmi|#]
    Initializing Mojarra 3.0.1 for context ''|#]
    Loading application [__admingui] at [/]|#]
    Loading application __admingui done in 11,930 ms|#]
    Context path from ServletContext:  differs from path from bundle: /|#]
    visiting unvisited references|#]
    visiting unvisited references|#]
    visiting unvisited references|#]
    AS-CDI-00005|#]
    AS-CDI-00005|#]
    WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType&lt;T&gt;, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.|#]
    WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType&lt;T&gt;) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.|#]
    WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jersey.ext.cdi1x.internal.ProcessAllAnnotatedTypes.processAnnotatedType(@Observes ProcessAnnotatedType&lt;?&gt;, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.|#]
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class com.ibm.jbatch.container.cdi.BatchProducerBean is deprecated from CDI 1.1!|#]
    WELD-000119: Not generating any bean definitions from com.principal.rest.chapter.service.resources.JavaEE8Resource because of underlying class loading error: Type javax.ws.rs.core.Response not found.  If this is unexpected, enable DEBUG logging to see the full error.|#]
    WELD-000119: Not generating any bean definitions from com.principal.rest.chapter.service.resources.RestAppConfig because of underlying class loading error: Type javax.ws.rs.core.Application not found.  If this is unexpected, enable DEBUG logging to see the full error.|#]
    WELD-000119: Not generating any bean definitions from com.principal.rest.chapter.service.JAXRSConfiguration because of underlying class loading error: Type javax.ws.rs.core.Application not found.  If this is unexpected, enable DEBUG logging to see the full error.|#]
    Initializing Soteria 2.0.1 for context '/rest-chapter-3'|#]
    Loading application [rest-chapter-3-service] at [/rest-chapter-3]|#]
    rest-chapter-3-service was successfully deployed in 4,724 milliseconds.|#]
  </code></pre>
  <p>This is my code:</p>
  <pre><code>package com.principal.rest.chapter.service;
  
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.MediaType;
  
  /**
   *
   * @author Pradip
   */
  @Path(&quot;departments&quot;)
  public class DepartmentService {
      @GET
      @Path(&quot;hello&quot;)
      @Produces(MediaType.APPLICATION_JSON)
      public String helloWorld(){
          return &quot;Hello World&quot;;
      }
  }
  
  package com.principal.rest.chapter.service.resources;
  
  import java.util.Set;
  import javax.ws.rs.core.Application;
  /**
   *
   * @author Pradeep
   */
  @javax.ws.rs.ApplicationPath(&quot;webresources&quot;) 
  public class RestAppConfig extends Application {
      public Set&lt;Class&lt;?&gt;&gt; getClasses() {
     Set&lt;Class&lt;?&gt;&gt; resources = new java.util.HashSet&lt;&gt;();
     resources.add(com.principal.rest.chapter.service.DepartmentService.class);
     return resources;
      }
  }
  </code></pre>