1 2 Previous Next 23 Replies Latest reply on Dec 17, 2007 8:49 PM by Scott Stark

    setting managed property of type List

    Alexey Loubyansky Master

      I couldn't find a test for it? The only test I found for ManagedProperty.setValue() is org.jboss.test.managed.mock.MockTest but it sets only Strings.

      I have a property of type java.util.List and when I set it I get

      java.lang.reflect.UndeclaredThrowableException
       at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.newArrayInstance(DefaultMetaValueFactory.java:654)
       at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.internalUnwrap(DefaultMetaValueFactory.java:490)
       at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.unwrap(DefaultMetaValueFactory.java:451)
       at org.jboss.managed.plugins.factory.AbstractManagedObjectFactory.setValue(AbstractManagedObjectFactory.java:753)
       at org.jboss.managed.plugins.WritethroughManagedPropertyImpl.setValue(WritethroughManagedPropertyImpl.java:111)
       at org.jboss.resource.deployers.management.DsDataSourceTemplate.writeTemplate(DsDataSourceTemplate.java:159)
       at org.jboss.resource.deployers.management.DsDataSourceTemplate.applyTemplate(DsDataSourceTemplate.java:69)
       at org.jboss.profileservice.management.ManagementViewImpl.applyTemplate(ManagementViewImpl.java:550)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:121)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.profileservice.remoting.ProfileServiceInvocationHandler.invoke(ProfileServiceInvocationHandler.java:56)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:771)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
      Caused by: java.lang.ClassCastException: ReflectClassInfoImpl@1bc6271{name=java.util.List} is not an array.
       at org.jboss.reflect.plugins.ClassInfoImpl.newArrayInstance(ClassInfoImpl.java:532)
       at org.jboss.reflect.spi.DelegateClassInfo.newArrayInstance(DelegateClassInfo.java:285)
       at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.newArrayInstance(DefaultMetaValueFactory.java:650)
       at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.internalUnwrap(DefaultMetaValueFactory.java:490)
       at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.unwrap(DefaultMetaValueFactory.java:451)
       at org.jboss.managed.plugins.factory.AbstractManagedObjectFactory.setValue(AbstractManagedObjectFactory.java:753)
       at org.jboss.managed.plugins.WritethroughManagedPropertyImpl.setValue(WritethroughManagedPropertyImpl.java:111)
       at org.jboss.resource.deployers.management.DsDataSourceTemplate.writeTemplate(DsDataSourceTemplate.java:159)
       at org.jboss.resource.deployers.management.DsDataSourceTemplate.applyTemplate(DsDataSourceTemplate.java:69)
       at org.jboss.profileservice.management.ManagementViewImpl.applyTemplate(ManagementViewImpl.java:550)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:121)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.profileservice.remoting.ProfileServiceInvocationHandler.invoke(ProfileServiceInvocationHandler.java:56)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:771)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
       at org.jboss.remoting.Client.invoke(Client.java:1634)
       at org.jboss.remoting.Client.invoke(Client.java:548)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at AOPProxy$1.applyTemplate(AOPProxy$1.java)
       at org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.testAddXADataSource(ProfileServiceUnitTestCase.java:430)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at AOPProxy$1.applyTemplate(AOPProxy$1.java)
       at org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.testAddXADataSource(ProfileServiceUnitTestCase.java:430)


      The code looks like
      ManagedObjectFactory mof = ManagedObjectFactoryBuilder.create();
      ManagedConnectionFactoryDeploymentMetaData mcf = new XADataSourceDeploymentMetaData();
      ManagedObject cfMO = mof.initManagedObject(mcf, "DataSource", "XA");
      ManagedProperty dsProp = cfMO.getProperty("xa-datasource-properties");
      dsProp.setValue(arrayList);
      
      
      @ManagementObject(componentType=@ManagementComponent(type="DataSource",subtype="XA"))
      public class XADataSourceDeploymentMetaData extends DataSourceDeploymentMetaData
      {
      ....
       @ManagementProperty(name="xa-datasource-properties", description="The DataSource properties", managed=true)
       public List<XAConnectionPropertyMetaData> getXADataSourceProperties()
       {
       return this.xaDataSourceProperties;
       }


      You can see the real testcase in the stacktrace.

        • 1. Re: setting managed property of type List
          Ales Justin Master

          I'm just adding additional tests for the Collections to the UnwrapValueUnitTestCase.

          • 2. Re: setting managed property of type List
            Ales Justin Master

            Hmmm, looking at the MetaValueFactory.create(Object value) for value == List(Integer), this seems to be broken or at least the relevant information about element values gets lost.

            This is what this method returns for non-empty Integer ArrayList.

            metaValue: org.jboss.metatype.api.values.MetaValue = {org.jboss.metatype.api.values.ArrayValueSupport@824}"ArrayMetaType{type=[Lorg.jboss.metatype.api.values.CompositeValue; dims=1 elementType=MutableCompositeMetaType{java.lang.Object}:[CompositeValueSupport: metaType=[MutableCompositeMetaType{java.lang.Object}] items=[], CompositeValueSupport: metaType=[MutableCompositeMetaType{java.lang.Object}] items=[]]"
            metaType: org.jboss.metatype.api.types.ArrayMetaType = {org.jboss.metatype.api.types.ArrayMetaType@829}"ArrayMetaType{type=[Lorg.jboss.metatype.api.values.CompositeValue; dims=1 elementType=MutableCompositeMetaType{java.lang.Object}"
            dimension: int = 1
            elementType: org.jboss.metatype.api.types.MetaType = {org.jboss.metatype.plugins.types.MutableCompositeMetaType@840}"MutableCompositeMetaType{java.lang.Object}"
            primitiveArray: boolean = false
            cachedHashCode: int = -2147483648
            cachedToString: java.lang.String = {java.lang.String@833}"ArrayMetaType{type=[Lorg.jboss.metatype.api.values.CompositeValue; dims=1 elementType=MutableCompositeMetaType{java.lang.Object}"
            className: java.lang.String = {java.lang.String@850}"[Lorg.jboss.metatype.api.values.CompositeValue;"
            description: java.lang.String = {java.lang.String@851}"1-dimension array of java.lang.Object"
            typeName: java.lang.String = {java.lang.String@852}"[Lorg.jboss.metatype.api.values.CompositeValue;"
            array: boolean = true
            value: java.lang.Object = {java.lang.Object[2]@830}
            [0] = {org.jboss.metatype.api.values.CompositeValueSupport@834}"CompositeValueSupport: metaType=[MutableCompositeMetaType{java.lang.Object}] items=[]"
            contents: java.util.SortedMap = {java.util.TreeMap@839} size = 0
            metaType: org.jboss.metatype.api.types.CompositeMetaType = {org.jboss.metatype.plugins.types.MutableCompositeMetaType@840}"MutableCompositeMetaType{java.lang.Object}"
            cachedHashCode: int = -2147483648
            [1] = {org.jboss.metatype.api.values.CompositeValueSupport@834}"CompositeValueSupport: metaType=[MutableCompositeMetaType{java.lang.Object}] items=[]"
            contents: java.util.SortedMap = {java.util.TreeMap@839} size = 0
            metaType: org.jboss.metatype.api.types.CompositeMetaType = {org.jboss.metatype.plugins.types.MutableCompositeMetaType@840}"MutableCompositeMetaType{java.lang.Object}"
            cachedHashCode: int = -2147483648


            The problem is that Object is recognized as lists/arrays element type instead of Integer (runtime object doesn't carry generics info). Hence elements are Composite types instead of primitive number type.



            • 3. Re: setting managed property of type List
              Ales Justin Master

              Do we need a CollectionMetaType/Value?
              Since this code doesn't know anything about the actual Collection class:

              From DefaultMetaValueFactory:

               else if (classInfo.isCollection())
               {
               Collection c = (Collection) value;
               oldArray = c.toArray();
               }
               else
               throw new UnsupportedOperationException("Cannot construct array for " + value.getClass());
              
               array = createArray(elementType, componentType.getComponentType(), dimension, oldArray);
              


              And from DefaultMetaTypeFactory:
               /**
               * Generate a collection metatype
               *
               * @param typeInfo the type info
               * @return the metatype
               */
               public ArrayMetaType generateCollection(ClassInfo typeInfo)
               {
               TypeInfo elementType = objectTypeInfo;
              
               TypeInfo[] types = typeInfo.getActualTypeArguments();
               if (types != null)
               elementType = types[0];
              
               MetaType elementMetaType = resolve(elementType);
               return new ArrayMetaType(1, elementMetaType);
               }
              


              Hence no way of unwrapping it.

              • 4. Re: setting managed property of type List
                Ales Justin Master

                I've commited the introduction to CollectionValue/MetaType.

                So you're now able to unwrap the Collection values as well.

                 public void testCollectionUnwrap() throws Exception
                 {
                 Integer i1 = 123;
                 Integer i2 = 123;
                 checkCollection(new ArrayList<Integer>(), i1, i2);
                 checkCollection(new HashSet<Integer>(), i1, i2);
                
                 TestEnum one = TestEnum.ONE;
                 TestEnum two = TestEnum.TWO;
                 TestEnum three = TestEnum.THREE;
                 checkCollection(new ArrayList<TestEnum>(), one, two, three, one);
                 checkCollection(new HashSet<TestEnum>(), one, two, three, one);
                
                 TestGeneric g1 = new TestGeneric("123");
                 TestGeneric g2 = new TestGeneric("123");
                 checkCollection(new ArrayList<TestGeneric>(), g1, g2);
                 checkCollection(new HashSet<TestGeneric>(), g1, g2);
                
                 TestSimpleComposite c1 = new TestSimpleComposite("123");
                 TestSimpleComposite c2 = new TestSimpleComposite("123");
                 checkCollection(new ArrayList<TestSimpleComposite>(), c1, c2);
                 checkCollection(new HashSet<TestSimpleComposite>(), c1, c2);
                 }
                


                • 5. Re: setting managed property of type List
                  Alexey Loubyansky Master

                  Thanks, Ales. Have you updated the snapshot? Is it in metatype?

                  • 6. Re: setting managed property of type List
                    Ales Justin Master

                     

                    "alex.loubyansky@jboss.com" wrote:

                    Have you updated the snapshot?

                    No.
                    For the AS5_trunk I guess we need a new release.
                    I'm still working on some stuff, so I hope we can wait till I get it in.
                    But I'll be done till we tag all stuff for AS5_beta3.

                    "alex.loubyansky@jboss.com" wrote:

                    Is it in metatype?

                    Yes.

                    • 7. Re: setting managed property of type List
                      Alexey Loubyansky Master

                      Now I get this CCE.

                      Testcase: testAddXADataSource took 7.591 sec
                       Caused an ERROR
                      org.jboss.metatype.api.types.CollectionMetaType
                      java.lang.ClassNotFoundException: org.jboss.metatype.api.types.CollectionMetaType
                       at org.jboss.remoting.serialization.ClassLoaderUtility.loadClass(ClassLoaderUtility.java:82)
                       at org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:76)
                       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
                       at java.lang.Class.forName0(Native Method)
                       at java.lang.Class.forName(Class.java:242)
                       at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:174)
                       at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544)
                       at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
                       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
                       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
                       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
                       at java.util.HashMap.readObject(HashMap.java:1067)
                       at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
                       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
                       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
                       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
                       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
                       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
                       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
                       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
                       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
                       at org.jboss.managed.plugins.ManagedPropertyImpl.readVersion1(ManagedPropertyImpl.java:411)
                       at org.jboss.managed.plugins.ManagedPropertyImpl.readObject(ManagedPropertyImpl.java:385)
                       at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
                       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
                       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
                       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
                       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
                       at java.util.HashMap.readObject(HashMap.java:1067)
                       at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
                       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
                       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
                       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
                       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
                       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
                       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
                       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
                       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
                       at org.jboss.aop.joinpoint.InvocationResponse.readExternal(InvocationResponse.java:122)
                       at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
                       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
                       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
                       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
                       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
                       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
                       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
                       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
                       at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObjectVersion2_2(JavaSerializationManager.java:239)
                       at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:133)
                       at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:120)
                       at org.jboss.invocation.unified.marshall.InvocationUnMarshaller.read(InvocationUnMarshaller.java:59)
                       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedRead(MicroSocketClientInvoker.java:957)
                       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:586)
                       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
                       at org.jboss.remoting.Client.invoke(Client.java:1634)
                       at org.jboss.remoting.Client.invoke(Client.java:548)
                       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at AOPProxy$1.getTemplate(AOPProxy$1.java)
                       at org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.testAddXADataSource(ProfileServiceUnitTestCase.java:409)
                       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at AOPProxy$1.getTemplate(AOPProxy$1.java)
                       at org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.testAddXADataSource(ProfileServiceUnitTestCase.java:409)


                      • 8. Re: setting managed property of type List
                        Ales Justin Master

                         

                        "alex.loubyansky@jboss.com" wrote:
                        Now I get this CCE.

                        You mean CNFE? ;-)

                        The stuff is definitely commited in svn - running tests OK on independent machine - my TeamCity build server.

                        Perhaps you need a rebuild of profileservice configuration?
                        Or at least change the jboss-metatype.jar in lib dir?

                        • 9. Re: setting managed property of type List
                          Alexey Loubyansky Master

                          Yes, sorry, need to work on my reading/typing skills. I had the jboss-metatype.jar in the lib but didn't update it in the thirdparty which is what used for the testsuite classpath.

                          The next one is

                          java.lang.reflect.UndeclaredThrowableException
                           at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.unwrapCollection(DefaultMetaValueFactory.java:698)
                           at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.internalUnwrap(DefaultMetaValueFactory.java:539)
                           at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.unwrap(DefaultMetaValueFactory.java:481)
                           at org.jboss.managed.plugins.factory.AbstractManagedObjectFactory.setValue(AbstractManagedObjectFactory.java:753)
                           at org.jboss.managed.plugins.WritethroughManagedPropertyImpl.setValue(WritethroughManagedPropertyImpl.java:111)
                           at org.jboss.resource.deployers.management.DsDataSourceTemplate.writeTemplate(DsDataSourceTemplate.java:148)
                           at org.jboss.resource.deployers.management.DsDataSourceTemplate.applyTemplate(DsDataSourceTemplate.java:69)
                           at org.jboss.profileservice.management.ManagementViewImpl.applyTemplate(ManagementViewImpl.java:551)
                           at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:121)
                           at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
                           at org.jboss.profileservice.remoting.ProfileServiceInvocationHandler.invoke(ProfileServiceInvocationHandler.java:56)
                           at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:771)
                           at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
                           at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
                           at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
                          Caused by: org.jboss.joinpoint.spi.JoinpointException: Constructor not found java.util.List[] no constructors
                           at org.jboss.joinpoint.plugins.Config.findConstructorInfo(Config.java:276)
                           at org.jboss.joinpoint.plugins.Config.getConstructorJoinpoint(Config.java:150)
                           at org.jboss.beans.info.plugins.AbstractBeanInfo.newInstance(AbstractBeanInfo.java:221)
                           at org.jboss.beans.info.plugins.AbstractBeanInfo.newInstance(AbstractBeanInfo.java:216)
                           at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.createNewInstance(DefaultMetaValueFactory.java:725)
                           at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.unwrapCollection(DefaultMetaValueFactory.java:683)
                           at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.internalUnwrap(DefaultMetaValueFactory.java:539)
                           at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.unwrap(DefaultMetaValueFactory.java:481)
                           at org.jboss.managed.plugins.factory.AbstractManagedObjectFactory.setValue(AbstractManagedObjectFactory.java:753)
                           at org.jboss.managed.plugins.WritethroughManagedPropertyImpl.setValue(WritethroughManagedPropertyImpl.java:111)
                           at org.jboss.resource.deployers.management.DsDataSourceTemplate.writeTemplate(DsDataSourceTemplate.java:148)
                           at org.jboss.resource.deployers.management.DsDataSourceTemplate.applyTemplate(DsDataSourceTemplate.java:69)
                           at org.jboss.profileservice.management.ManagementViewImpl.applyTemplate(ManagementViewImpl.java:551)
                           at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:121)
                           at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
                           at org.jboss.profileservice.remoting.ProfileServiceInvocationHandler.invoke(ProfileServiceInvocationHandler.java:56)
                           at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:771)
                           at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
                           at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
                           at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
                           at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
                           at org.jboss.remoting.Client.invoke(Client.java:1634)
                           at org.jboss.remoting.Client.invoke(Client.java:548)
                           at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
                           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                           at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)
                           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                           at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
                           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                           at AOPProxy$1.applyTemplate(AOPProxy$1.java)
                           at org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.testAddXADataSource(ProfileServiceUnitTestCase.java:434)
                           at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
                           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                           at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)
                           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                           at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
                           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                           at AOPProxy$1.applyTemplate(AOPProxy$1.java)
                           at org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.testAddXADataSource(ProfileServiceUnitTestCase.java:434)


                          Changing List to ArrayList in the following didn't help
                          f = new DefaultFieldsImpl();
                           setFieldName("xa-datasource-properties", f);
                           f.setDescription("The xa datasource properties");
                           f.setMandatory(false);
                           // TODO is this right?
                           f.setMetaType(MetaTypeFactory.getInstance().resolve(ArrayList.class));
                           ManagedPropertyImpl xaDsProps = new ManagedPropertyImpl(mo, f);


                          • 10. Re: setting managed property of type List
                            Ales Justin Master

                            Did a small fix.
                            Can you try it now?

                            • 11. Re: setting managed property of type List
                              Alexey Loubyansky Master

                              No, still fails.

                              java.lang.reflect.UndeclaredThrowableException
                               at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.unwrapCollection(DefaultMetaValueFactory.java:699)
                               at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.internalUnwrap(DefaultMetaValueFactory.java:539)
                               at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.unwrap(DefaultMetaValueFactory.java:481)
                               at org.jboss.managed.plugins.factory.AbstractManagedObjectFactory.setValue(AbstractManagedObjectFactory.java:753)
                               at org.jboss.managed.plugins.WritethroughManagedPropertyImpl.setValue(WritethroughManagedPropertyImpl.java:111)
                               at org.jboss.resource.deployers.management.DsDataSourceTemplate.writeTemplate(DsDataSourceTemplate.java:148)
                               at org.jboss.resource.deployers.management.DsDataSourceTemplate.applyTemplate(DsDataSourceTemplate.java:69)
                               at org.jboss.profileservice.management.ManagementViewImpl.applyTemplate(ManagementViewImpl.java:552)
                               at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:121)
                               at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
                               at org.jboss.profileservice.remoting.ProfileServiceInvocationHandler.invoke(ProfileServiceInvocationHandler.java:56)
                               at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:771)
                               at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
                               at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
                               at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
                              Caused by: org.jboss.joinpoint.spi.JoinpointException: Constructor not found java.util.List[] no constructors
                               at org.jboss.joinpoint.plugins.Config.findConstructorInfo(Config.java:276)
                               at org.jboss.joinpoint.plugins.Config.getConstructorJoinpoint(Config.java:150)
                               at org.jboss.beans.info.plugins.AbstractBeanInfo.newInstance(AbstractBeanInfo.java:221)
                               at org.jboss.beans.info.plugins.AbstractBeanInfo.newInstance(AbstractBeanInfo.java:216)
                               at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.createNewInstance(DefaultMetaValueFactory.java:726)
                               at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.unwrapCollection(DefaultMetaValueFactory.java:684)
                               at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.internalUnwrap(DefaultMetaValueFactory.java:539)
                               at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.unwrap(DefaultMetaValueFactory.java:481)
                               at org.jboss.managed.plugins.factory.AbstractManagedObjectFactory.setValue(AbstractManagedObjectFactory.java:753)
                               at org.jboss.managed.plugins.WritethroughManagedPropertyImpl.setValue(WritethroughManagedPropertyImpl.java:111)
                               at org.jboss.resource.deployers.management.DsDataSourceTemplate.writeTemplate(DsDataSourceTemplate.java:148)
                               at org.jboss.resource.deployers.management.DsDataSourceTemplate.applyTemplate(DsDataSourceTemplate.java:69)
                               at org.jboss.profileservice.management.ManagementViewImpl.applyTemplate(ManagementViewImpl.java:552)
                               at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:121)
                               at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
                               at org.jboss.profileservice.remoting.ProfileServiceInvocationHandler.invoke(ProfileServiceInvocationHandler.java:56)
                               at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:771)
                               at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
                               at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
                               at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
                               at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
                               at org.jboss.remoting.Client.invoke(Client.java:1634)
                               at org.jboss.remoting.Client.invoke(Client.java:548)
                               at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
                               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                               at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)
                               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                               at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
                               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                               at AOPProxy$1.applyTemplate(AOPProxy$1.java)
                               at org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.testAddXADataSource(ProfileServiceUnitTestCase.java:434)
                               at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
                               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                               at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)
                               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                               at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
                               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                               at AOPProxy$1.applyTemplate(AOPProxy$1.java)
                               at org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.testAddXADataSource(ProfileServiceUnitTestCase.java:434)


                              • 12. Re: setting managed property of type List
                                Ales Justin Master

                                 

                                "alesj" wrote:
                                Can you try it now?

                                Eh, wait a bit. :-(
                                Adding some tests.
                                I'll let you know when resolved.

                                • 13. Re: setting managed property of type List
                                  Ales Justin Master

                                  OK, this is deeper problem, than I anticipated earlier.

                                  There is a problem of interfaces/abstract classes, if you explicitly use interface/abstract class Type(Info) as a parameter in MetaTypeFactory.create. Since that is what is then used to create metatype instance, from which we later on gather information to do the unwrapping (for composite and collection). Thus failing to instantiate new instance.

                                  But if you use straight MetaTypeFactory.create with only value parameter, it should go through.

                                  Adrian, what's to do here?
                                  Using the more restrictive TypeInfo in DefaultMetaValueFactory.internalCreate?

                                   protected MetaValue internalCreate(Object value, TypeInfo type, MetaType metaType)
                                   {
                                   if (value == null)
                                   return null;
                                  
                                   if (type == null || (type instanceof ClassInfo && ((ClassInfo)type).isInterface()))
                                   type = configuration.getTypeInfo(value.getClass());
                                  


                                  • 14. Re: setting managed property of type List
                                    Ales Justin Master

                                     

                                    "alesj" wrote:

                                    Adrian, what's to do here?
                                    Using the more restrictive TypeInfo in DefaultMetaValueFactory.internalCreate?

                                    Or should we add additional information into CompositeValue and CollectionValue --> real value's (the one that was passed in as a parameter to create method) MetaType (from its real TypeInfo)?

                                    1 2 Previous Next