Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2040

Simple weld-se bootstrap example fails to find class when using gradle

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 2.3.0.Final
    • Java SE Support
    • None
    • Hide

      Download the attached project.zip, and run gradle runMain

      Show
      Download the attached project.zip, and run gradle runMain

    Description

      I was having trouble getting a cdi app I had created using weld 1.x with the current 2.3.0.Final release, so I created a simple gradle project that uses org.jboss.weld.environment.se.Weld to launch the main class as shown in the weld docs.

      This code fails to find the test.weld.gradle.Main class. The same code setup as a maven project runs just fine. It appears that there is some confusion with how gradle outputs resources to a directory structure separate from the classes directory structure as the only file paths I see in the weld debug output are related to the build/resourcesMETA-INF/beans.xml tree. There are no references to the build/classes/main tree.

      [project 554]$ gradle runMain
      :compileJava
      :processResources
      :classes
      :runMain
      13:07:31,720 DEBUG [main] org.jboss.logging: Logging Provider: org.jboss.logging.JBossLogManagerProvider
      13:07:31,737 INFO [main] org.jboss.weld.Version: WELD-000900: 2.3.0 (Final)
      13:07:31,764 DEBUG [main] org.jboss.weld.Bootstrap: WELD-ENV-000030: Cannot load class using the ResourceLoader: org.jboss.jandex.Index
      13:07:31,841 DEBUG [main] org.jboss.weld.environment.deployment.discovery.DefaultBeanArchiveScanner: Resolved bean archive refer ence: /private/tmp/project/build/resources/main for URL: file:/private/tmp/project/build/resources/main/META-INF/beans.xml
      13:07:31,841 DEBUG [main] org.jboss.weld.Bootstrap: WELD-ENV-000032: Processing bean archive reference: /private/tmp/project/bui ld/resources/main
      13:07:31,842 DEBUG [main] org.jboss.weld.environment.deployment.discovery.FileSystemBeanArchiveHandler: Handle path: /private/tmp/project/build/resources/main
      13:07:31,842 DEBUG [main] org.jboss.weld.environment.deployment.discovery.FileSystemBeanArchiveHandler: Handle directory: /private/tmp/project/build/resources/main
      13:07:31,843 DEBUG [main] org.jboss.weld.environment.deployment.discovery.FileSystemBeanArchiveHandler: Handle directory: /private/tmp/project/build/resources/main/META-INF
      13:07:31,854 DEBUG [main] org.jboss.weld.Bootstrap: WELD-ENV-000024: Archive isolation enabled - creating multiple isolated bean archives if needed
      13:07:31,891 DEBUG [main] org.jboss.weld.Configuration: WELD-001902: Configuration initialized:

      {RELAXED_CONSTRUCTION=true}

      13:07:31,911 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000124: Using 4 threads for bootstrap
      13:07:31,922 DEBUG [main] org.jboss.weld.Bootstrap: Using instantiator: org.jboss.weld.bean.proxy.UnsafeProxyInstantiator
      13:07:31,926 INFO [main] org.jboss.weld.Bootstrap: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
      13:07:31,970 WARN [main] org.jboss.weld.Interceptor: WELD-001700: Interceptor annotation class javax.ejb.PostActivate not found, interception based on it is not enabled
      13:07:31,971 WARN [main] org.jboss.weld.Interceptor: WELD-001700: Interceptor annotation class javax.ejb.PrePassivate not found, interception based on it is not enabled
      13:07:31,996 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%deployment%ApplicationContext
      13:07:32,000 DEBUG [main] org.jboss.weld.Reflection: WELD-000601: interface javax.inject.Singleton is missing @Target. Weld will use this annotation, however this may make the application unportable.
      13:07:32,001 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%deployment%SingletonContext
      13:07:32,003 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%deployment%BoundSessionContext
      13:07:32,005 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%deployment%BoundConversationContext
      13:07:32,006 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%deployment%BoundRequestContext
      13:07:32,007 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%deployment%RequestContext
      13:07:32,011 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%deployment%DependentContext
      13:07:32,030 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Built-in Bean [javax.enterprise.inject.spi.BeanManager] with qualifiers [@Default]
      13:07:32,030 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Built-in Bean [org.jboss.weld.manager.BeanManagerImpl] wi th qualifiers [@Default]
      13:07:32,063 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Extension [class org.jboss.weld.environment.se.WeldSEBeanRegistrant] with qualifiers [@Default]; jar:file:/Users/starksm/.gradle/caches/modules-2/files-2.1/org.jboss.weld.se/weld-se-core/2.3.0.Final/71e7055c5bc09829f11bd434c222adb2ee328189/weld-se-core-2.3.0.Final.jar!/META-INF/services/javax.enterprise.inject.spi.Extension@1[org.jboss.weld.environment.se.WeldSEBeanRegistrant@703580bf]
      13:07:32,066 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Built-in Bean [javax.enterprise.inject.spi.BeanManager] with qualifiers [@Default]
      13:07:32,066 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Built-in Bean [org.jboss.weld.manager.BeanManagerImpl] wi th qualifiers [@Default]
      13:07:32,109 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000103: Enabled alternatives for Weld BeanManager for /private/tmp/project/build/resources/main [bean count=3]: (empty collection)
      13:07:32,109 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000104: Enabled decorator types for Weld BeanManager for /private/tmp/project/build/resources/main [bean count=3]: (empty collection)
      13:07:32,110 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000105: Enabled interceptor types for Weld BeanManager for /private/tmp/project/build/resources/main [bean count=3]: (empty collection)
      13:07:32,141 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000108: Decorator: Decorator [class org.jboss.weld.environment.se.threading.RunnableDecorator] decorates [Runnable] with delegate type [Runnable] and delegate qualifiers [@Default]
      13:07:32,143 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%/private/tmp/project/build/resources/main%ApplicationContext
      13:07:32,143 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%/private/tmp/project/build/resou rces/main%BoundConversationContext
      13:07:32,143 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Managed Bean [class org.jboss.weld.environment.se.beans.P arametersFactory] with qualifiers [@Any @Default]
      13:07:32,144 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%/private/tmp/project/build/resou rces/main%BoundRequestContext
      13:07:32,144 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%/private/tmp/project/build/resou rces/main%Conversation
      13:07:32,144 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Implicit Bean [javax.enterprise.inject.spi.Interceptor] w ith qualifiers [@Default]
      13:07:32,146 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Implicit Bean [javax.enterprise.inject.spi.Decorator] wit h qualifiers [@Default]
      13:07:32,146 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%/private/tmp/project/build/resou rces/main%BoundSessionContext
      13:07:32,147 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%/private/tmp/project/build/resources/main%DependentContext
      13:07:32,147 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Producer Method [List<String>] with qualifiers [@Parameters @Any] declared as [[UnbackedAnnotatedMethod] @Produces @Parameters public org.jboss.weld.environment.se.beans.ParametersFactory.getArgs()]
      13:07:32,148 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Implicit Bean [javax.enterprise.inject.spi.Bean] with qua lifiers [@Intercepted]
      13:07:32,148 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Producer Method [String[]] with qualifiers [@Parameters @Any] declared as [[UnbackedAnnotatedMethod] @Produces @Parameters public org.jboss.weld.environment.se.beans.ParametersFactory.getArgsAsArray()]
      13:07:32,148 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Implicit Bean [javax.enterprise.inject.spi.InjectionPoint ] with qualifiers [@Default]
      13:07:32,149 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Implicit Bean [javax.enterprise.inject.spi.Bean] with qua lifiers [@Default]
      13:07:32,149 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Implicit Bean [javax.enterprise.inject.spi.EventMetadata] with qualifiers [@Default]
      13:07:32,149 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%/private/tmp/project/build/resources/main%SingletonContext
      13:07:32,149 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Implicit Bean [javax.enterprise.event.Event] with qualifi ers [@Default]
      13:07:32,150 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Implicit Bean [javax.enterprise.inject.Instance] with qua lifiers [@Default]
      13:07:32,150 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: WELD%AbstractBuiltInBean%/private/tmp/project/build/resou rces/main%RequestContext
      13:07:32,150 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Managed Bean [class org.jboss.weld.environment.se.beans.I nstanceManager] with qualifiers [@Any @Default]
      13:07:32,151 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: Implicit Bean [javax.enterprise.inject.spi.Bean] with qua lifiers [@Decorated]
      13:07:32,158 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000106: Bean: org.jboss.weld.environment.se.WeldSEBeanRegistrant$WeldContainerBean@776aec5c
      13:07:32,192 DEBUG [main] org.jboss.weld.Bootstrap: WELD-000100: Weld initialized. Validating beans
      13:07:32,206 DEBUG [main] org.jboss.weld.Bootstrap: EE modules: [BeanDeploymentModule [id=BeanDeploymentModules.DEFAULT, web=false, managers=[/private/tmp/project/build/resources/main]]]
      13:07:32,215 DEBUG [main] org.jboss.weld.Reflection: WELD-000620: interface javax.enterprise.inject.Intercepted is not declared @Target(METHOD, FIELD, PARAMETER, TYPE). Weld will use this annotation, however this may make the application unportable.
      13:07:32,216 DEBUG [main] org.jboss.weld.Reflection: WELD-000620: interface javax.enterprise.inject.Decorated is not declared @Target(METHOD, FIELD, PARAMETER, TYPE). Weld will use this annotation, however this may make the application unportable.
      13:07:32,219 INFO [main] org.jboss.weld.Bootstrap: WELD-ENV-002003: Weld SE container STATIC_INSTANCE initialized
      Exception in thread "main" org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001308: Unable to resolve any beans for Type: class test.weld.gradle.Main; Qualifiers: []
      at org.jboss.weld.bean.builtin.InstanceImpl.get(InstanceImpl.java:101)
      at test.weld.gradle.Bootstrap.main(Bootstrap.java:10)
      13:07:32,229 INFO [Thread-1] org.jboss.weld.Bootstrap: WELD-ENV-002001: Weld SE container STATIC_INSTANCE shut down
      Weld SE container STATIC_INSTANCE shut down by shutdown hook
      :runMain FAILED

      FAILURE: Build failed with an exception.

      • What went wrong:
        Execution failed for task ':runMain'.
        > Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
      • Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

      BUILD FAILED

      Total time: 4.357 secs
      [project 555]$

      Attachments

        Activity

          People

            Unassigned Unassigned
            starksm64 Scott Stark (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: