[ 
https://issues.apache.org/jira/browse/WICKET-7072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17770445#comment-17770445
 ] 

Andrea Del Bene edited comment on WICKET-7072 at 9/29/23 1:18 PM:
------------------------------------------------------------------

{quote}java.lang.IllegalAccessError: class 
org.junit.platform.launcher.core.LauncherFactory (in unnamed module 
@0x2d928643) cannot access class org.junit.platform.commons.util.Preconditions 
(in module org.junit.platform.commons) because module 
org.junit.platform.commons does not export org.junit.platform.commons.util to 
unnamed module @0x2d928643
{quote}
 

I had the same issues. I've solved it adding this 2 --add-open params:
{quote}--add-opens=org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED
  
--add-opens=org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED
{quote}
However, now i'm stuck with another problem :
{quote}org.apache.wicket.WicketRuntimeException: Exception in rendering 
component: [HtmlHeaderContainer [Component id = _header_]]
    at 
org.apache.wicket.core/org.apache.wicket.Component.internalRenderComponent(Component.java:2534)
    at 
org.apache.wicket.core/org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1569)
    at 
org.apache.wicket.core/org.apache.wicket.Component.internalRender(Component.java:2317)
    at ....

org.apache.wicket.tester/org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:899)
    at 
org.apache.wicket.websocket.tester/org.apache.wicket.protocol.ws.tester.WebSocketTesterBehaviorTest.sendTextMessageBehavior(WebSocketTesterBehaviorTest.java:67)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.IllegalArgumentException: resource 
res/js/wicket-websocket-setup.js.tmpl not found for scope class 
org.apache.wicket.protocol.ws.api.WicketWebSocketJQueryResourceReference (path 
= org/apache/wicket/protocol/ws/api/res/js/wicket-websocket-setup.js.tmpl)
    at 
org.apache.wicket.core/org.apache.wicket.util.template.PackageTextTemplate.load(PackageTextTemplate.java:210)
    at 
org.apache.wicket.core/org.apache.wicket.util.template.PackageTextTemplate.getString(PackageTextTemplate.java:255)
    at 
org.apache.wicket.core/org.apache.wicket.util.template.TextTemplate.asString(TextTemplate.java:72)
    at 
org.apache.wicket.websocket.core/org.apache.wicket.protocol.ws.api.BaseWebSocketBehavior.getWebSocketSetupScript(BaseWebSocketBehavior.java:121)
    at .....
    ... 27 more
{quote}
Looks loke I can't access the resource file 
res/js/wicket-websocket-setup.js.tmpl  in module wicket-native-websocket-core 
from wicket-native-websocket-tester

 


was (Author: bitstorm):
{quote}java.lang.IllegalAccessError: class 
org.junit.platform.launcher.core.LauncherFactory (in unnamed module 
@0x2d928643) cannot access class org.junit.platform.commons.util.Preconditions 
(in module org.junit.platform.commons) because module 
org.junit.platform.commons does not export org.junit.platform.commons.util to 
unnamed module @0x2d928643
{quote}
 

I had the same issues. I've solved it adding this 2 --add-open params:
{quote}-{-}add-opens=org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED{-}
  
-add-opens=org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED
{quote}
However, now i'm stuck with another problem :
{quote}org.apache.wicket.WicketRuntimeException: Exception in rendering 
component: [HtmlHeaderContainer [Component id = _header_]]
    at 
org.apache.wicket.core/org.apache.wicket.Component.internalRenderComponent(Component.java:2534)
    at 
org.apache.wicket.core/org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1569)
    at 
org.apache.wicket.core/org.apache.wicket.Component.internalRender(Component.java:2317)
    at ....

org.apache.wicket.tester/org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:899)
    at 
org.apache.wicket.websocket.tester/org.apache.wicket.protocol.ws.tester.WebSocketTesterBehaviorTest.sendTextMessageBehavior(WebSocketTesterBehaviorTest.java:67)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.IllegalArgumentException: resource 
res/js/wicket-websocket-setup.js.tmpl not found for scope class 
org.apache.wicket.protocol.ws.api.WicketWebSocketJQueryResourceReference (path 
= org/apache/wicket/protocol/ws/api/res/js/wicket-websocket-setup.js.tmpl)
    at 
org.apache.wicket.core/org.apache.wicket.util.template.PackageTextTemplate.load(PackageTextTemplate.java:210)
    at 
org.apache.wicket.core/org.apache.wicket.util.template.PackageTextTemplate.getString(PackageTextTemplate.java:255)
    at 
org.apache.wicket.core/org.apache.wicket.util.template.TextTemplate.asString(TextTemplate.java:72)
    at 
