Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Error while trying to run IntelliJ UnitTest Debugger

Avatar

Level 7

While running a UnitTest debugger, I am getting this error


Error:osgi: [site.core] Classes found in the wrong directory: {META-INF/versions/9/javax/xml/bind/ModuleUtil.class=javax.xml.bind.ModuleUtil}

How do I solve this?

 

There is nothing on Google that can help me.

 

 

Java 11, and we are not using any bnd-maven-plugin; does not exist. 

we are using:

<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi @AEMWizard ,

I read certain articles on this when you reported on previous thread and seems like we face such issue where we have multi-release JARs.
I found some ugly workarounds mentioned here :
https://github.com/bndtools/bnd/issues/2227
https://issues.apache.org/jira/browse/FELIX-5592

I would recommend you to add bnd-mvn-plugin dependency as well in your project post that you can add fix-ups in the configuration as mentioned in the JIRA ticket shared above.

<configuration>
            <instructions>
              <_fixupmessages>"Classes found in the wrong directory";is:=warning</_fixupmessages>
            </instructions>
          </configuration>

Another ugly fix would be to search for older releases which doesn't have such multi version jars.

I tried adding the jaxb-api with Java8 & Java11,and tried debugging test classes in Intellij but worked fine for me. However, I dont have a servlet using the imported api, I can test further if you can share the servlet as well or if you want we can connect for depth digging of the issue.

Thanks


View solution in original post

1 Reply

Avatar

Correct answer by
Employee Advisor

Hi @AEMWizard ,

I read certain articles on this when you reported on previous thread and seems like we face such issue where we have multi-release JARs.
I found some ugly workarounds mentioned here :
https://github.com/bndtools/bnd/issues/2227
https://issues.apache.org/jira/browse/FELIX-5592

I would recommend you to add bnd-mvn-plugin dependency as well in your project post that you can add fix-ups in the configuration as mentioned in the JIRA ticket shared above.

<configuration>
            <instructions>
              <_fixupmessages>"Classes found in the wrong directory";is:=warning</_fixupmessages>
            </instructions>
          </configuration>

Another ugly fix would be to search for older releases which doesn't have such multi version jars.

I tried adding the jaxb-api with Java8 & Java11,and tried debugging test classes in Intellij but worked fine for me. However, I dont have a servlet using the imported api, I can test further if you can share the servlet as well or if you want we can connect for depth digging of the issue.

Thanks