Error when trying to connect the controller class to javafx - java

If i compile my controller and main class for my javafx project, they both compile without any errors and if I run the main class the Javafx (the GUI that I built in scene-builder) will pop-up like it is supposed to if the controller is not connected to the javafx. As soon as I try to connect the controller java file to the javafx through scene builder and then try to run the project, the GUI will not popup and it will give me this list of errors:
C:\Users\Kenny's\Desktop\Project3>java Project3
Exception in Application start method
java.lang.reflect.InvocationTargetException
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:497)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
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:497)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:745)
Caused by: javafx.fxml.LoadException:
/C:/Users/Kenny's/Desktop/Project3/Project3.fxml
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at Project3.start(Project3.java:12)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
... 1 more
Caused by: java.lang.IllegalArgumentException: Can not set javafx.scene.control.ComboBox field Project3Controller.location to java.net.URL
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
at java.lang.reflect.Field.set(Field.java:764)
at javafx.fxml.FXMLLoader.injectFields(FXMLLoader.java:1163)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2554)
... 17 more
Exception running application Project3
C:\Users\Kenny's\Desktop\Project3>
I have tried to find a solution and I have tried it with a completely blank controller class and everything and it still does not work.
Anyone know any solutions?

Oh, this is a bit evil.
When the FXML file is loaded, as you know, it injects fields annotated with #FXML in the controller with the elements with corresponding fx:id attributes (the attribute value in the FXML file matching the field name in the controller).
What is little known (and undocumented) is that there are a small number of (well, two) additional values that can be injected. For example, you can do
#FXML
private ResourceBundle resources ;
to get a reference to the resource bundle provided to the FXMLLoader. Similarly, you can get a reference to the URL provided to the FXMLLoader with (you guessed it):
#FXML
private URL location ;
These happen automatically.
So, it looks from the stack trace that you have a ComboBox defined in your FXML file and controller which you called location:
#FXML
private ComboBox<String> location ;
When the FXML loader sees this, possibly before it even tries to parse the FXML file, it tries to inject the URL provided to the loader into the field, and of course fails because it's trying to assign a URL to a ComboBox.
To fix, just change the name of the combo box:
#FXML
private ComboBox<String> locationCombo ;
and similarly for the fx:id attribute in your FXML file.

Related

Spring `superinterface check failed` when using Java modules (for Axon Framework Spring Boot app)

