1 2 3 Previous Next 30 Replies Latest reply: Mar 8, 2011 7:06 AM by Lin Gao RSS

IronJacamar RHQ plugin development

Yang Yong Newbie

Hi Jesper,

 

After failed to deploy amdin-console.war to Jetty, we had a new plan to start developing the plugin.

 

OK, at first I have to say, the goal of the new plan is just making us start to write code right now in current situation.

 

The current situation is:

1) AS7 is not ready and changing fast

2) Admin Console for AS7 is not ready, it means no rhq-jbossas-7-plugin currently, which will provide the apis to interact with AS7 and is the parent plugin of IronJacamar one

 

The new plan may include 3 steps to approach the final goal.

1) We'd like to wrap a EmbeddedJCA just like the test cases in IronJacamar, and the EnbeddedJCA will run in the rhq agent environment, and will be started with the plugin. In the plugin, we access the management model directly.

2) We'll wrap an interface for locating IronJacamar's management model, if time is ready to intergrate in AS7, we just need to provide another implementation to support AS7, by ServerManager or other.

3) If we really need RHQ based console in standaonle IronJacamar, we need to wait  until next generation admin console of AS7 is ready, since rhq plugin container and the IronJacamar are in one process, so the management model can be accessed directly like 1), so we almost don't need to do any change to the plugin to support this feature.

 

