Uploaded image for project: 'Thorntail'
  1. Thorntail
  2. THORN-579

@ConfigValue not working when running as an uberjar

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 1.0.0.Final
    • Fix Version/s: 2016.9
    • Component/s: None
    • Labels:
      None
    • Sprint:
      2016.9
    • Steps to Reproduce:
      Hide

      1. download and extract demo.zip
      2. mvn clean wildfly-swarm:run
      3. server starts
      4. stop server
      5. mvn clean package && java -jar target\demo-swarm.jar
      6. exception occurs

      Show
      1. download and extract demo.zip 2. mvn clean wildfly-swarm:run 3. server starts 4. stop server 5. mvn clean package && java -jar target\demo-swarm.jar 6. exception occurs

      Description

      I'm getting an exception during server startup when injecting a property from the project-stages.yml file into an EJB when running mvn clean package && java -jar target\demo-swarm.jar. Everything works fine when running mvn wildfly-swarm:run.

      The code for the EJB is simply

      @Stateless
      @WebService(name = "PropService", serviceName = "PropService", portName = "PropPort")
      public class PropertiesBean {
      
      	@Inject
      	@ConfigValue("some.value")
      	private String prop;
      
      	public String prop() {
      		return prop;
      	}
      
      }
      
      

      and the exception is :

      2016-08-02 15:35:09,967 ERROR [stderr] (main) Exception in thread "main" java.lang.reflect.InvocationTargetException
      2016-08-02 15:35:09,967 ERROR [stderr] (main)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2016-08-02 15:35:09,967 ERROR [stderr] (main)   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      2016-08-02 15:35:09,967 ERROR [stderr] (main)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      2016-08-02 15:35:09,967 ERROR [stderr] (main)   at java.lang.reflect.Method.invoke(Unknown Source)
      2016-08-02 15:35:09,968 ERROR [stderr] (main)   at org.wildfly.swarm.bootstrap.Main.invoke(Main.java:84)
      2016-08-02 15:35:09,968 ERROR [stderr] (main)   at org.wildfly.swarm.bootstrap.Main.run(Main.java:48)
      2016-08-02 15:35:09,968 ERROR [stderr] (main)   at org.wildfly.swarm.bootstrap.Main.main(Main.java:43)
      2016-08-02 15:35:09,968 ERROR [stderr] (main) Caused by: org.wildfly.swarm.container.DeploymentException: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"demo.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"demo.war\".WeldStartService: Failed to start service
      2016-08-02 15:35:09,968 ERROR [stderr] (main)     Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type String with qualifiers @ConfigValue
      2016-08-02 15:35:09,968 ERROR [stderr] (main)   at injection point [BackedAnnotatedField] @Inject @ConfigValue private com.example.properties.PropertiesBean.prop
      2016-08-02 15:35:09,969 ERROR [stderr] (main)   at com.example.properties.PropertiesBean.prop(PropertiesBean.java:0)
      2016-08-02 15:35:09,969 ERROR [stderr] (main)   Possible dependencies:
      2016-08-02 15:35:09,969 ERROR [stderr] (main)   - Producer Method [String] with qualifiers [@ConfigValue @Any] declared as [[BackedAnnotatedMethod] @ConfigValue @Dependent @Produces org.wildfly.swarm.cdi.ConfigValueProducer.produceStringConfigValue(InjectionPoint)],
      2016-08-02 15:35:09,969 ERROR [stderr] (main)   - Producer Method [String] with qualifiers [@ConfigValue @Any] declared as [[BackedAnnotatedMethod] @ConfigValue @Dependent @Produces org.wildfly.swarm.cdi.ConfigValueProducer.produceStringConfigValue(InjectionPoint)]
      2016-08-02 15:35:09,969 ERROR [stderr] (main) "}}
      2016-08-02 15:35:09,969 ERROR [stderr] (main)   at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:159)
      2016-08-02 15:35:09,970 ERROR [stderr] (main)   at org.wildfly.swarm.container.Container.deploy(Container.java:432)
      2016-08-02 15:35:09,970 ERROR [stderr] (main)   at org.wildfly.swarm.Swarm.deploy(Swarm.java:122)
      2016-08-02 15:35:09,970 ERROR [stderr] (main)   at org.wildfly.swarm.Swarm.deploy(Swarm.java:45)
      2016-08-02 15:35:09,970 ERROR [stderr] (main)   at org.wildfly.swarm.container.Container.deploy(Container.java:416)
      2016-08-02 15:35:09,971 ERROR [stderr] (main)   at org.wildfly.swarm.Swarm.deploy(Swarm.java:117)
      2016-08-02 15:35:09,971 ERROR [stderr] (main)   at com.example.Main.main(Main.java:17)
      2016-08-02 15:35:09,971 ERROR [stderr] (main)   ... 7 more
      

      Did I miss something ? I've attached a small project to easily reproduce the problem.
      Thanks !

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                kenfinni Ken Finnigan
                Reporter:
                JeremiePanzer Jeremie Panzer
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: