elastic / apm-agent-java

https://www.elastic.co/guide/en/apm/agent/java/current/index.html
Apache License 2.0
567 stars 321 forks source link

karaf error when using apm 1.3.0 #436

Closed philippkahr closed 5 years ago

philippkahr commented 5 years ago

Hallo folks,

sadly, I have to open a bug report regarding the APM 1.3.0. I sadly don't know if it has worked with any other version before, but it seems to be an issue regarding "Apache Karaf". Hopefully some of you can jump in and resolve this matter, so we can use the elastic jvm apm.

Describe the bug Nexus OSS 3.15.1 & 3.14.0 won't start after adding APM 1.3.0 as a java option. I tried it with the UNIX and Mac version. Error Log can be found down further down.

java -version :( java version "1.8.0_151" Java(TM) SE Runtime Environment (build 1.8.0_151-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

To Reproduce Steps to reproduce the behaviour: When I write /nexus, the / refers to the top directory when the tar.gz is extracted.

  1. Download nexus oss 3.15.1 from sonatype (https://www.sonatype.com/nexus-repository-oss)
  2. Download elastic-apm-1.3.0.jar
  3. Use default nexus oss config
  4. Add the apm as javaagent in /nexus/bin/nexus.vmoptions
  5. Start nexus with /nexus/bin/nexus start
  6. See error from JVM in /sonatype-work/nexus3/log/jvm.log
  7. See error from nexus in/sonatype-work/nexus3/log/nexus.log

Expected behaviour Even when adding elastic-apm-1.3.0.jar, nexus oss should start properly.

Debug logs Attach your debug logs. See the documentation about how to enable debug logging.

Click to expand **NEXUS** ``` ❱ cat ../../sonatype-work/nexus3/log/nexus.log 2019-01-21 21:23:25,830+0100 INFO [FelixStartLevel] *SYSTEM org.sonatype.nexus.pax.logging.NexusLogActivator - start 2019-01-21 21:23:26,476+0100 ERROR [FelixDispatchQueue] *SYSTEM org.apache.karaf.features.core - FrameworkEvent ERROR - org.apache.karaf.features.core org.osgi.framework.BundleException: Activator start error in bundle org.apache.karaf.features.core [32]. at org.apache.felix.framework.Felix.activateBundle(Felix.java:2288) at org.apache.felix.framework.Felix.startBundle(Felix.java:2144) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1371) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NoClassDefFoundError: com/sun/xml/internal/bind/DatatypeConverterImpl at org.apache.karaf.features.internal.model.Dependency_JaxbXducedAccessor_prerequisite.parse(TransducedAccessor_field_Boolean.java:48) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:195) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.ProxyLoader.startElement(ProxyLoader.java:45) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:559) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:538) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:60) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:153) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:229) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:266) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:235) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:266) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:235) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:112) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:95) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:356) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:337) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:127) at org.apache.karaf.features.internal.model.JaxbUtil.unmarshalValidate(JaxbUtil.java:133) at org.apache.karaf.features.internal.model.JaxbUtil.unmarshal(JaxbUtil.java:101) at org.apache.karaf.features.internal.service.RepositoryImpl.load(RepositoryImpl.java:94) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.loadRepository(FeaturesServiceImpl.java:451) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:467) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:462) at org.apache.karaf.features.internal.service.BootFeaturesInstaller.installBootFeatures(BootFeaturesInstaller.java:101) at org.apache.karaf.features.internal.service.BootFeaturesInstaller.start(BootFeaturesInstaller.java:90) at org.apache.karaf.features.internal.osgi.Activator.doStart(Activator.java:268) at org.apache.karaf.util.tracker.BaseActivator.start(BaseActivator.java:86) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697) at org.apache.felix.framework.Felix.activateBundle(Felix.java:2238) ... 4 common frames omitted Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.DatatypeConverterImpl not found by org.apache.karaf.features.core [32] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1550) at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 33 common frames omitted ``` **JVM** ``` cat ../../sonatype-work/nexus3/log/jvm.log Java HotSpot(TM) 64-Bit Server VM 25.181-b13 Java HotSpot(TM) 64-Bit Server VM (25.181-b13) for bsd-amd64 JRE (1.8.0_181-b13), built on Jul 7 2018 01:02:31 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) -Dinstall4j.jvmDir=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre -Dexe4j.moduleName=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/bin/nexus -XX:+UnlockDiagnosticVMOptions -Dinstall4j.launcherId=245 -Dinstall4j.swt=false -Di4jv=0 -Di4jv=0 -Di4jv=0 -Di4jv=0 -Di4jv=0 -Xms1200M -Xmx1200M -XX:MaxDirectMemorySize=2G -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+LogVMOutput -XX:LogFile=../sonatype-work/nexus3/log/jvm.log -XX:-OmitStackTraceInFastThrow -Djava.net.preferIPv4Stack=true -Dkaraf.home=. -Dkaraf.base=. -Dkaraf.etc=etc/karaf -Djava.util.logging.config.file=etc/karaf/java.util.logging.properties -Dkaraf.data=../sonatype-work/nexus3 -Djava.io.tmpdir=../sonatype-work/nexus3/tmp -Dkaraf.startLocalConsole=false -javaagent:/Users/pkahr/Downloads/elastic-apm-agent-1.3.0.jar -Di4j.vpt=true com.install4j.runtime.launcher.UnixLauncher start 9d17dc87 org.sonatype.nexus.karaf.NexusMain SUN_STANDARD java.vm.specification.name=Java Virtual Machine Specification java.vm.version=25.181-b13 java.vm.name=Java HotSpot(TM) 64-Bit Server VM java.vm.info=mixed mode, sharing java.ext.dirs=/Users/pkahr/Library/Java/Extensions:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java java.endorsed.dirs=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/endorsed sun.boot.library.path=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib java.library.path=/Users/pkahr/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. java.home=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre java.class.path=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/i4jruntime.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/lib/boot/nexus-main.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/lib/boot/org.apache.karaf.main-4.0.9.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/lib/boot/org.osgi.core-6.0.0.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/lib/boot/org.apache.karaf.diagnostic.boot-4.0.9.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/lib/boot/org.apache.karaf.jaas.boot-4.0.9.jar sun.boot.class.path=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/resources.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/rt.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/sunrsasign.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/jsse.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/jce.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/charsets.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/jfr.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/classes java.vm.specification.vendor=Oracle Corporation java.vm.specification.version=1.8 java.vm.vendor=Oracle Corporation install4j.jvmDir=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre exe4j.moduleName=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/bin/nexus install4j.launcherId=245 install4j.swt=false i4jv=0 java.net.preferIPv4Stack=true karaf.home=. karaf.base=. karaf.etc=etc/karaf java.util.logging.config.file=etc/karaf/java.util.logging.properties karaf.data=../sonatype-work/nexus3 java.io.tmpdir=../sonatype-work/nexus3/tmp karaf.startLocalConsole=false i4j.vpt=true sun.java.command=com.install4j.runtime.launcher.UnixLauncher start 9d17dc87 org.sonatype.nexus.karaf.NexusMain sun.java.launcher=SUN_STANDARD
felixbarny commented 5 years ago

Hmm, funny thing is, that with any agent below version 1, it works without modifying the sources from nexus oss.

That's interesting. Did it also work with 1.0.0-RC1?

philippkahr commented 5 years ago

With the 1.0.0.-RC1 I do still get the same issue as with anything above 1.0.0.

NEXUS

``` 2019-01-23 14:42:42,926+0100 INFO [FelixStartLevel] *SYSTEM org.sonatype.nexus.pax.logging.NexusLogActivator - start 2019-01-23 14:42:43,602+0100 ERROR [FelixDispatchQueue] *SYSTEM org.apache.karaf.features.core - FrameworkEvent ERROR - org.apache.karaf.features.core org.osgi.framework.BundleException: Activator start error in bundle org.apache.karaf.features.core [32]. at org.apache.felix.framework.Felix.activateBundle(Felix.java:2288) at org.apache.felix.framework.Felix.startBundle(Felix.java:2144) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1371) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NoClassDefFoundError: com/sun/xml/internal/bind/DatatypeConverterImpl at org.apache.karaf.features.internal.model.Dependency_JaxbXducedAccessor_prerequisite.parse(TransducedAccessor_field_Boolean.java:48) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:195) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.ProxyLoader.startElement(ProxyLoader.java:45) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:559) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:538) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:60) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:153) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:229) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:266) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:235) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:266) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:235) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:112) at com.sun.xml.internal.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:95) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:356) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:337) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:127) at org.apache.karaf.features.internal.model.JaxbUtil.unmarshalValidate(JaxbUtil.java:133) at org.apache.karaf.features.internal.model.JaxbUtil.unmarshal(JaxbUtil.java:101) at org.apache.karaf.features.internal.service.RepositoryImpl.load(RepositoryImpl.java:94) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.loadRepository(FeaturesServiceImpl.java:451) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:467) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:462) at org.apache.karaf.features.internal.service.BootFeaturesInstaller.installBootFeatures(BootFeaturesInstaller.java:101) at org.apache.karaf.features.internal.service.BootFeaturesInstaller.start(BootFeaturesInstaller.java:90) at org.apache.karaf.features.internal.osgi.Activator.doStart(Activator.java:268) at org.apache.karaf.util.tracker.BaseActivator.start(BaseActivator.java:86) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697) at org.apache.felix.framework.Felix.activateBundle(Felix.java:2238) ... 4 common frames omitted Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.DatatypeConverterImpl not found by org.apache.karaf.features.core [32] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1550) at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 33 common frames omitted ```

JVM

``` Java HotSpot(TM) 64-Bit Server VM 25.181-b13 Java HotSpot(TM) 64-Bit Server VM (25.181-b13) for bsd-amd64 JRE (1.8.0_181-b13), built on Jul 7 2018 01:02:31 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) -Dinstall4j.jvmDir=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre -Dexe4j.moduleName=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/bin/nexus -XX:+UnlockDiagnosticVMOptions -Dinstall4j.launcherId=245 -Dinstall4j.swt=false -Di4jv=0 -Di4jv=0 -Di4jv=0 -Di4jv=0 -Di4jv=0 -Dkaraf.org.osgi.framework.bootdelegation=co.elastic.apm.agent.* -javaagent:/Users/pkahr/Downloads/elastic-apm-agent-1.3.0.jar -Xms1200M -Xmx1200M -XX:MaxDirectMemorySize=2G -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+LogVMOutput -XX:LogFile=../sonatype-work/nexus3/log/jvm.log -XX:-OmitStackTraceInFastThrow -Djava.net.preferIPv4Stack=true -Dkaraf.home=. -Dkaraf.base=. -Dkaraf.etc=etc/karaf -Djava.util.logging.config.file=etc/karaf/java.util.logging.properties -Dkaraf.data=../sonatype-work/nexus3 -Djava.io.tmpdir=../sonatype-work/nexus3/tmp -Dkaraf.startLocalConsole=false -Di4j.vpt=true com.install4j.runtime.launcher.UnixLauncher start 9d17dc87 org.sonatype.nexus.karaf.NexusMain SUN_STANDARD java.vm.specification.name=Java Virtual Machine Specification java.vm.version=25.181-b13 java.vm.name=Java HotSpot(TM) 64-Bit Server VM java.vm.info=mixed mode, sharing java.ext.dirs=/Users/pkahr/Library/Java/Extensions:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java java.endorsed.dirs=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/endorsed sun.boot.library.path=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib java.library.path=/Users/pkahr/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. java.home=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre java.class.path=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/i4jruntime.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/lib/boot/nexus-main.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/lib/boot/org.apache.karaf.main-4.0.9.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/lib/boot/org.osgi.core-6.0.0.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/lib/boot/org.apache.karaf.diagnostic.boot-4.0.9.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/lib/boot/org.apache.karaf.jaas.boot-4.0.9.jar sun.boot.class.path=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/resources.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/rt.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/sunrsasign.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/jsse.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/jce.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/charsets.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/lib/jfr.jar:/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre/classes java.vm.specification.vendor=Oracle Corporation java.vm.specification.version=1.8 java.vm.vendor=Oracle Corporation install4j.jvmDir=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/.install4j/jre.bundle/Contents/Home/jre exe4j.moduleName=/Users/pkahr/Downloads/nexus-3.15.1-01-mac/nexus-3.15.1-01/bin/nexus install4j.launcherId=245 install4j.swt=false i4jv=0 karaf.org.osgi.framework.bootdelegation=co.elastic.apm.agent.* java.net.preferIPv4Stack=true karaf.home=. karaf.base=. karaf.etc=etc/karaf java.util.logging.config.file=etc/karaf/java.util.logging.properties karaf.data=../sonatype-work/nexus3 java.io.tmpdir=../sonatype-work/nexus3/tmp karaf.startLocalConsole=false i4j.vpt=true sun.java.command=com.install4j.runtime.launcher.UnixLauncher start 9d17dc87 org.sonatype.nexus.karaf.NexusMain sun.java.launcher=SUN_STANDARD
  • Stop messing with the bootdelegation altogether. Users would have to add co.elastic.apm.agent.* explicitly.
  • felixbarny commented 5 years ago

    Could you try to add this system property?

    -Dorg.osgi.framework.bootdelegation=com.sun.*,javax.transaction,javax.transaction.*,javax.xml.crypto,javax.xml.crypto.*,sun.*

    This seems to be the default for nexus. The agent will then append co.elastic.apm.agent.* to that automatically.

    gruselglatz commented 5 years ago

    I see maybe some related issue with Pentaho wich uses Karaf and Felix OSGI.... When i add the agent, only one specific Servlet wont get loaded.

    I tried to add co.elastic.apm.agent.* at the end of osgi.framework.bootdelegation= in the config.properties of karaf in \karaf\etc but it doesnt helped.

    I see this errors when I add the agent:

    2019-05-15 11:30:44,496 [ERROR] 00000000 Unable to start blueprint container for bundle pentaho-camel-snmp [FelixStartLevel] (org.apache.aries.blueprint.container.BlueprintContainerImpl) 
    org.osgi.service.blueprint.container.ComponentDefinitionException: java.lang.NoClassDefFoundError: sun/reflect/ReflectionFactory
        at org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:122)
        at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
        at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)
        at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:682)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:377)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)
        at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:294)
        at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:263)
        at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:253)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
        at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1127)
        at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)
        at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)
        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4429)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2100)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.NoClassDefFoundError: sun/reflect/ReflectionFactory
        at org.apache.aries.proxy.impl.gen.ProxySubclassGenerator.newProxySubclassInstance(ProxySubclassGenerator.java:178)
        at org.apache.aries.proxy.impl.AsmProxyManager.createNewProxy(AsmProxyManager.java:140)
        at org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingInterceptingProxy(AbstractProxyManager.java:75)
        at org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingProxy(AbstractProxyManager.java:40)
        at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.createProxy(AbstractServiceReferenceRecipe.java:338)
        at org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:106)
        ... 24 more
    2019-05-15 11:30:47,095 [ERROR] 00000000 Unable to start blueprint container for bundle pentaho-blueprint-activators-8.1.0.0 [FelixStartLevel] (org.apache.aries.blueprint.container.BlueprintContainerImpl) 
    org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to initialize bean .camelBlueprint.factory.camel-1
        at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:714)
        at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:824)
        at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
        at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
        at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)
        at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:230)
        at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:145)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:754)
        at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelDependenciesFinder.process(CamelNamespaceHandler.java:985)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:529)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:361)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)
        at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:294)
        at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:263)
        at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:253)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
        at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1127)
        at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)
        at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)
        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4429)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2100)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.NoClassDefFoundError: sun/misc/Unsafe
        at org.apache.camel.com.googlecode.concurrentlinkedhashmap.ConcurrentHashMapV8.getUnsafe(ConcurrentHashMapV8.java:4136)
        at org.apache.camel.com.googlecode.concurrentlinkedhashmap.ConcurrentHashMapV8.<clinit>(ConcurrentHashMapV8.java:4101)
        at org.apache.camel.com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.<init>(ConcurrentLinkedHashMap.java:221)
        at org.apache.camel.com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.<init>(ConcurrentLinkedHashMap.java:104)
        at org.apache.camel.com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap$Builder.build(ConcurrentLinkedHashMap.java:1598)
        at org.apache.camel.util.LRUCache.<init>(LRUCache.java:84)
        at org.apache.camel.impl.DefaultEndpointRegistry.<init>(DefaultEndpointRegistry.java:44)
        at org.apache.camel.impl.DefaultCamelContext.<init>(DefaultCamelContext.java:277)
        at org.apache.camel.blueprint.BlueprintCamelContext.<init>(BlueprintCamelContext.java:65)
        at org.apache.camel.blueprint.CamelContextFactoryBean.createContext(CamelContextFactoryBean.java:214)
        at org.apache.camel.blueprint.CamelContextFactoryBean.getContext(CamelContextFactoryBean.java:197)
        at org.apache.camel.blueprint.CamelContextFactoryBean.getContext(CamelContextFactoryBean.java:78)
        at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.getContext(AbstractCamelContextFactoryBean.java:659)
        at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.initLazyLoadTypeConverters(AbstractCamelContextFactoryBean.java:417)
        at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.afterPropertiesSet(AbstractCamelContextFactoryBean.java:170)
        at org.apache.camel.blueprint.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:306)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:297)
        at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:958)
        at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:712)
        ... 29 more
    Caused by: java.lang.ClassNotFoundException: sun.misc.Unsafe not found by org.apache.camel.camel-core [232]
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1556)
        at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1993)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 52 more
    2019-05-15 11:31:09,844 [ERROR] 00000000 Registration skipped for [ServletWebElement{mapping=DefaultServletMapping{httpContextId=null,urlPatterns=null,initParams={},servlet=null, alias=/requirejs-manager/js/require-init.js, servletNamenull}}] due to error during registration [localhost-startStop-1] (org.ops4j.pax.web.extender.whiteboard.internal.WebApplication) 
    java.lang.IllegalArgumentException: Servlet must not be null
        at org.apache.felix.http.base.internal.service.HttpServiceImpl.registerServlet(HttpServiceImpl.java:93)
        at org.ops4j.pax.web.extender.whiteboard.internal.element.ServletWebElement.register(ServletWebElement.java:61)
        at org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.registerWebElement(WebApplication.java:262)
        at org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.registerWebElements(WebApplication.java:239)
        at org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.registerHttpContext(WebApplication.java:229)
        at org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.serviceChanged(WebApplication.java:164)
        at org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.serviceChanged(WebApplication.java:51)
        at org.ops4j.pax.web.extender.whiteboard.internal.util.tracker.ReplaceableService.bind(ReplaceableService.java:72)
        at org.ops4j.pax.web.extender.whiteboard.internal.util.tracker.ReplaceableService$Customizer.addingService(ReplaceableService.java:87)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:932)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:864)
        at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
        at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
        at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:894)
        at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:943)
        at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:794)
        at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:544)
        at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4445)
        at org.apache.felix.framework.Felix.registerService(Felix.java:3431)
        at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346)
        at org.apache.felix.http.base.internal.HttpServiceController.register(HttpServiceController.java:140)
        at org.apache.felix.http.base.internal.DispatcherServlet.init(DispatcherServlet.java:47)
        at org.apache.felix.http.proxy.DispatcherTracker.initDispatcher(DispatcherTracker.java:97)
        at org.apache.felix.http.proxy.DispatcherTracker.setDispatcher(DispatcherTracker.java:77)
        at org.apache.felix.http.proxy.DispatcherTracker.addingService(DispatcherTracker.java:52)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:932)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:864)
        at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
        at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:317)
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
        at org.apache.felix.http.proxy.ProxyServlet.doInit(ProxyServlet.java:51)
        at org.apache.felix.http.proxy.ProxyServlet.init(ProxyServlet.java:39)
        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4931)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5241)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1141)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

    Some other good advice?

    eyalkoren commented 5 years ago

    @gruselglatz what version of the agent are you using?

    gruselglatz commented 5 years ago

    @eyalkoren currently I use 1.6.2-snapshot but I see the error in all Versions from 1.0.0+.

    IDK if its in versions before 1.0.0 because I didn't try it further down the Version road.

    eyalkoren commented 5 years ago

    @gruselglatz it may be the case that we override the OSGi settings with our own... Can you please add the former content of the \karaf\etc\config.properties before you edited it?

    gruselglatz commented 5 years ago
    ################################################################################
    #
    #    Licensed to the Apache Software Foundation (ASF) under one or more
    #    contributor license agreements.  See the NOTICE file distributed with
    #    this work for additional information regarding copyright ownership.
    #    The ASF licenses this file to You under the Apache License, Version 2.0
    #    (the "License"); you may not use this file except in compliance with
    #    the License.  You may obtain a copy of the License at
    #
    #       http://www.apache.org/licenses/LICENSE-2.0
    #
    #    Unless required by applicable law or agreed to in writing, software
    #    distributed under the License is distributed on an "AS IS" BASIS,
    #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    #    See the License for the specific language governing permissions and
    #    limitations under the License.
    #
    ################################################################################
    
    #
    # This file lists Karaf default settings for this particular version of Karaf.
    # For easier maintenance when upgrading Karaf and to better document which
    # default values have changed, it is recommended to place any changes to
    # these values in a custom.properties file in the same folder as this file.
    # Each value specified in custom.properties will override the default value
    # here.
    #
    
    #
    # Properties file inclusions (as a space separated list of relative paths)
    # Included files will override the values specified in this file
    # NB: ${includes} properties files are mandatory, it means that Karaf will not start
    # if the include file is not found
    #
    ${includes} = jre.properties custom.properties
    
    #
    # Properties file inclusions (as a space separated list of relative paths)
    # Included files will override the values specified in this file
    # NB: ${optionals} properties files are optionals, it means that Karaf will just
    # display a warning message but the bootstrap will be performed
    #
    # ${optionals} = my.properties
    
    #
    # Framework selection properties
    #
    karaf.framework=felix
    
    #
    # Location of the OSGi frameworks
    #
    karaf.framework.equinox=mvn\:org.eclipse/org.eclipse.osgi/3.8.2.v20130124-134944
    karaf.framework.felix=mvn\:org.apache.felix/org.apache.felix.framework/4.2.1
    
    #
    # Framework config properties.
    #
    org.osgi.framework.system.packages= \
     org.osgi.framework.startlevel;uses:="org.osgi.framework";version="1.0", \
     org.osgi.framework.wiring;uses:="org.osgi.framework";version="1.1", \
     org.osgi.framework.hooks.bundle;uses:="org.osgi.framework";version="1.1", \
     org.osgi.framework.hooks.service;uses:="org.osgi.framework";version="1.1", \
     org.osgi.framework.hooks.resolver;uses:="org.osgi.framework.wiring";version="1.0", \
     org.osgi.framework.launch;uses:="org.osgi.framework";version="1.1", \
     org.osgi.framework.namespace;uses:="org.osgi.resource";version="1.0", \
     org.osgi.framework;version="1.7", \
     org.osgi.framework.hooks.weaving;uses:="org.osgi.framework.wiring";version="1.0",\
     org.osgi.resource;version="1.0",org.osgi.service.url;version="1.0",\
     org.osgi.service.startlevel;uses:="org.osgi.framework";version="1.1",\
     org.osgi.service.packageadmin;uses:="org.osgi.framework";version="1.2",\
     org.osgi.service.url;version="1.0", \
     org.osgi.util.tracker;uses:="org.osgi.framework";version="1.5.1", \
     org.apache.karaf.jaas.boot;version="3.0.3", \
     org.apache.karaf.jaas.boot.principal;version="3.0.3", \
     org.apache.karaf.management.boot;version="3.0.3", \
     org.apache.karaf.version;version="3.0.3", \
     ${jre-${java.specification.version}}
    
    #
    # Extra packages appended after standard packages
    #
    org.osgi.framework.system.packages.extra= \
     org.apache.karaf.branding, \
     org.apache.html.dom; version="2.11.0", \
     org.apache.wml.dom; version="2.11.0", \
     org.apache.wml; version="2.11.0", \
     org.apache.xerces.parsers; version="2.11.0", \
     org.apache.xerces.impl.dtd.models; version="2.11.0", \
     org.apache.xerces.xni.parser; version="2.11.0", \
     org.apache.xerces.impl.dv.xs; version="2.11.0", \
     org.apache.xerces.impl.xs.traversers; version="2.11.0", \
     org.apache.xerces.util; version="2.11.0", \
     org.apache.xerces.impl.dtd; version="2.11.0", \
     org.apache.xerces.jaxp.validation; version="2.11.0", \
     org.apache.xerces.dom3.as; version="2.11.0", \
     org.apache.xerces.impl.dv; version="2.11.0", \
     org.apache.xerces.jaxp; version="2.11.0", \
     org.apache.xerces.jaxp.datatype; version="2.11.0", \
     org.apache.xerces.impl.xpath.regex; version="2.11.0", \
     org.apache.xerces.xni; version="2.11.0", \
     org.apache.xerces.impl.msg; version="2.11.0", \
     org.apache.xerces.impl.dv.util; version="2.11.0", \
     org.apache.xerces.impl.xs.util; version="2.11.0", \
     org.apache.xerces.dom; version="2.11.0", \
     org.apache.xerces.dom.events; version="2.11.0", \
     org.apache.xerces.impl.xs.opti; version="2.11.0", \
     org.apache.xerces.impl; version="2.11.0", \
     org.apache.xerces.xs; version="2.11.0", \
     org.apache.xerces.impl.io; version="2.11.0", \
     org.apache.xerces.xpointer; version="2.11.0", \
     org.apache.xerces.impl.dv.dtd; version="2.11.0", \
     org.apache.xerces.xinclude; version="2.11.0", \
     org.apache.xerces.impl.xpath; version="2.11.0", \
     org.apache.xerces.xs.datatypes; version="2.11.0", \
     org.apache.xerces.impl.xs.identity; version="2.11.0", \
     org.apache.xerces.impl.xs.models; version="2.11.0", \
     org.apache.xerces.xni.grammars; version="2.11.0", \
     org.apache.xerces.impl.xs; version="2.11.0", \
     org.apache.xerces.impl.validation; version="2.11.0", \
     org.apache.xml.serialize; version="2.11.0", \
     sun.misc
    
    org.osgi.framework.system.capabilities= \
     ${eecap-${java.specification.version}}, \
     service-reference;effective:=active;objectClass=org.osgi.service.packageadmin.PackageAdmin, \
     service-reference;effective:=active;objectClass=org.osgi.service.startlevel.StartLevel, \
     service-reference;effective:=active;objectClass=org.osgi.service.url.URLHandlers
    
    eecap-1.8= osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0,1.1,1.2", \
     osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8"
    eecap-1.7= osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0,1.1,1.2", \
     osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7"
    eecap-1.6= osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0,1.1,1.2", \
     osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.0,1.1,1.2,1.3,1.4,1.5,1.6"
    eecap-1.5= osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0,1.1,1.2", \
     osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.0,1.1,1.2,1.3,1.4,1.5"
    eecap-1.4= osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0,1.1,1.2", \
     osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.0,1.1,1.2,1.3,1.4"
    eecap-1.3= osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0,1.1", \
     osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.0,1.1,1.2,1.3"
    eecap-1.2= osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0,1.1", \
     osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.0,1.1,1.2"
    
    #
    # javax.transaction is needed to avoid class loader constraint violation when using javax.sql
    #
    org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,org.apache.karaf.jaas.boot.principal,org.apache.karaf.management.boot,sun.*,com.sun.*,javax.transaction,javax.transaction.*,javax.xml.crypto,javax.xml.crypto.*,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom
    
    # jVisualVM support
    # in order to use Karaf with jvisualvm, the org.osgi.framework.bootdelegation property has to contain the org.netbeans.lib.profiler.server package
    # and, so, it should look like:
    #
    # org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,org.apache.karaf.jaas.boot.principal,org.apache.karaf.management.boot,sun.*,com.sun.*,javax.transaction,javax.transaction.*,javax.xml.crypto,javax.xml.crypto.*,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom,org.netbeans.lib.profiler.server
    #
    # YourKit support
    # in order to use Karaf with YourKit, the org.osgi.framework.bootdelegation property has to contain the com.yourkit.* packages
    # and, so, it should look like:
    #
    # org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,org.apache.karaf.jaas.boot.principal,org.apache.karaf.management.boot,sun.*,com.sun.*,javax.transaction,javax.transaction.*,javax.xml.crypto,javax.xml.crypto.*,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom,com.yourkit.*
    #
    
    #
    # OSGi Execution Environment
    #
    org.osgi.framework.executionenvironment=J2SE-1.7,JavaSE-1.7,J2SE-1.6,JavaSE-1.6,J2SE-1.5,JavaSE-1.5,J2SE-1.4,JavaSE-1.4,J2SE-1.3,JavaSE-1.3,J2SE-1.2,,JavaSE-1.2,CDC-1.1/Foundation-1.1,CDC-1.0/Foundation-1.0,J2ME,OSGi/Minimum-1.1,OSGi/Minimum-1.0
    
    #
    # Set the parent classloader for the bundle to the classloader that loads the Framework (i.e. everything in lib/*.jar)
    #
    org.osgi.framework.bundle.parent=framework
    
    #
    # Definition of the default bundle start level
    #
    org.osgi.framework.startlevel.beginning=100
    karaf.startlevel.bundle=80
    
    #
    # The location of the Karaf shutdown port file
    #
    karaf.shutdown.port.file=${karaf.data}/port
    
    #
    # Configuration FileMonitor properties
    #
    felix.fileinstall.enableConfigSave = true
    felix.fileinstall.dir    = ${karaf.etc}
    felix.fileinstall.filter = .*\\.cfg
    felix.fileinstall.poll   = 1000
    felix.fileinstall.noInitialDelay = true
    felix.fileinstall.log.level = 3
    
    #
    # Delay for writing the framework state to disk in equinox
    # must be  >= 1000 and <= 1800000
    #
    eclipse.stateSaveDelayInterval = 1000
    
    #
    # OBR Repository list
    # This property will be modified by the obr:addUrl and obr:removeUrl commands. 
    #
    obr.repository.url = 
    
    #
    # Start blueprint bundles synchronously when possible
    #
    org.apache.aries.blueprint.synchronous=true
    
    #
    # Do not weave all any classes by default
    #
    org.apache.aries.proxy.weaving.enabled=
    
    #
    # mvn url handler requires config instance configuration
    #
    org.ops4j.pax.url.mvn.requireConfigAdminConfig=true
    
    #
    # Don't delay the console startup. Set to true if you want the console to start after all other bundles
    #
    karaf.delay.console=false
    
    #
    # Generated command shutdown
    #
    karaf.shutdown.command = [REDACTED]
    
    eyalkoren commented 5 years ago

    Please try to set the following system property:

    -Dorg.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,org.apache.karaf.jaas.boot.principal,org.apache.karaf.management.boot,sun.*,com.sun.*,javax.transaction,javax.transaction.*,javax.xml.crypto,javax.xml.crypto.*,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom,co.elastic.apm.agent.*

    Let's see if this fixes the problem.

    gruselglatz commented 5 years ago

    @eyalkoren Now I dont get the error and the agent is working, but I dont like to pollute the startoptions like this. Is there not another option to fix it without extra Startoptions for the jvm?

    eyalkoren commented 5 years ago

    I am adding an agent configuration option for that. Would that be better?

    gruselglatz commented 5 years ago

    This would be awsome, because its only needed for hosts with the agent running.

    Thank you! 👍

    eyalkoren commented 5 years ago

    @gruselglatz Please try out this snapshot build. It contains a new config called boot_delegation_packages, which you can set in one of the following ways:

    1. as a system property - -Delastic.apm.boot_delegation_packages=...
    2. through the elasticapm.properties file - boot_delegation_packages=...
    3. as and env variable - ELASTIC_APM_BOOT_DELEGATION_PACKAGES

    There are two options to go:

    1. leave your \karaf\etc\config.properties with the appended agent package and set the boot_delegation_packages config to an empty string
    2. set the boot_delegation_packages config to org.apache.karaf.jaas.boot,org.apache.karaf.jaas.boot.principal,org.apache.karaf.management.boot,sun.*,com.sun.*,javax.transaction,javax.transaction.*,javax.xml.crypto,javax.xml.crypto.*,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom,co.elastic.apm.agent.* (and then your \karaf\etc\config.properties will not take effect as it will be overridden).

    If you can try both and report results, that'd be great. Thanks!

    gruselglatz commented 5 years ago

    @eyalkoren I've tried it now, this is the result:

    Option 1 -> Fixed the problem Option 2 -> Fixed the problem

    Option 2a: leave the option boot_delegation_packages empty and dont append co.elastic.apm.agent.* to \karaf\etc\config.properties fixed also the problem.

    But not setting the boot_delegation_packages at all causes the problem to apear again.

    So for me it's fixed with the new option, regardless of the setting of it.

    Thank you very much! 👍

    eyalkoren commented 5 years ago

    not setting the boot_delegation_packages at all causes the problem to apear again.

    This is expected. However,

    leave the option boot_delegation_packages empty and dont append co.elastic.apm.agent.* to \karaf\etc\config.properties fixed also the problem

    means that the OSGi allowed delegating loading of our classes, which is confusing...

    In any case, I am glad this provides a solution. If you get an error of our classes not found, just use one of the options 1/2.

    Thanks for testing and reporting!