I am currently experimenting with Spring Boot, the Axon Framework and java modules (using JDK 17).
I have created a repo to illustrate the problem: here
The problem is that the application does not start and I get the exception as follows:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountViewProjection' defined in file [C:\workspace\axon\_issue_replication_repos\axon-module-error\axon-example-app\build\classes\java\main\io\github\vab2048\axon\example_bug\app\query\account\AccountViewProjection.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class io.github.vab2048.axon.example_bug.app.query.account.AccountViewProjection: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.IllegalAccessError-->superinterface check failed: class io.github.vab2048.axon.example_bug.app.query.account.AccountViewProjection$$EnhancerBySpringCGLIB$$159eee6a (in module io.github.vab2048.axon.example_bug.app) cannot access class org.springframework.aop.framework.Advised (in unnamed module #0x732d0d24) because module io.github.vab2048.axon.example_bug.app does not read unnamed module #0x732d0d24
at spring.beans#5.3.20/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628) ~[spring-beans-5.3.20.jar:na]
at spring.beans#5.3.20/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.20.jar:na]
at spring.beans#5.3.20/org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.20.jar:na]
at spring.beans#5.3.20/org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.20.jar:na]
at spring.beans#5.3.20/org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.20.jar:na]
at spring.beans#5.3.20/org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.20.jar:na]
at spring.beans#5.3.20/org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.20.jar:na]
at spring.context#5.3.20/org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.20.jar:na]
at spring.context#5.3.20/org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.20.jar:na]
at spring.boot#2.7.0/org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.0.jar:na]
at spring.boot#2.7.0/org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.0.jar:na]
at spring.boot#2.7.0/org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.0.jar:na]
at spring.boot#2.7.0/org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.0.jar:na]
at spring.boot#2.7.0/org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.0.jar:na]
at spring.boot#2.7.0/org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.0.jar:na]
at io.github.vab2048.axon.example_bug.app/io.github.vab2048.axon.example_bug.app.AxonApplication.main(AxonApplication.java:10) ~[main/:na]
Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class io.github.vab2048.axon.example_bug.app.query.account.AccountViewProjection: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.IllegalAccessError-->superinterface check failed: class io.github.vab2048.axon.example_bug.app.query.account.AccountViewProjection$$EnhancerBySpringCGLIB$$159eee6a (in module io.github.vab2048.axon.example_bug.app) cannot access class org.springframework.aop.framework.Advised (in unnamed module #0x732d0d24) because module io.github.vab2048.axon.example_bug.app does not read unnamed module #0x732d0d24
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:209) ~[spring-aop-5.3.20.jar:5.3.20]
at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110) ~[spring-aop-5.3.20.jar:5.3.20]
at org.axonframework.spring#4.5.9/org.axonframework.spring.config.AbstractAnnotationHandlerBeanPostProcessor.createAdapterProxy(AbstractAnnotationHandlerBeanPostProcessor.java:190) ~[axon-spring-4.5.9.jar:na]
at org.axonframework.spring#4.5.9/org.axonframework.spring.config.AbstractAnnotationHandlerBeanPostProcessor.postProcessAfterInitialization(AbstractAnnotationHandlerBeanPostProcessor.java:89) ~[axon-spring-4.5.9.jar:na]
at spring.beans#5.3.20/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:455) ~[spring-beans-5.3.20.jar:na]
at spring.beans#5.3.20/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1808) ~[spring-beans-5.3.20.jar:na]
at spring.beans#5.3.20/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.20.jar:na]
... 15 common frames omitted
Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.IllegalAccessError-->superinterface check failed: class io.github.vab2048.axon.example_bug.app.query.account.AccountViewProjection$$EnhancerBySpringCGLIB$$159eee6a (in module io.github.vab2048.axon.example_bug.app) cannot access class org.springframework.aop.framework.Advised (in unnamed module #0x732d0d24) because module io.github.vab2048.axon.example_bug.app does not read unnamed module #0x732d0d24
at spring.core#5.3.20/org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:512) ~[spring-core-5.3.20.jar:na]
at spring.core#5.3.20/org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:363) ~[spring-core-5.3.20.jar:na]
at spring.core#5.3.20/org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:585) ~[spring-core-5.3.20.jar:na]
at spring.core#5.3.20/org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:110) ~[spring-core-5.3.20.jar:na]
at spring.core#5.3.20/org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:108) ~[spring-core-5.3.20.jar:na]
at spring.core#5.3.20/org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54) ~[spring-core-5.3.20.jar:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at spring.core#5.3.20/org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) ~[spring-core-5.3.20.jar:na]
at spring.core#5.3.20/org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) ~[spring-core-5.3.20.jar:na]
at spring.core#5.3.20/org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134) ~[spring-core-5.3.20.jar:na]
at spring.core#5.3.20/org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319) ~[spring-core-5.3.20.jar:na]
at spring.core#5.3.20/org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:572) ~[spring-core-5.3.20.jar:na]
at spring.core#5.3.20/org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:419) ~[spring-core-5.3.20.jar:na]
at org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:57) ~[spring-aop-5.3.20.jar:5.3.20]
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:206) ~[spring-aop-5.3.20.jar:5.3.20]
... 21 common frames omitted
Caused by: java.lang.IllegalAccessError: superinterface check failed: class io.github.vab2048.axon.example_bug.app.query.account.AccountViewProjection$$EnhancerBySpringCGLIB$$159eee6a (in module io.github.vab2048.axon.example_bug.app) cannot access class org.springframework.aop.framework.Advised (in unnamed module #0x732d0d24) because module io.github.vab2048.axon.example_bug.app does not read unnamed module #0x732d0d24
at java.base/java.lang.ClassLoader.defineClass0(Native Method) ~[na:na]
at java.base/java.lang.System$2.defineClass(System.java:2307) ~[na:na]
at java.base/java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2439) ~[na:na]
at java.base/java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2416) ~[na:na]
at java.base/java.lang.invoke.MethodHandles$Lookup.defineClass(MethodHandles.java:1843) ~[na:na]
at java.base/jdk.internal.reflect.GeneratedMethodAccessor33.invoke(Unknown Source) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at spring.core#5.3.20/org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:507) ~[spring-core-5.3.20.jar:na]
... 35 common frames omitted
The offending code seems to to be in io.github.vab2048.axon.example_bug.app.query.account.AccountViewProjection:
#QueryHandler
public AccountView getAccount(GetAccountView query) {
log.debug("Handling: {}", query);
return repository.findById(query.id()).orElseThrow();
}
It is the Axon annotation #QueryHandler which causes it (you can verify this by commenting it out and then everything works). This is strange because none of the other Axon annotations cause this problem. The package itself is both exported and open in the module-info.java file.
What am I doing wrong? I am aware there may be command line arguments which may be added to solve this issue but am not sure what exactly to use (ideally I shouldn't have to give any command line arguments at all).
I am somewhat in doubt about posting this as an answer, but I will do it regardless.
Have you tried removing Spring AOP from the mix?
It seems like Spring AOP is making some inner classes that cause the IllegalAccessError, not so much Axon Framework.
If this solves the issue, I'd wager there's something to be done with Spring AOP to make this work.
Sadly, this isn't my forte, so I'd have to investigate what kind of settings, if any, would help in that perspective.

Byte Buddy Not Loading Classes and Throwing Class Not Found

Am trying to build custom agent for springboot application.
This how my agent premain looks
.with(new AgentBuilder.InitializationStrategy.SelfInjection.Eager())
.ignore(ElementMatchers.nameStartsWith("org.springframework.boot"))
.type((ElementMatchers.any()))
.transform((builder, typeDescription, classLoader, module) -> builder
.method(ElementMatchers.any())
.intercept(Advice.to(MyInterceptor.class))
).installOn(instrumentation);
I am trying to not instrument methods inside the boot loader classes
When am trying to attach the agent to my spring boot application on startup this is the error am getting
Exception in thread "main" java.lang.NoClassDefFoundError: sun/reflect/GeneratedMethodAccessor14
at sun.reflect.GeneratedMethodAccessor14.<clinit>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:403)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:394)
at java.security.AccessController.doPrivileged(Native Method)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:393)
at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:53)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.misc.CompoundEnumeration.<clinit>(CompoundEnumeration.java)
at java.lang.ClassLoader.getResources(ClassLoader.java:1144)
at java.lang.ClassLoader.getResources(ClassLoader.java:1138)
at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:348)
at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393)
at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)
at java.time.zone.ZoneRulesProvider.<clinit>(ZoneRulesProvider.java:165)
at java.time.ZoneRegion.ofId(ZoneRegion.java:120)
at java.time.ZoneId.of(ZoneId.java:411)
at java.time.ZoneId.of(ZoneId.java:359)
at java.time.ZoneId.of(ZoneId.java:315)
at java.util.TimeZone.toZoneId(TimeZone.java:556)
at sun.util.calendar.ZoneInfo.toZoneId(ZoneInfo.java)
at java.time.ZoneId.systemDefault(ZoneId.java:274)
at org.springframework.boot.loader.jar.CentralDirectoryFileHeader.decodeMsDosFormatDateTime(CentralDirectoryFileHeader.java:130)
at org.springframework.boot.loader.jar.CentralDirectoryFileHeader.getTime(CentralDirectoryFileHeader.java:116)
at org.springframework.boot.loader.jar.JarEntry.<init>(JarEntry.java:58)
at org.springframework.boot.loader.jar.JarFileEntries.getEntry(JarFileEntries.java:316)
at org.springframework.boot.loader.jar.JarFileEntries.access$400(JarFileEntries.java:48)
at org.springframework.boot.loader.jar.JarFileEntries$EntryIterator.next(JarFileEntries.java:366)
at org.springframework.boot.loader.jar.JarFileEntries$EntryIterator.next(JarFileEntries.java:350)
at org.springframework.boot.loader.jar.JarFile$2.nextElement(JarFile.java:201)
at org.springframework.boot.loader.jar.JarFile$2.nextElement(JarFile.java:192)
at org.springframework.boot.loader.archive.JarFileArchive$EntryIterator.next(JarFileArchive.java:184)
at org.springframework.boot.loader.archive.JarFileArchive$EntryIterator.next(JarFileArchive.java:169)
at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchives(JarFileArchive.java:85)
at org.springframework.boot.loader.ExecutableArchiveLauncher.getClassPathArchives(ExecutableArchiveLauncher.java:69)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: java.lang.ClassNotFoundException: sun.reflect.GeneratedMethodAccessor14
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 43 more
Am I doing something wrong here on how to ignore particular matchers?
`
The eager self-injecting strategy can load types prematurely and you should not use it. If you register an AgentBuilder.Listener, you will probably see the error causing this loading problem. I think you want to use advice as a decorator, not as an implementation:
(builder, typeDescription, classLoader, module) -> builder.visit(Advice
.to(MyInterceptor.class)
.on(isMethod())
This way, the method implementations are decorated rather then replaced. Also, remove the injection strategy, there is nothing to inject here.

Payara 4.1 autodeploy WAR deploy error NullPointerException NCLS-CORE-00069 AS-WEB-CORE-00108

after some code changes I observe a very odd exception from the payara server. The problem with it, I cannot pinpoint down what it is complaining about. Basically I don't know even what is wrong.
Any ideas what could be wrong are much appreciated.
Exceptions in the log during startup:
{"Timestamp":"2018-07-14T11:31:34.430+0000","Level":"WARNING","Version":"Payara 4.1","LoggerName":"javax.enterprise.system.core","ThreadID":"58","ThreadName":"AutoDeployer","TimeMillis":"1531567894430","LevelValue":"900","MessageID":"NCLS-CORE-00069","LogMessage":{"Exception":"Exception while dispatching an event","StackTrace":"org.glassfish.api.invocation.InvocationException
at org.glassfish.api.invocation.InvocationManagerImpl.postInvoke(InvocationManagerImpl.java:219)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:310)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:333)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:505)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:227)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:536)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:544)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:570)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:562)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:561)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1469)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1851)
at org.glassfish
.deployment.autodeploy.AutoOperation.run(AutoOperation.java:164)
at org.glassfish.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:597)
at org.glassfish.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:484)
at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:412)
at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:403)
at org.glassfish.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:233)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
"}}
Followed by -- twice:
{"Timestamp":"2018-07-14T11:31:34.998+0000","Level":"SEVERE","Version":"Payara 4.1","LoggerName":"javax.enterprise.web.core","ThreadID":"58","ThreadName":"AutoDeployer","TimeMillis":"1531567894998","LevelValue":"1000","MessageID":"AS-WEB-CORE-00108","LogMessage":{"Exception":"ContainerBase.addChild: start: ","StackTrace":"org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5523)
at com.sun.enterprise.web.WebModule.start(WebModule.java:594)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:956)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:939)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:684)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2105)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1750)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:107)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:294)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:357)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:509)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:227)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:536)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:544)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.e
xecute(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:570)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:562)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:561)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1469)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1851)
at org.glassfish.deployment.autodeploy.AutoOperation.run(AutoOperation.java:164)
at org.glassfish.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:597)
at org.glassfish.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:484)
at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:412)
at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:403)
at org.glassfish.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:233)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener
at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:2884)
at org.apache.catalina.core.StandardContext.addApplicationListener(StandardContext.java:2080)
at com.sun.enterprise.web.TomcatDeploymentConfig.configureApplicationListener(TomcatDeploymentConfig.java:236)
at com.sun.enterprise.web.TomcatDeploymentConfig.configureWebModule(TomcatDeploymentConfig.java:95)
at com.sun.enterprise.web.WebModuleContextConfig.start(WebModuleContextConfig.java:239)
at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:336)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:163)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5520)
... 34 more
Caused by: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener
at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:3005)
at org.apache.catalina.core.StandardContext.loadListener(StandardContext.java:5043)
at com.sun.enterprise.web.WebModule.loadListener(WebModule.java:1732)
at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:2882)
... 41 more
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:353)
at com.sun.enterprise.web.WebContainer.createListenerInstance(WebContainer.java:808)
at com.sun.enterprise.web.WebModule.createListenerInstance(WebModule.java:2102)
at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:3003)
... 44 more
Caused by: java.lang.NullPointerException
at org.glassfish.weld.services.JCDIServiceImpl.createManagedObject(JCDIServiceImpl.java:358)
at org.glassfish.weld.services.JCDIServiceImpl.createManagedObject(JCDIServiceImpl.java:283)
at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:476)
at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:429)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:337)
... 47 more
"}}
This warning comes later a couple of times
{"Timestamp":"2018-07-14T11:31:35.079+0000","Level":"WARNING","Version":"Payara 4.1","LoggerName":"javax.enterprise.web","ThreadID":"58","ThreadName":"AutoDeployer","TimeMillis":"1531567895079","LevelValue":"900","LogMessage":{"Exception":"java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener","StackTrace":"java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:960)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:939)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:684)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2105)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1750)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:107)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:294)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:357)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:509)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:227)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:536)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:544)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
at j
ava.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:570)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:562)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:561)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1469)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1851)
at org.glassfish.deployment.autodeploy.AutoOperation.run(AutoOperation.java:164)
at org.glassfish.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:597)
at org.glassfish.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:484)
at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:412)
at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:403)
at org.glassfish.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:233)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
"}}
These exceptions are now repeated multiple times followed by the container has not yet started exception and in the end the good old "Autodeploy failed"
Locally it deploys fine, only on the server (OpenShift Linux Pod) it fails.
This are the only warnings I get on a local successful deploy (app runs):
WARNUNG: Could not load service class fish.payara.appserver.roles.api.extension.RolesCDIExtension
WARNUNG: Could not load service class fish.payara.appserver.roles.api.extension.RolesCDIExtension
WARNUNG: Could not load service class fish.payara.appserver.roles.api.extension.RolesCDIExtension
Information: WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(#Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using #WithAnnotations or a generic type with bounds.
Information: WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(#Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using #WithAnnotations or a generic type with bounds.
Information: WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(#Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using #WithAnnotations or a generic type with bounds.
WARNUNG: The following warnings have been detected: WARNING: Parameter interceptedBean of type javax.enterprise.inject.spi.Bean from private javax.enterprise.inject.spi.Bean org.glassfish.soteria.cdi.LoginToContinueInterceptor.interceptedBean is not resolvable to a concrete type.
WARNUNG: The following warnings have been detected: WARNING: Parameter interceptedBean of type javax.enterprise.inject.spi.Bean from private javax.enterprise.inject.spi.Bean org.glassfish.soteria.cdi.RememberMeInterceptor.interceptedBean is not resolvable to a concrete type.
WARNUNG: Class class [Ljava.lang.String; has null package
INFORMATION: Initializing Soteria 1.1-b01 for context ''
INFORMATION: Mojarra 2.2.14 (-SNAPSHOT 20170628-1326 unable to get svn info) für Kontext '' wird initialisiert.
WARN: WELD-000718: No EEModuleDescriptor defined for bean archive with ID: XXXXXXXXX_war.war. #Initialized and #Destroyed events for ApplicationScoped may be fired twice.
What have I tried:
Reverted any version updates of any libs
removed any Startup EJBs -- which in the end showed the above error
Verified the configuration
Thanks in advance
Paul
The exception is most probably a deployment error caused by your application or configuration. Payara Server has a bug that it doesn't log the original exception but throws only a subsequent exception, so you can't see what's wrong in your application from the log messages.
The issue with logging the original message is described in https://github.com/payara/Payara/issues/2332. It's fixed in Payara 5.182 and users also reported that the new weld version in 5.182 removed their deployment error.
You may try upgrading to Payara 5.182. If that's not possible, you may find out what's causing the deployment problem by debugging your the server, putting an exception breakpoint on DeploymentException and check the message of the exception.
I could pin it down to the Payara version (docker image). It seems like that where is a bigger difference between:
sh-4.2$ ./asadmin version
Version = Payara Server 4.1.2.181 #badassfish (build 220)
Command version executed successfully.
Which works fine and:
sh-4.2$ ./asadmin version
Version = Payara Server 4.1.2.182.1 #badassfish (build 308)
Command version executed successfully.
Which causes the error above. I haven't looked into the details till now -- and just reverted the version of the Payara to 4.1.2.181 again.
Disclaimer: As it is a docker image it is possible, that the payara was modified and it has nothing todo with the payara itself. I haven't verified that, as mentioned above.

Call Spring boot clases in Java application

I created a spring boot application that this use spring data postgresql to access to a database. When I test this application works fine. However, I want to use this application in other project that doesn't use spring.
I have a big project that contains two o four java aplications, I use maven to integrate all this project (through modules). I added the dependency in the java aplication in this way:
enter image description here
<dependency>
<groupId>databases</groupId>
<artifactId>databases</artifactId>
<version>${version}</version>
</dependency>
When I try to use the class created into the project Spring boot, I have the problem that this uses #Autowired and when I execute the project java, a null pointer error appears because the internal class, that is injected is null.
This is the class created in the java project (don't use spring boot)
public class MainController implements Initializable {
private TagServiceBean tagService = new TagServiceBean ();
#Override
public void initialize(URL location, ResourceBundle resources) {
Collection<Tag> tags = tagService.findAll();
for (Tag tag : tags){
selectedTags.getItems().add(tag.getF_tagname());
}
}
}
In the line "Collection tags = TagService.findAll(); I have the following error:
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at org.tenergia.historicosFX.Main.start(Main.java:15)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.tenergiaEditor.databases.service.spring.TagServiceBean.findAll(TagServiceBean.java:21)
at org.tenergia.historicosFX.controller.MainController.initialize(MainController.ja va:134)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
... 17 more
I'm assuming in TagServiceBean you are using #Autowired to inject other dependencies into fields. These fields are not automatically filled with values since you do not use Spring in your "Java Project".
You can either fill all those fields by hand (which would be quite cumbersome) or you use Spring in your "Java Project" to let Spring to the dirty work.

ClassFormatError: Duplicate method name&signature from EnhancerBySpringCGLIB

I"m really stumped here. I've upgraded our Spring libraries from 4.0.6 to 4.3.2. One of our tests fail when running with 4.3.2. This is the code in question:
#Bean(name = SCHEDULER_FACTORY)
public SchedulerFactoryBean getSchedulerFactory()
{
SchedulerFactoryBean schedulerFactory = new SchedulerFactoryBean();
schedulerFactory.setConfigLocation(schedulerConfig);
schedulerFactory.setResourceLoader(null);
schedulerFactory.setDataSource(dataSource);
schedulerFactory.setJobFactory(getSchedulerJobFactory());
schedulerFactory.setAutoStartup(false);
return schedulerFactory;
}
#Bean(name = SCHEDULER)
public Scheduler getScheduler()
{
return getSchedulerFactory().getScheduler();
}
I'm getting the error java.lang.ClassFormatError: Duplicate method name&signature in class file org/springframework/scheduling/quartz/SchedulerFactoryBean$$EnhancerBySpringCGLIB$$bee87fe8$$EnhancerBySpringCGLIB$$6bb26669.
Running the test using spring 4.0.6 framework works perfectly fine, but with 4.3.2, it's failing. When using 4.0.6, I was using cglib no dependencies library. With 4.3.2, the tests fail regardless of whether or not I use cglib.
Spring embeds cglib and objensis into 4.3.* core library. "Furthermore, Spring Framework 4.3 embeds the updated ASM 5.1, CGLIB 3.2.4, and Objenesis 2.4 in spring-core.jar." SpringDocs
We were using Java 8 and cglib-no-dep 2.2 with Spring framework 4.0.6. We tried running this code with and without the standalone library and see the same results.
Stack trace:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.quartz.Scheduler]: Factory method 'getScheduler' threw exception; nested exception is org.springframework.cglib.core.CodeGenerationException:java.lang.reflect.InvocationTargetException >null
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver$3.run(ConstructorResolver.java:582)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579)
... 112 more
Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException >null
at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:345)
at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:492)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 188.486 sec
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91)
at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116)
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291)
at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:480)
at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:337)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.enhanceFactoryBean(ConfigurationClassEnhancer.java:452)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:338)
at com.example.SpringConfiguration$$EnhancerBySpringCGLIB$$54d3cb35.getSchedulerFactory(<generated>)
at com.example.SpringConfiguration.getScheduler(SpringConfiguration.java:242)
at com.example.SpringConfiguration$$EnhancerBySpringCGLIB$$54d3cb35.CGLIB$getScheduler$24(<generated>)
at com.example.SpringConfiguration$$EnhancerBySpringCGLIB$$54d3cb35$$FastClassBySpringCGLIB$$a2a6e004.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
at com.example.SpringConfiguration$$EnhancerBySpringCGLIB$$54d3cb35.getScheduler(<generated>)
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.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 115 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:413)
at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336)
... 140 more
Caused by: java.lang.ClassFormatError: Duplicate method name&signature in class file org/springframework/scheduling/quartz/SchedulerFactoryBean$$EnhancerBySpringCGLIB$$bee87fe8$$EnhancerBySpringCGLIB$$6bb26669
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
... 145 more
This is definetly a bug in cglib. It seems like it does not currectly determines a method in the type hierarchy to be equal to another method. Are you using Java 8 in combination with default methods in interfaces?
Cglib is not really tested for modern Java versions and experiences only little maintenance. Newer features sometimes cause trouble when using the library.

Categories