Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
6 replies Latest Post - ‏2012-11-21T19:13:00Z by Jacek_Laskowski
Jacek_Laskowski
Jacek_Laskowski
133 Posts
ACCEPTED ANSWER

Pinned topic Why http://aries.apache.org/xmlns/jpa/v1.0.0 not v1.1.0?

‏2012-11-21T14:55:32Z |
Hi,

While tracing Liberty Profile, I've noticed the following:

[11/21/12 15:13:35:548 CET] 00000017 id=         pache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl 1 addingService Adding NamespaceHandler 
{org.apache.aries.blueprint.NamespaceHandler
}=
{osgi.service.blueprint.compname=namespaceHandler, osgi.service.blueprint.namespace=[http:
//aries.apache.org/xmlns/jpa/v1.0.0,http://aries.apache.org/xmlns/jpa/v1.1.0], service.id=283}

I can however see that the LP tools added xmlns:bpjpa="http://aries.apache.org/xmlns/jpa/v1.0.0" to blueprint.xml.

Shouldn't http://aries.apache.org/xmlns/jpa/v1.1.0 be used instead?

Jacek
Japila :: verba docent, exempla trahunt
  • Emily Jiang
    Emily Jiang
    10 Posts
    ACCEPTED ANSWER

    Re: Why http://aries.apache.org/xmlns/jpa/v1.0.0 not v1.1.0?

    ‏2012-11-21T15:22:04Z  in response to Jacek_Laskowski
    Hi Jacek,

    Both jpa(ns:http://aries.apache.org/xmlns/jpa/v1.0.0) and jpa2(ns:http://aries.apache.org/xmlns/jpa/v1.1.0) are supported in liberty, which was shown in the trace you attached. If your app uses jpa, the jpa v1.0.0 ns should be declared in the blueprint.xml.

    Therefore, it purely depends on your app whether it uses jpa and jpa2 and you choose different namespace for the blueprint xml instead. I don't quite understand your suggestion for the tool to populate jpa2 namespace instead.

    Thanks
    Emily
    • Jacek_Laskowski
      Jacek_Laskowski
      133 Posts
      ACCEPTED ANSWER

      Re: Why http://aries.apache.org/xmlns/jpa/v1.0.0 not v1.1.0?

      ‏2012-11-21T15:44:21Z  in response to Emily Jiang
      Hi,

      Thanks Emily for the prompt response! It helps a lot, but then led to some other questions.

      I did not add the namespace myself, but used Eclipse with the LP developer tools. There was no way to switch between versions - 1.0.0 vs 1.1.0 - and the only way to select any version was to check the available checkboxes in the configuration panel which enabled 1.0.0. I think it should be fixed in one way or the other.

      It's also not clear from the versions that the former is for JPA 1.0 and the other for JPA 2.0. Why should I even bother with JPA 1.0 since the only feature available for LP is jpa-2.0 and JPA 2.0 is backward-compatible? Why should I have the choice for development? I understand having the support for runtime, but development not necessarily.

      Jacek
      Japila :: verba docent, exempla trahunt
      • Jacek_Laskowski
        Jacek_Laskowski
        133 Posts
        ACCEPTED ANSWER

        Re: Why http://aries.apache.org/xmlns/jpa/v1.0.0 not v1.1.0?

        ‏2012-11-21T15:52:56Z  in response to Jacek_Laskowski
        Hi,

        When I use v1.1.0 the blueprint editor tells me that "cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'bpjpa:unit'." What does it mean? Could you decipher it for me, please?
        
        <?xml version=
        "1.0" encoding=
        "UTF-8"?> <blueprint xmlns=
        "http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:bpjpa=
        "http://aries.apache.org/xmlns/jpa/v1.1.0" xmlns:bptx=
        "http://aries.apache.org/xmlns/transactions/v1.0.0"> <bean id=
        "DefaultItemDaoBean" class=
        "liberty.jpa.service.impl.DefaultItemDao" init-method=
        "init"> <bpjpa:unit property=
        "emf" unitname=
        "mysqlPU" /> </bean> <service id=
        "DefaultItemDaoBeanService" ref=
        "DefaultItemDaoBean" interface=
        "liberty.jpa.service.ItemDAO" /> </blueprint>
        


        Jacek
        Japila :: verba docent, exempla trahunt
        • Jacek_Laskowski
          Jacek_Laskowski
          133 Posts
          ACCEPTED ANSWER

          Re: Why http://aries.apache.org/xmlns/jpa/v1.0.0 not v1.1.0?

          ‏2012-11-21T16:39:53Z  in response to Jacek_Laskowski
          Hi,

          Regardless of the namespace in use - http://aries.apache.org/xmlns/jpa/v1.0.0 or http://aries.apache.org/xmlns/jpa/v1.1.0, I'm getting the following exception in a ffdc:
          
          ------Start of DE processing------ = [11/21/12 17:33:11:100 CET] Exception = org.apache.aries.application.modelling.ModellerException Source = com.ibm.ws.eba.bundle.repository.internal.BundleRepositoryImpl probeid = 327 Stack Dump = org.apache.aries.application.modelling.ModellerException: org.apache.aries.application.modelling.ModellerException: org.osgi.service.blueprint.container.ComponentDefinitionException: Unsupported node namespace: http:
          //aries.apache.org/xmlns/jpa/v1.1.0 at org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl.getServiceElements(ModelledResourceManagerImpl.java:128) at org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl.getServiceElements(ModelledResourceManagerImpl.java:95) at Proxy7c939520_a92c_4407_ad93_dc464f14963d.getServiceElements(Unknown Source) at com.ibm.ws.eba.bundle.repository.internal.ResourceModellingUtils.model(ResourceModellingUtils.java:100) at com.ibm.ws.eba.bundle.repository.internal.ResourceModellingUtils.model(ResourceModellingUtils.java:148) at com.ibm.ws.eba.bundle.repository.internal.BundleRepositoryImpl.modelJars(BundleRepositoryImpl.java:321) at com.ibm.ws.eba.bundle.repository.internal.BundleRepositoryImpl.updateRepository(BundleRepositoryImpl.java:345) at com.ibm.ws.eba.bundle.repository.internal.BundleRepositoryImpl.updateFilesetConfigs(BundleRepositoryImpl.java:161) at com.ibm.ws.eba.bundle.repository.internal.BundleRepositoryFactory$2.call(BundleRepositoryFactory.java:124) at com.ibm.ws.eba.bundle.repository.internal.BundleRepositoryFactory$2.call(BundleRepositoryFactory.java:122) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398) at com.ibm.ws.threading.internal.Worker.run(Worker.java:380) at java.lang.Thread.run(Thread.java:722) Caused by: org.apache.aries.application.modelling.ModellerException: org.osgi.service.blueprint.container.ComponentDefinitionException: Unsupported node namespace: http:
          //aries.apache.org/xmlns/jpa/v1.1.0 at org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl.getBlueprintServiceElements(ModelledResourceManagerImpl.java:148) at org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl.getServiceElements(ModelledResourceManagerImpl.java:117) ... 14 more Caused by: org.osgi.service.blueprint.container.ComponentDefinitionException: Unsupported node namespace: http:
          //aries.apache.org/xmlns/jpa/v1.1.0 at org.apache.aries.blueprint.parser.Parser.getNamespaceHandler(Parser.java:1293) at org.apache.aries.blueprint.parser.Parser.getNamespaceHandler(Parser.java:1284) at org.apache.aries.blueprint.parser.Parser.decorateCustomNode(Parser.java:1271) at org.apache.aries.blueprint.parser.Parser.handleCustomElements(Parser.java:1263) at org.apache.aries.blueprint.parser.Parser.parseBeanMetadata(Parser.java:601) at org.apache.aries.blueprint.parser.Parser.parseBlueprintElement(Parser.java:393) at org.apache.aries.blueprint.parser.Parser.loadComponents(Parser.java:326) at org.apache.aries.blueprint.parser.Parser.populate(Parser.java:277) at org.apache.aries.blueprint.container.ParserServiceImpl.validateAndPopulate(ParserServiceImpl.java:84) at org.apache.aries.blueprint.container.ParserServiceImpl.parse(ParserServiceImpl.java:71) at org.apache.aries.blueprint.container.ParserServiceImpl.parse(ParserServiceImpl.java:65) at Proxy7f125b14_913e_4704_b403_8a8b832eb2f4.parse(Unknown Source) at org.apache.aries.application.modelling.impl.ParserProxyImpl.parseCDR(ParserProxyImpl.java:47) at org.apache.aries.application.modelling.impl.AbstractParserProxy.parseAllServiceElements(AbstractParserProxy.java:89) at org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl.getBlueprintServiceElements(ModelledResourceManagerImpl.java:140) ... 15 more
          


          Jacek
          Japila :: verba docent, exempla trahunt
          • Emily Jiang
            Emily Jiang
            10 Posts
            ACCEPTED ANSWER

            Re: Why http://aries.apache.org/xmlns/jpa/v1.0.0 not v1.1.0?

            ‏2012-11-21T17:20:41Z  in response to Jacek_Laskowski
            There is a PMR for this issue. It is random error, isn't it? It is caused by the blueprint container asynchronously registering the namespace handler service in the service registry. If your app starts before the namespace handler service is available, you will get this error. We are working towards a fix.

            Can you try the following workaround?

            Remove the jpa namespace and the injection from the blueprint.xml but use annotation in your java code e.g. @PersistenceContext(unitName="your persistence unit name") before your method of
            public void setEntityManager(EntityManager e)

            Thanks
            Emily