Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1335

Not resolving CDI depedencies in Application classes when resources are not located under 'classes' in build path (typically using Gradle)

XMLWordPrintable

    • Hide
      Show
      Create a new Gradle build Copy/Paste build.gradle file content (see attatchments) Use java sources from https://github.com/vdevigere/undertow-cdi-jaxrs/tree/master/src Build Run

      I was trying to customize this simple project :
      https://github.com/vdevigere/undertow-cdi-jaxrs
      by replacing Maven build tool by Gradle.

      I got this exception :

      Exception in thread "main" java.lang.NullPointerException
      	at org.jboss.resteasy.spi.ResteasyDeployment.processApplication(ResteasyDeployment.java:507)
      	at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:331)
      	at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:245)
      	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:113)
      	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
      	at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
      	at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:231)
      	at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:132)
      	at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:527)
      	at org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer.deploy(UndertowJaxrsServer.java:232)
      	at org.viddu.poc.MyServer.deploy(MyServer.java:29)
      	at org.viddu.poc.MyServer.main(MyServer.java:40)
      

      The problem stems from the fact that Gradle build tool, unlike Maven, put by default the resources in build/resources/main folder instead of classes folder.

      I first thought it was a bug from the beans.xml discovy module from weld. But logs show that the file is resolved :

      01:01:10.237 [main] DEBUG org.jboss.weld.environment.deployment.discovery.DefaultBeanArchiveScanner - Resolved bean archive reference: ...\resources\main for URL: file:/.../build/resources/main/META-INF/beans.xml
      

        1. build.gradle
          0.5 kB
        2. log.txt
          35 kB

              rsigal@redhat.com Ronald Sigal
              tavaresf Florian Tavares (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: