MarcGiffing / wicket-spring-boot

Spring Boot starter for Apache Wicket
152 stars 62 forks source link

Examples & Tutorial do not work #185

Closed fgrazi closed 2 years ago

fgrazi commented 2 years ago

Hi there,

I am trying to use Wicket with Spring Boot. I started with the provided examples, but when I executed I got an error:

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.7.RELEASE:run (default-cli) on project simple: An exception occurred while running. null: InvocationTargetException: Cannot load configuration class: com.giffing.examples.wicket.spring.boot.simple.WicketApplication: ExceptionInInitializerError: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @58af7a6a -> [Help 1]

Note: I am using Java 16 (Oracle).

I can bypass the Exception by executing with the VM switch --illegal-access=permit, but I'm almost sure I can't use such a switch in a production environment.

Also, I am trying the simple project as suggested in the tutorial using Gradle. As soon as I add the dependency below,

implementation 'com.giffing.wicket.spring.boot.starter:wicket-spring-boot-starter:3.0.4'

I get a fatal exception:

 Error creating bean with name 'wicketBootWebApplication': Unsatisfied dependency expressed through field 'configurations'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wicketextensionApplicationSettingsConfig': Unsatisfied dependency expressed through field 'holder'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.giffing.wicket.spring.boot.starter.app.classscanner.ClassCandidateScanner': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'com.giffing.wicket.spring.boot.starter.app.classscanner.ClassCandidateScanner': Requested bean is currently in creation: Is there an unresolvable circular reference?
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) ~[spring-beans-5.3.13.jar:5.3.13]
...

Note: in your example, you do not inform the version (3.0.4), but if I do not specify the version, I get a "could not resolve" error.

And finally, even when I provide the main page, I get the same error. So I am attaching this straightforward project. simpleGradle.tar.gz

fgrazi commented 2 years ago

I see I was using an unsupported version of Spring-boot (2.6) to follow the tutorial, I am now trying again with 2.5. The first step passed, now I will add needed libraries.

martin-g commented 2 years ago

See https://github.com/MarcGiffing/wicket-spring-boot/issues/183 If you use master branch it should work.

The new version has not been released due to https://github.com/MarcGiffing/wicket-spring-boot/issues/184

fgrazi commented 2 years ago

Thanks indeed martin-g!

Yes, confirmed. With Spring-boot 2.5 and Java 11, all problems disappeared.