Chemistry
  1. Chemistry
  2. CMIS-250

Issue in Apache Felix OSGi with JAXBHelper

    Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 0.1.0-incubating
    • Fix Version/s: None
    • Labels:
    • Environment:

      Java(TM) SE Runtime Environment(build 1.6.0_18-b07)
      Apache Felix Day CQ 5.3 distribution
      Apache Felix System Framework 2.0.2

      Description

      When running within the Apache Felix environment sessionFactory.createSession(parameter) fails. Same code runs fine in plan Java VM with the provided jaxb and stax libraries.

      Probably an issue in my OSGI environment setup, is there a guide about which bundles to include when using OSGi environments?

      INFO* [pool-5-thread-32] org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl Session Parameters:

      {org.apache.chemistry.opencmis.locale.iso3166=, org.apache.chemistry.opencmis.binding.spi.type=atompub, org.apache.chemistry.opencmis.locale.variant=US, org.apache.chemistry.opencmis.user=admin, org.apache.chemistry.opencmis.locale.iso639=en, org.apache.chemistry.opencmis.binding.atompub.url=http://16.23.86.138:7402/cmis/repository, org.apache.chemistry.opencmis.session.repository.id=CRX, org.apache.chemistry.opencmis.password=admin}

      INFO [pool-5-thread-32] org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl Session Locale: en__US
      INFO [pool-5-thread-32] org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl Session Cache Size: 1000
      ERROR [pool-5-thread-32] java.lang.Class The server url http://16.23.86.138:7402/cmis/repository is unreachable. org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: Parsing exception!
      at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.parse(AbstractAtomPubService.java:460)
      at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getRepositoriesInternal(AbstractAtomPubService.java:636)
      at org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getRepositoryInfo(RepositoryServiceImpl.java:79)
      at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getRepositoryInfo(RepositoryServiceImpl.java:69)
      at org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl.connect(PersistentSessionImpl.java:525)
      at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.createSession(SessionFactoryImpl.java:86)
      at com.hp.extream.document.cmis.CMISRepositoryImpl.getRepository(CMISRepositoryImpl.java:127)
      at com.hp.extream.document.cmis.CMISRepositoryImpl.getRepository(CMISRepositoryImpl.java:151)
      at com.hp.dls.workflow.activity.gaic.CMISArchiveStep.execute(CMISArchiveStep.java:267)
      at com.day.cq.workflow.impl.job.HandlerBase.executeProcess(HandlerBase.java:184)
      at com.day.cq.workflow.impl.job.JobHandler.process(JobHandler.java:131)
      at org.apache.sling.event.EventUtil$1.run(EventUtil.java:368)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.NullPointerException
      at org.apache.chemistry.opencmis.commons.impl.JaxBHelper.createUnmarshaller(JaxBHelper.java:91)
      at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.unmarshalElement(AtomPubParser.java:347)
      at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parseWorkspaceElement(AtomPubParser.java:399)
      at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parseWorkspace(AtomPubParser.java:172)
      at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parseServiceDoc(AtomPubParser.java:142)
      at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parse(AtomPubParser.java:106)
      at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.parse(AbstractAtomPubService.java:458)
      ... 14 more

        Activity

        Hide
        Florian Müller added a comment -

        This doesn't seem to be a problem with the libraries. It is trying to access a static variable that is null. It looks like the OpenCMIS jars are loaded by different class loaders.

        Are there any Apache Felix/OSGI experts here that could verify that?

        Show
        Florian Müller added a comment - This doesn't seem to be a problem with the libraries. It is trying to access a static variable that is null. It looks like the OpenCMIS jars are loaded by different class loaders. Are there any Apache Felix/OSGI experts here that could verify that?
        Hide
        Galo Gimenez added a comment -

        1. the client bundle had another copy of the libs which resulted in the static variable not initialized

        2. used "SessionFactory sessionFactory = (SessionFactory) context.getBundleContext().getService(ref)" to avoid importing org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl which isn't exported by the libs.

        Show
        Galo Gimenez added a comment - 1. the client bundle had another copy of the libs which resulted in the static variable not initialized 2. used "SessionFactory sessionFactory = (SessionFactory) context.getBundleContext().getService(ref)" to avoid importing org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl which isn't exported by the libs.
        Hide
        Galo Gimenez added a comment -

        Sorry, I keep having the issue. My mistake closing it before. The CONTEXT variable is null because following call fails

        JAXBContext.newInstance(ObjectFactory.class, CMISExtraObjectFactory.class)

        This is the stack trace...

        com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
        javax.activation.DataHandler does not have a no-arg default constructor.
        this problem is related to the following location:
        at javax.activation.DataHandler
        at protected javax.activation.DataHandler org.apache.chemistry.opencmis.commons.impl.jaxb.CmisContentStreamType.stream
        at org.apache.chemistry.opencmis.commons.impl.jaxb.CmisContentStreamType
        at public org.apache.chemistry.opencmis.commons.impl.jaxb.CmisContentStreamType org.apache.chemistry.opencmis.commons.impl.jaxb.ObjectFactory.createCmisContentStreamType()
        at org.apache.chemistry.opencmis.commons.impl.jaxb.ObjectFactory

        at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source)
        at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source)
        at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
        at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source)
        at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
        at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
        at javax.xml.bind.ContextFinder.find(Unknown Source)
        at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
        at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
        at org.apache.chemistry.opencmis.commons.impl.JaxBHelper.<clinit>(JaxBHelper.java:56)

        Show
        Galo Gimenez added a comment - Sorry, I keep having the issue. My mistake closing it before. The CONTEXT variable is null because following call fails JAXBContext.newInstance(ObjectFactory.class, CMISExtraObjectFactory.class) This is the stack trace... com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions javax.activation.DataHandler does not have a no-arg default constructor. this problem is related to the following location: at javax.activation.DataHandler at protected javax.activation.DataHandler org.apache.chemistry.opencmis.commons.impl.jaxb.CmisContentStreamType.stream at org.apache.chemistry.opencmis.commons.impl.jaxb.CmisContentStreamType at public org.apache.chemistry.opencmis.commons.impl.jaxb.CmisContentStreamType org.apache.chemistry.opencmis.commons.impl.jaxb.ObjectFactory.createCmisContentStreamType() at org.apache.chemistry.opencmis.commons.impl.jaxb.ObjectFactory at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at javax.xml.bind.ContextFinder.newInstance(Unknown Source) at javax.xml.bind.ContextFinder.find(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at org.apache.chemistry.opencmis.commons.impl.JaxBHelper.<clinit>(JaxBHelper.java:56)
        Hide
        Florian Müller added a comment -

        That looks like it uses the wrong libraries. Could you put all JAX-WS and JAX-B jars in your endorsed directory and see if that works? That is not really a solution but helps to track down the problem.

        Show
        Florian Müller added a comment - That looks like it uses the wrong libraries. Could you put all JAX-WS and JAX-B jars in your endorsed directory and see if that works? That is not really a solution but helps to track down the problem.
        Hide
        Galo Gimenez added a comment -

        In my environment Day Apache Felix OSGi (Sling) the JAX-B and JAX-WS are exported by the System bundle, that seems to be configured to export the Sun jars, from JVM 1.6

        BTW: I build my jars in Ubuntu with JVM 1.6 64bit and run my tests on a Windows JVM 1.6 32bits.

        Show
        Galo Gimenez added a comment - In my environment Day Apache Felix OSGi (Sling) the JAX-B and JAX-WS are exported by the System bundle, that seems to be configured to export the Sun jars, from JVM 1.6 BTW: I build my jars in Ubuntu with JVM 1.6 64bit and run my tests on a Windows JVM 1.6 32bits.
        Hide
        Florian Müller added a comment -

        The JVM 1.6 JAX-B and JAX-WS implementations are "not good enough". OpenCMIS requires JAX-WS 2.1.6 or higher.

        Show
        Florian Müller added a comment - The JVM 1.6 JAX-B and JAX-WS implementations are "not good enough". OpenCMIS requires JAX-WS 2.1.6 or higher.
        Hide
        Galo Gimenez added a comment -

        I have tried to add latest JAXB and JAXWS OSGi budnles from SpringSource, I do not think I have been successful at all.

        The com.bea.xml.stream.MXParserFactory seems to be related to a missing implementation of JAX-WS RT but I can not find an implementation that works in OSGi.

        ERROR* [127.0.0.1 [1285157318454] GET /galo/cmis HTTP/1.1] com.galo.cmis.rest.CMISRepositoryServlet Exception in servlet javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.MXParserFactory not found
        at javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:178)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
        at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:136)
        at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parse(AtomPubParser.java:80)
        at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.parse(AbstractAtomPubService.java:458)
        at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getRepositoriesInternal(AbstractAtomPubService.java:636)
        at org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getRepositoryInfo(RepositoryServiceImpl.java:79)
        at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getRepositoryInfo(RepositoryServiceImpl.java:69)
        at org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl.connect(PersistentSessionImpl.java:525)
        at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.createSession(SessionFactoryImpl.java:86)
        at com.galo.cmis.impl.CMISRepositoryImpl.getRepository(CMISRepositoryImpl.java:161)

        Show
        Galo Gimenez added a comment - I have tried to add latest JAXB and JAXWS OSGi budnles from SpringSource, I do not think I have been successful at all. The com.bea.xml.stream.MXParserFactory seems to be related to a missing implementation of JAX-WS RT but I can not find an implementation that works in OSGi. ERROR* [127.0.0.1 [1285157318454] GET /galo/cmis HTTP/1.1] com.galo.cmis.rest.CMISRepositoryServlet Exception in servlet javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.MXParserFactory not found at javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72) at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:178) at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92) at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:136) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parse(AtomPubParser.java:80) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.parse(AbstractAtomPubService.java:458) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getRepositoriesInternal(AbstractAtomPubService.java:636) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getRepositoryInfo(RepositoryServiceImpl.java:79) at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getRepositoryInfo(RepositoryServiceImpl.java:69) at org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl.connect(PersistentSessionImpl.java:525) at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.createSession(SessionFactoryImpl.java:86) at com.galo.cmis.impl.CMISRepositoryImpl.getRepository(CMISRepositoryImpl.java:161)
        Hide
        Florian Müller added a comment -

        I can just guess here ... but this looks different. That's a problem with the StAX parser.
        Could you also add the latest StAX OSGi bundle and try again?

        Show
        Florian Müller added a comment - I can just guess here ... but this looks different. That's a problem with the StAX parser. Could you also add the latest StAX OSGi bundle and try again?

          People

          • Assignee:
            Unassigned
            Reporter:
            Galo Gimenez
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development