Hi All,

CONTEXT
The integration test example not works, because an infinite loop "Logger: 
java.lang.reflect.InvocationTargetException" occurs. It not works in test 
example of karaf clone or an own written unit-test.

TRIALS
- I tried security.manager with policy
- I tried add-opens
- I tried <useSystemClassLoader>false</useSystemClassLoader>
- I tried different logger settings with log4j. When I change

<dependency>
    <groupId>org.ops4j.pax.logging</groupId>
    <artifactId>pax-logging-log4j2</artifactId>
    <version>${pax-logging.version}</version>
    <scope>provided</scope>
</dependency>
to 
<dependency>
    <groupId>org.ops4j.pax.logging</groupId>
    <artifactId>pax-logging-service</artifactId>
    <version>1.11.17</version>
</dependency> 

it seems that the security issue is occurring „later“, but also raises. Also 
the infinity loop stays.

DESCRIPTION
I am not able to suppress the security manager on karaf integration test. Hoe 
to fix that? What is the reason for the Exception which not ends? I configured
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${maven-surefire-plugin.version}</version>
    <configuration>
        <forkCount>1</forkCount>
        <reuseForks>false</reuseForks>
      <!--  <useSystemClassLoader>false</useSystemClassLoader> -->
        <systemPropertyVariables>
            <property>
                <!-- Set property to java.system.property, so it could be 
loaded to build karaf-test-instance -->
                <name>karaf.version</name>
                <value>${karaf.version}</value>
            </property>
            <property>
                <!-- Set property to java.system.property, so it could be 
loaded to build karaf-test-instance -->
                <name>project.version</name>
                <value>${project.version}</value>
            </property>
        </systemPropertyVariables>
        <argLine>
            <!---Dtests.security.manager=false-->
           <!-- -Djava.security.manager
            -Djava.security.policy=${basedir}/src/test/resources/java.policy -->
            --add-opens java.base/java.security=ALL-UNNAMED
            --add-opens java.base/java.net=ALL-UNNAMED
            --add-opens java.base/java.lang=ALL-UNNAMED
            --add-opens java.base/java.util=ALL-UNNAMED
            --add-opens java.naming/javax.naming.spi=ALL-UNNAMED
            --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED
        </argLine>
    </configuration>
</plugin>
But nothing seems to work. The error which is thrown looks like:

Running org.rogatio.k3.test.ExampleTest
WARNING: package org.apache.karaf.specs.locator not in java.base
Logger: java.lang.reflect.InvocationTargetException
Exception in thread "CM Configuration Updater" 
java.lang.UnsupportedOperationException: getSubject is supported only if a 
security manager is allowed
        at java.base/javax.security.auth.Subject.getSubject(Subject.java:347)
        at 
org.apache.felix.eventadmin.impl.handler.EventAdminImpl.prepareEvent(EventAdminImpl.java:146)
        at 
org.apache.felix.eventadmin.impl.handler.EventAdminImpl.postEvent(EventAdminImpl.java:180)
        at 
org.apache.felix.eventadmin.impl.security.EventAdminSecurityDecorator.postEvent(EventAdminSecurityDecorator.java:79)
        at 
org.ops4j.pax.logging.spi.support.EventAdminTracker.deliver(EventAdminTracker.java:103)
        at 
org.ops4j.pax.logging.spi.support.EventAdminTracker.postEvent(EventAdminTracker.java:65)
        at 
org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.handleEvents(PaxLoggingServiceImpl.java:415)
        at 
org.ops4j.pax.logging.log4j2.internal.PaxLoggerImpl.doLog0(PaxLoggerImpl.java:1134)
        at 
org.ops4j.pax.logging.log4j2.internal.PaxLoggerImpl.doLog(PaxLoggerImpl.java:1099)
        at 
org.ops4j.pax.logging.log4j2.internal.PaxLoggerImpl.error(PaxLoggerImpl.java:583)
        at 
org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.logImpl(PaxLoggingServiceImpl.java:368)
        at 
org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.access$000(PaxLoggingServiceImpl.java:70)
        at 
org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService.log(PaxLoggingServiceImpl.java:675)
        at org.apache.felix.cm.impl.Log.log(Log.java:186)
        at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:88)
        at java.base/java.lang.Thread.run(Thread.java:1575)
Logger: java.lang.reflect.InvocationTargetException
Logger: java.lang.reflect.InvocationTargetException
Logger: java.lang.reflect.InvocationTargetException
Logger: java.lang.reflect.InvocationTargetException
Logger: java.lang.reflect.InvocationTargetException
...

Reply via email to