org.apache.wicket.websocket.core/org.apache.wicket.protocol.ws.api.BaseWebSocketBehavior.getWebSocketSetupScript(BaseWebSocketBehavior.java:121)
    at .....
    ... 27 more
{quote}
Looks loke I can't access the resource file 
res/js/wicket-websocket-setup.js.tmpl  in module wicket-native-websocket-core 
from wicket-native-websocket-tester

 

> JUnit code in /src/main/java breaks JPMS support in Eclipse IDE
> ---------------------------------------------------------------
>
>                 Key: WICKET-7072
>                 URL: https://issues.apache.org/jira/browse/WICKET-7072
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 10.0.0-M1
>            Reporter: Sam Peters
>            Priority: Major
>
> In Wicket 10, the wicket-core and wicket-util jars contain JUnit-related 
> code, see class list below.
> The problem:
>  * When creating a new modular (JPMS) maven project by adding __ just 
> _org.apache.wicket.commons.fileupload_ ({_}not containing{_} JUnit code) in 
> {_}module-info{_}, projects run fine in Eclipse IDE (2023-06). I supplied a 
> quickstarter at 
> [https://github.com/gluser1357/jerseyissues/tree/main-without-junit-code], 
> see readme.txt.
>  * In contrast, when creating a new modular project by adding 
> {_}org.apache.wicket.util{_}" ({_}containing{_} JUnit code), Eclipse fails in 
> different ways, see wicket quickstarter at 
> [https://github.com/gluser1357/jerseyissues/tree/main-with-junit-code-error], 
> see readme.txt.
>  ** If JUnit is kept with usual _<scope>test<scope>_ (pom.xml) and not added 
> via _requires org.junit.jupiter.api_ in module-info.java, one of the 
> following errors occur when running code (see readme.txt for more details):
>  *** _java.lang.module.FindException: Module org.junit.jupiter.api not found, 
> required by org.apache.wicket.util_
>  *** _java.lang.Error: Unresolved compilation problem: "The type 
> org.junit.jupiter.api.Test is not accessible"_
>  *** _java.lang.IllegalAccessError: class 
> org.junit.platform.launcher.core.ServiceLoaderRegistry (in unnamed module 
> @0x5f341870) cannot access class 
> org.junit.platform.commons.logging.LoggerFactory (in module 
> org.junit.platform.commons) because module org.junit.platform.commons does 
> not export org.junit.platform.commons.logging to unnamed module @0x5f341870_  
>  
>  ** After correcting the missing module and dependency by removing 
> _<scope>test<scope>_ (pom.xml) and adding a _requires org.junit.jupiter.api_ 
> in module-info.java (which is, as far as I know, actually untypical), own 
> code in _/src/test/java_ and _/src/main/java_ runs now, but own JUnit tests 
> can still not be executed via "Run As JUnit Test" in Eclipse because of
>  *** _java.lang.IllegalAccessError: class 
> org.junit.platform.launcher.core.ServiceLoaderRegistry (in unnamed module 
> @0x5f341870) cannot access class 
> org.junit.platform.commons.logging.LoggerFactory (in module 
> org.junit.platform.commons) because module org.junit.platform.commons does 
> not export org.junit.platform.commons.logging to unnamed module @0x5f341870_  
>  
> In my opinion, the JUnit-related code below shouldn't be contained in 
> _/src/main/java_ which is a) quite untypical and b) results in problems of 
> common IDEs like Eclipse.
> *Would it be possible to*
>  * *move the related Wicket classes (see list below) out of 
> {_}/src/main/java{_}, e. g. to _/src/test/java_ and*
>  * *remove _requires org.junit.jupiter.api_ from both module-info?*
> This would avoid these problems in Eclipse IDE for JPMS-based projects that 
> want to integrate Wicket.
> =====
> The relevant classes are:
>  * in wicket-util:
>  ** 
> [https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-util/src/main/java/org/apache/wicket/util/license/ApacheLicenseHeaderTestCase.java]
>  ** 
> [https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-util/src/main/java/org/apache/wicket/util/markup/xhtml/WellFormedXmlTestCase.java]
>  * in wicket-core:
>  ** 
> [https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java]
>  ** 
> [https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/DiffUtil.java]
>  ** 
> [https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/FormTester.java]
>  ** 
> [https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/WicketTestCase.java]
>  ** 
> [https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/WicketTester.java]
>  ** 
> [https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/WicketTesterExtension.java]
>  ** 
> [https://github.com/apache/wicket/blob/rel/wicket-10.0.0-M1/wicket-core/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to