5 Replies Latest reply on Jun 21, 2010 1:30 AM by swd847

    XML Configuration error

    sunls

      In using of XML Configuration Module, WELD-001409 error happened.
      Run Environment:JBoss6.0.0 M2,Seam XML Module Alpha1,Weld Extension Alpha1


      12:55:01,828 ERROR [AbstractKernelController] Error installing to Start: name=vfsfile:/C:/opt/jboss-6.0.0.20100216-M2/se
      rver/default/deploy/weld-translator.war/_WeldBootstrapBean state=Create: org.jboss.weld.exceptions.DeploymentException:
      WELD-001409 Injection point has ambiguous dependencies.  Injection point:  field translator.InjectTest.map;  Qualifiers:
        [@javax.enterprise.inject.Default()]; Possible dependencies: [org.jboss.weld.bean-flat-ProducerMethod-test.xml.XMLCls.
      method getMap(), org.jboss.weld.bean-flat-ProducerMethod-test.xml.XMLCls.method getMap()]
              at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:268)
              at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:113)
              at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:132)
              at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:314)
              at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:300)
              at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:397)
              at org.jboss.weld.integration.deployer.env.helpers.BootstrapBean.boot(BootstrapBean.java:121)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
              at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:151)
              at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
              at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelCont
      rollerContextAction.java:257)
      ...



      Class and configuration file:


      public class XMLCls {
        public int data;
        
        public Map<String,String> getMap(){
           Map<String,String> map = new HashMap<String,String>();
           map.put("name","John");
           return map;
        }
      }
      
      public class InjectTest {
        @Inject
        Map<String,String> map;
      
        ...
      }
      
      beans.xml:
      <test:XMLCls>
        <s:extends/>
        <test:getMap>
           <s:Produces/>
        </test:getMap>
        <test:data>200</test:data>
      </test:XMLCls>




      But, remove flowing code  from beans.xml, error did not occur.Why?



      <test:data>200</test:data>






        • 1. Re: XML Configuration error
          swd847

          That seems really odd, can you try with seam xml alpha2 and see if you still have the problem?


          If so, can you file a JIRA with a test case?


          • 2. Re: XML Configuration error
            sunls

            Stuart Douglas,thanks for your reply.


            The reason of this situation is that I put seam xml jar file into directory common/lib and war/WEB-INF/lib. Remove jar from common/lib, error do not occur.


            When put seam xml jar file into directory common/lib and war/WEB-INF/lib and set Field Values in beans.xml, error occur. If do not set Field Values in beans.xml, error do not occur. I don understand that Why is there such a situation?

            • 3. Re: XML Configuration error
              swd847

              I would say that because you have two copies of seam-xml on the class path seam-xml is being started twice, so each bean will get installed twice.

              • 4. Re: XML Configuration error
                sunls

                Without initial Field Values


                <test:data>200</test:data>



                in beans.xml,like:


                beans.xml:



                <test:XMLCls>
                  <s:extends/>
                  <test:getMap>
                     <s:Produces/>
                  </test:getMap>
                </test:XMLCls>




                Each bean also get installed twice.Why is there no error?


                • 5. Re: XML Configuration error
                  swd847

                  It's kind of complicated, and is caused by two different fairly minor bugs:


                  - Weld can't handle two beans that are exactly the same in every way.


                  This is why it works before you set field values, as the second bean is installed


                  - Setting field values via XML results in a non-deterministic bean id


                  This will be fixed before seam-xml goes final. What happens is seam-xml adds a synthetic @XmlId  to the AnnotatedType, which changes the bean id, which means that both beans get installed.


                  Even so, you should not have two copies of seam-xml (or any portable extension really) on the classpath.