OK, although 1) looks ugly, but it should work and can drive we start now

  • 1. IronJacamar RHQ plugin development
    Jesper Pedersen Master

    Yeah, just go with 1) now.

  • 2. Re: IronJacamar RHQ plugin development
    Lin Gao Newbie

    Hi, Jesper:

     

       I have been able to start the EmbeddedJCA container in the RHQ plugin environment,

    and now needs to deploy some resources to be manged.

     

       I tried with the jdbc-local.rar which comes from build/adapters/jdbc-local.rar and the hsqldb-ds.xml

    which comes from JBoss AS 6 binary, both of the deployment have some issues.

     

       Is it ture that the current IronJacama does not support deployment of .rar resources which are for

    JCA 1.0/1.5 and deployment of *-ds.xml resources which has the element: '<local-tx-datasource>' yet?

     

      When I tried to deploy the jdbc-local.rar, there is no

    ManagedConnectionFactory

    after

    deployed, because the

    RADeployer.checkActivation(Connector cmd, IronJacamar ijmd) 

    method

    returns false due to no META-INF/ironjacamar.xml in the jdbc-local.rar file.

     

      When I tried to deploy the hsqldb-ds.xml, there is an exception:

    Caused by: org.jboss.jca.common.metadata.ParserException: Unexpected element:local-tx-datasource
        at org.jboss.jca.common.metadata.ds.DsParser.parseDataSources(DsParser.java:165)
        at org.jboss.jca.common.metadata.ds.DsParser.parse(DsParser.java:112)
        at org.jboss.jca.common.metadata.ds.DsParser.parse(DsParser.java:75)
        at org.jboss.jca.deployers.fungal.DsXmlDeployer.deploy(DsXmlDeployer.java:157)
        ... 32 more
    

     

  • 3. Re: IronJacamar RHQ plugin development
    Jesper Pedersen Master

    You need to use the resource adapters from IronJacamar:

     

    https://repository.jboss.org/nexus/content/groups/public/org/jboss/ironjacamar/

     

    jdbc-local and jdbc-xa.

     

    Also you need to use the new datasource XSD for defining a datasource:

     

    http://anonsvn.jboss.org/repos/jbossas/projects/jboss-jca/trunk/common/src/main/resources/schema/datasources_1_0.xsd

     

    You can check out the H2TestCase on how to deploy a datasource:

     

    http://anonsvn.jboss.org/repos/jbossas/projects/jboss-jca/trunk/adapters/src/test/java/org/jboss/jca/adapters/jdbc/unit/H2TestCase.java

     

    Having said that, start with a standard resource adapter (!= datasource) - you can create one using the code generator in docs/codegenerator - the key is to create a JCA 1.6 resource adapter with confidential and dynamic properties and which is bidirectional.

  • 4. Re: IronJacamar RHQ plugin development
    Lin Gao Newbie

    The H2TestCase does not pass because of an exception:

     

    11:49:03,176 INFO  [STDERR] Caused by: org.jboss.jca.common.api.validator.ValidateException: jndiName (xml attribure jndi-name) is required in org.jboss.jca.common.metadata.ds.DataSourceImpl
    11:49:03,176 INFO  [STDERR]     at org.jboss.jca.common.metadata.ds.DataSourceAbstractImpl.partialCommonValidation(DataSourceAbstractImpl.java:242)
    11:49:03,176 INFO  [STDERR]     at org.jboss.jca.common.metadata.ds.DataSourceAbstractImpl.<init>(DataSourceAbstractImpl.java:134)
    11:49:03,176 INFO  [STDERR]     at org.jboss.jca.common.metadata.ds.DataSourceImpl.<init>(DataSourceImpl.java:89)
    11:49:03,176 INFO  [STDERR]     at org.jboss.jca.common.metadata.ds.DsParser.parseDataSource(DsParser.java:365)
    11:49:03,176 INFO  [STDERR]     at org.jboss.jca.common.metadata.ds.DsParser.parseDataSources(DsParser.java:157)
    11:49:03,176 INFO  [STDERR]     at org.jboss.jca.common.metadata.ds.DsParser.parse(DsParser.java:112)
    11:49:03,176 INFO  [STDERR]     at org.jboss.jca.common.metadata.ds.DsParser.parse(DsParser.java:75)
    11:49:03,176 INFO  [STDERR]     at org.jboss.jca.deployers.fungal.DsXmlDeployer.deploy(DsXmlDeployer.java:157)
    11:49:03,177 INFO  [STDERR]     ... 20 more
    

     

     

    please see the attached unit test report for more detail information.

  • 5. Re: IronJacamar RHQ plugin development
    Lin Gao Newbie

    I got the reason:

     

    org.jboss.jca.common.metadata.AbstractParser.attributeAsString(XMLStreamReader reader, String attributeName){
        return reader.getAttributeValue("", attributeName) == null ? null : reader.getAttributeValue("", attributeName)
                .trim();
    
    }
    

     

     

    should be changed to:

     

    org.jboss.jca.common.metadata.AbstractParser.attributeAsString(XMLStreamReader reader, String attributeName){
        return reader.getAttributeValue(null, attributeName) == null ? null : reader.getAttributeValue(null, attributeName)
                .trim();
    
    }
    

     

     

    For the namespaceURI in method

    XMLStreamReader.getAttributeValue(String namespaceURI, String attributeName)
    

     

      If the namespaceURI is null the namespace is not checked for equality

  • 6. Re: IronJacamar RHQ plugin development
    Lin Gao Newbie

    Two questions:

     

      1.  When a .rar is deployed, both RADeployer and RAActivator will be used to deploy the file in turn, thus 2 managed connectors are registered to the ManagementRepository for the same .rar file.  And only the one registered by RAActivator has the ManagedConnectionFactory.

     

        Is it correct?

     

    16:50:07,698 DEBUG [RADeployer] Deploying: file:/tmp/embeddedjca/localtransaction.rar
    16:50:10,000 DEBUG [MetadataFactory] Total parse for /tmp/iron.jacamar/tmp/localtransaction.rar/META-INF/ra.xml took 2300 ms
    16:50:10,006 DEBUG [RADeployer] Activated: file:/tmp/embeddedjca/localtransaction.rar
    16:50:10,007 DEBUG [RAActivator] Deploying: file:/tmp/embeddedjca/localtransaction.rar
    16:50:10,017 DEBUG [BaseManagedConnectionFactory] call setLogWriter
    16:50:10,047 DEBUG [TestManagedConnectionFactory] call createConnectionFactory
    16:50:10,070 DEBUG [SimpleJndiStrategy] Bound org.jboss.jca.test.deployers.spec.rars.BaseCciConnectionFactory under java:/eis/localtransaction
    16:50:10,071 INFO  [RAActivator] Bound connection factory under: java:/eis/localtransaction
    16:50:10,102 INFO  [RAActivator] Deployed: file:/tmp/embeddedjca/localtransaction.rar
    

     

     

     

      2.  The managedconnectionfactory-class will be defined in META-INF/ra.xml, and the class will be put on the jar file which will be put on the rar file. so shall we need the jar file in the classpath out side of the rar file? I copied the rar file generated by the Ra10dtdoutTestCase to the IronJacamar sjc/deploy directory, it complains ClassNotFoundException:

     

    16:46:01,595 WARNING [Fungal] Deployment org.jboss.jca.test.deployers.spec.rars.ra10dtdout.TestManagedConnectionFactory failed: com.github.fungal.spi.deployers.DeployException: Deployment org.jboss.jca.test.deployers.spec.rars.ra10dtdout.TestManagedConnectionFactory failed
            at org.jboss.jca.deployers.fungal.RAActivator.deploy(RAActivator.java:284)
            at org.jboss.jca.deployers.fungal.RAActivator.postDeploy(RAActivator.java:159)
            at com.github.fungal.impl.KernelImpl.postDeploy(KernelImpl.java:1423)
            at com.github.fungal.impl.KernelImpl.startup(KernelImpl.java:554)
            at org.jboss.jca.sjc.Main.boot(Main.java:109)
            at org.jboss.jca.sjc.Main.main(Main.java:286)
    Caused by: java.lang.ClassNotFoundException: org.jboss.jca.test.deployers.spec.rars.ra10dtdout.TestManagedConnectionFactory
            at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
            at com.github.fungal.impl.classloader.ParentFirstClassLoader.loadClass(ParentFirstClassLoader.java:66)
            at com.github.fungal.impl.classloader.ParentFirstClassLoader.loadClass(ParentFirstClassLoader.java:66)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:264)
            at org.jboss.jca.deployers.fungal.AbstractFungalRADeployer.initAndInject(AbstractFungalRADeployer.java:124)
            at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:841)
            at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:723)
            at org.jboss.jca.deployers.fungal.RAActivator.deploy(RAActivator.java:264)
            ... 5 more
    

     

     

    I attached the rar file with name: localtransaction.rar

  • 7. Re: IronJacamar RHQ plugin development
    Lin Gao Newbie

    Another question:

     

      When DsXmlDeployer is used to deploy "*-ds.xml", it works after fixing the XMLStreamReader.getAttributeValue() issue mentioned in above comment, but there is no managed Connector registered to ManagementRepository. Should it be? if not, how to get the deployed datasources ?

  • 8. Re: IronJacamar RHQ plugin development
    Jesper Pedersen Master

    1.  When a .rar is deployed, both RADeployer and RAActivator will be used to deploy the file in turn, thus 2 managed connectors are registered to the ManagementRepository for the same .rar file.  And only the one registered by RAActivator has the ManagedConnectionFactory.

     

    It depends on how you deploy the file - I suggest that you include an ironjacamar.xml file in the .rar archive where you specify the JNDI bindings. That way RAActivator won't pick up the archive.

     

    Another solution is to disable the RAActivator bean - see the user guide - deploy the archive, and then deploy the -ra.xml file with the JNDI bindings.

     

    The managedconnectionfactory-class will be defined in META-INF/ra.xml, and the class will be put on the jar file which will be put on the rar file. so shall we need the jar file in the classpath out side of the rar file?

     

    No, the .rar archive must be self-contained - e.g. contain all classes. The localtransaction.rar you have attached is incorrect, since it only contains two classes.

     

    I suggest to use the code generator to generate the test archives you need - or use the helloworld example that is in the documentation.

  • 9. Re: IronJacamar RHQ plugin development
    Jesper Pedersen Master

    When DsXmlDeployer is used to deploy "*-ds.xml", it works after fixing the XMLStreamReader.getAttributeValue() issue mentioned in above comment, but there is no managed Connector registered to ManagementRepository. Should it be? if not, how to get the deployed datasources ?

     

    Datasources are a special case, and are therefore not currently registered in the ManagementRepository. We will get to that later once the RHQ infrastructure is up and running.

     

    Start with a standard resource adapter, f.ex. one that is generated by the code generator.

  • 10. Re: IronJacamar RHQ plugin development
    Stefano Maestri Expert

    Hi Lin Gao,

     

    That test is working perfectly on my laptop. We had experienced problems with another contributor using an old version of OpenJDK (in particular was rhel-1.16.b17.el5-x86_64). Any problems have gone away upgrading OpenJDK to latest version or using Sun JDK. Can you try one of these solutions?

     

    regards

    S.

  • 11. Re: IronJacamar RHQ plugin development
    Lin Gao Newbie
    We had experienced problems with another contributor using an old version of OpenJDK (in particular was rhel-1.16.b17.el5-x86_64). Any problems have gone away upgrading OpenJDK to latest version or using Sun JDK.

     

    Yes, the unit tests work perfectly when I using Sun JDK.

     

      Thanks, Stefano.

  • 12. Re: IronJacamar RHQ plugin development
    Lin Gao Newbie

    I can deploy the rar generated using code generator successfully.

     

    Next step for me is to get the jndi name of the connection factories, and the transaction support type of the connection factories, from ManagementRepository class. But it seems that the ManagementRepository does not provide such methods, any idea on this?

  • 13. Re: IronJacamar RHQ plugin development
    Jesper Pedersen Master

    Start with the information already available in the ManagementRepository.

     

    Connector
      - ResourceAdapter
        - ConfigProperty
        - (operations)
      - ManagedConnectionFactory
        - ConfigProperty
        - PoolConfiguration
        - Pool
        - (operations)
      - AdminObject
        - ConfigProperty
    

     

    The above will give an overview of the deployed resource adapters. Just start with a read-only view of the model.

     

    We need to see if the current model will work in all scenarios before we expand it with new information - stuff like statistics aren't included yet either.

  • 14. Re: IronJacamar RHQ plugin development
    Lin Gao Newbie

    no_tx_mcf_config.png

    Diagram above is the screenshot of current implementation of the proof of concept code.

     

    The localtransaction.rar/notransaction.rar/xatransaction.rar are the real data generated using the code generator(all of them are JCA 1.6), and deployed in the EmbeddedJCA container.

     

    Each .rar in the diagram represents a connector, and the string displayed here is the uniqueId of the connector.

     

    There is one ManageConnectionFactory instance for each .rar deployment in this case, and they are accessible from RHQ plugin, but I don`t know how to display them, here the 'No Tx ConnectionFactory' is the faked data. So I need a string to display them and identify them. Jndi name is the best choice I think, so I need a way to get the jndi name from org.jboss.jca.core.api.management package.

1 2 3 Previous Next