How Debug a JHipster Application builded with gradle in VSCode - debugging

I created an Application with JHipster selecting gradle as builder. I already installed all the plugins related with java, gradle, spring boot and jhipster of course but if I start the app with the vscode options, the app dont start because some compilations issues, if I run the app from the terminal with gradle, runs well
Here the log...
2019-04-12 13:58:00.371 ERROR 43559 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'blackListQueryService' defined in file [/Users/setterlee/Development/Git/Unicard/autoatencion-rest/bin/main/cl/unicard/autoatencion/rest/service/BlackListQueryService.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'cl.unicard.autoatencion.rest.service.mapper.BlackListMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:733)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:198)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1266)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1123)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:548)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at cl.unicard.autoatencion.rest.ServiciosRestAutoatencionApp.main(ServiciosRestAutoatencionApp.java:63)
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.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'cl.unicard.autoatencion.rest.service.mapper.BlackListMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1506)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1101)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:819)
at org.springframework.beans.factory.support.ConstructorResolv
er.createArgumentArray(ConstructorResolver.java:725)
... 22 common frames omitted
I just want debug the app with vscode.
Any idea or alternative?
Thanks a lot...

Related

org.eclipse.persistence.exceptions.ValidationException: Cannot add a query whose types conflict with an existing query

I have a Java EE application on stock trading which calls the EJB using a web service. All was working fine until I added an extra field in the database. The app gives the following exception:
WARNING: A system exception occurred during an invocation on EJB StockCommodityEJB method public java.util.Collection ejb.StockCommodityEJB.getAllScrips()
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean
at com.sun.ejb.containers.BaseContainer.checkExceptionClientTx(BaseContainer.java:5049)
at $Proxy640.getAllScrips(Unknown Source)
at service.StatelessWebService.getAllScrips(StatelessWebService.java:62)
....
...
com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:116)
at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:212)
...
Caused by: Exception [EclipseLink-7092] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Cannot add a query whose types conflict with an existing query. Query To Be Added: [ReadAllQuery(name="UserStock.findAll" referenceClass=UserStock jpql="SELECT u FROM UserStock u")] is named: [UserStock.findAll] with arguments [[]].The existing conflicting query: [ReadAllQuery(name="UserStock.findAll" referenceClass=UserStock jpql="SELECT u FROM UserStock u")] is named: [UserStock.findAll] with arguments: [[]].
at org.eclipse.persistence.exceptions.ValidationException.existingQueryTypeConflict(ValidationException.java:902)
at org.eclipse.persistence.internal.sessions.AbstractSession.addQuery(AbstractSession.java:422)
at org.eclipse.persistence.internal.sessions.AbstractSession.addQuery(AbstractSession.java:395)
at org.eclipse.persistence.internal.sessions.AbstractSession.processJPAQueries(AbstractSession.java:2148)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:442)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:673)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:631)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:284)
...
com.sun.enterprise.container.common.impl.EntityManagerWrapper.createNamedQuery(EntityManagerWrapper.java:532)
at ejb.StockCommodityEJB.getAllScrips(StockCommodityEJB.java:351)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
...
SEVERE: The log message is null.
javax.ejb.EJBTransactionRolledbackException
at ejb._StockCommodityEJBStateless_Wrapper.getAllScrips(ejb/_StockCommodityEJBStateless_Wrapper.java)
at service.StatelessWebService.getAllScrips(StatelessWebService.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
...
Caused by: javax.transaction.TransactionRolledbackException: CORBA TRANSACTION_ROLLEDBACK 9998 Maybe; nested exception is:
org.omg.CORBA.TRANSACTION_ROLLEDBACK: vmcid: 0x2000 minor code: 1806 completed: Maybe
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:277)
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.wrapException(Util.java:696)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:251)
...
Caused by: Exception [EclipseLink-7092] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Cannot add a query whose types conflict with an existing query. Query To Be Added: [ReadAllQuery(name="UserStock.findAll" referenceClass=UserStock jpql="SELECT u FROM UserStock u")] is named: [UserStock.findAll] with arguments [[]].The existing conflicting query: [ReadAllQuery(name="UserStock.findAll" referenceClass=UserStock jpql="SELECT u FROM UserStock u")] is named: [UserStock.findAll] with arguments: [[]].
at org.eclipse.persistence.exceptions.ValidationException.existingQueryTypeConflict(ValidationException.java:902)
at org.eclipse.persistence.internal.sessions.AbstractSession.addQuery(AbstractSession.java:422)
at org.eclipse.persistence.internal.sessions.AbstractSession.addQuery(AbstractSession.java:395)
...
WARNING: A system exception occurred during an invocation on EJB StatelessWebService method public java.util.Collection service.StatelessWebService.getAllScrips()
javax.ejb.EJBTransactionRolledbackException
at ejb._StockCommodityEJBStateless_Wrapper.getAllScrips(ejb/_StockCommodityEJBStateless_Wrapper.java)
at service.StatelessWebService.getAllScrips(StatelessWebService.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5366)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:619)
...
at $Proxy641.getAllScrips(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Caused by: Exception [EclipseLink-7092] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Cannot add a query whose types conflict with an existing query. Query To Be Added: [ReadAllQuery(name="UserStock.findAll" referenceClass=UserStock jpql="SELECT u FROM UserStock u")] is named: [UserStock.findAll] with arguments [[]].The existing conflicting query: [ReadAllQuery(name="UserStock.findAll" referenceClass=UserStock jpql="SELECT u FROM UserStock u")] is named: [UserStock.findAll] with arguments: [[]].
at org.eclipse.persistence.exceptions.ValidationException.existingQueryTypeConflict(ValidationException.java:902)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:631)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:284)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:275)
...
SEVERE: Error Rendering View[/AdminTemplate/scripMaster.xhtml]
javax.el.ELException: /AdminTemplate/scripMaster.xhtml #50,61 value="#{manageScrip.scripList}": javax.xml.ws.soap.SOAPFaultException: javax.ejb.EJBTransactionRolledbackException
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIData.getValue(UIData.java:731)
at org.primefaces.component.datatable.DataTable.getValue(DataTable.java:786)
at javax.faces.component.UIData.getDataModel(UIData.java:1798)
at javax.faces.component.UIData.getRowCount(UIData.java:356)
at org.primefaces.component.api.UIData.calculatePage(UIData.java:116)
...
at $Proxy643.getAllScrips(Unknown Source)
at beans.manageScrip.getAllScrips(manageScrip.java:422)
at beans.manageScrip.getScripList(manageScrip.java:180)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:302)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.el.parser.AstValue.getValue(AstValue.java:116)
at com.sun.el.parser.AstValue.getValue(AstValue.java:163)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:55)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
... 48 more
WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
javax.xml.ws.soap.SOAPFaultException: javax.ejb.EJBTransactionRolledbackException
at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:193)
...
i debugged and found that the exception was thrown at getAllScrips method of ejb
Following is the managed bean method and web service method:
private java.util.List<service.ScripMaster> getAllScrips() {
service.StatelessWebService port = service.getStatelessWebServicePort();
return port.getAllScrips();
}
public List<ScripMaster> getScripList() {
scripList=new ArrayList<ScripMaster> ();
scripList=getAllScrips();
return scripList;
}
Following is the EJB method:
#Override
public Collection<ScripMaster> getAllScrips() {
Collection<ScripMaster> scripCollection=null;
scripCollection=em.createNamedQuery("ScripMaster.findAll").getResultList();
return scripCollection;
}
scrip.findall query :
#NamedQuery(name = "ScripMaster.findAll", query = "SELECT s FROM ScripMaster s")
Edited:
in entity class ScripMaster.java i added the below code:
#Column(name = "PreviousClose", precision = 22)
private Double previousClose; //new column
#Column(name = "Change", precision = 22)
private Double change; //new column
and their getter setter dats it.
How is this caused and how can I solve it?
The actual problem is logged well before this problem starts to occur, and may have nothing to do with the query you are executing - it just happens that this is the first EM access in your application and the container is wrapping the EM behind a proxy.
EclipseLink has bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=376995 which is fixed in 2.4 that would result in this error occuring when the deployment stage is in a failed state. Trying to use the factory after the failure would result in it attempting to re-add the JPQL queries, resulting in this error. The patch holds onto the intial error and rethrows it, making it easier to find the initial cause. So you can try using EclipseLink 2.4 nightly build, but the actual cause should be appearing in the logs during the EMF deployment.
What code did you add to the application to support the new field?
I worked around it with using a different name for the query. Starting a named query's name with "find" does seem to cause the trouble.
Currently, which eclipse version do you use? It is a issue of EclipseLink 2.1.2.
I would like to suggest to use javax.persistence_2.0.4.v201112161009 and eclipselink.jar version with EclipseLink 2.4.1. Download EclipseLink 2.4.1

Tomcat doesn't seem to be picking up jars in my WEB-INF/lib folder

I have a maven pom that builds all my required libraries into my WEB-INF/lib folder, then packages it up as a war. When I try to deploy this war, Tomcat throws many ClassNotFoundExceptions - the latest one being "java.lang.ClassNotFoundException: javax.xml.bind.annotation.AccessorOrder"; The only way I've found to fix it is to copy the required library files from my WEB-INF/lib folder and tossing them into tomcat/lib, but this can't be the correct way of doing it.
Is there something I have to do to tomcat to make it look in my WEB-INF/lib folders?
Is there something I have to do in my source to tell tomcat to look there?
Am I stuck having to have my tomcat/lib folder filled with 50+ jars?
Maybe it's relevant, but I'm using CXF and Spring-MVC technologies.
I'd post source code, but I don't know which file to put, so I'll post this current error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'publisher' defined in ServletContext resource [/WEB-INF/forum-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [publisher.Publisher]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/annotation/AccessorOrder at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [publisher.Publisher]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/annotation/AccessorOrder
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)
... 36 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/AccessorOrder
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createClassInfo(RuntimeModelBuilder.java:59)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createClassInfo(RuntimeModelBuilder.java:41)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:123)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:49)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:204)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:327)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:198)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
Thanks for any help
Use Maven the correct way: use "war" packaging and put all the needed libraries as dependencies.

ClassNotFoundException for sun.reflect.MethodAccessorImpl using Janino + Logback + Tomcat on redeploy

I have an application deployed under tomcat 8.5.32 (latest java 8, 1.8.0_181), using the latest logback 1.2.3, janino 3.0.8 and slf4f 1.7.25.
My logback xml has a filter like this:
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator>
<expression>return message != null && message.contains("127.0.0.1");
</expression>
</evaluator>
<OnMismatch>NEUTRAL</OnMismatch>
<OnMatch>DENY</OnMatch>
</filter>
It all works fine until I redeploy. Then I get an exception like this:
Jul 30, 2018 8:00:18 AM org.apache.catalina.startup.HostConfig reload
WARNING: Error during context [] restart
org.apache.catalina.LifecycleException: Failed to stop component [StandardEngine[Catalina-b].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:238)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:142)
at org.apache.catalina.startup.HostConfig.reload(HostConfig.java:1386)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1287)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1586)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:280)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1136)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1372)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1376)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1344)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: sun/reflect/MethodAccessorImpl
at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:399)
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 org.codehaus.janino.ScriptEvaluator.evaluate(ScriptEvaluator.java:756)
at org.codehaus.janino.ScriptEvaluator.evaluate(ScriptEvaluator.java:748)
at ch.qos.logback.core.boolex.JaninoEventEvaluatorBase.evaluate(JaninoEventEvaluatorBase.java:72)
at ch.qos.logback.core.filter.EvaluatorFilter.decide(EvaluatorFilter.java:65)
at ch.qos.logback.core.spi.FilterAttachableImpl.getFilterChainDecision(FilterAttachableImpl.java:52)
at ch.qos.logback.core.AppenderBase.getFilterChainDecision(AppenderBase.java:134)
at ch.qos.logback.core.AppenderBase.doAppend(AppenderBase.java:80)
at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:48)
at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:272)
at ch.qos.logback.classic.Logger.callAppenders(Logger.java:259)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:441)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:395)
at ch.qos.logback.classic.Logger.log(Logger.java:787)
at org.slf4j.bridge.SLF4JBridgeHandler.callLocationAwareLogger(SLF4JBridgeHandler.java:224)
at org.slf4j.bridge.SLF4JBridgeHandler.publish(SLF4JBridgeHandler.java:301)
at java.util.logging.Logger.log(Logger.java:738)
at java.util.logging.Logger.doLog(Logger.java:765)
at java.util.logging.Logger.logp(Logger.java:1042)
at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:181)
at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:147)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4780)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5411)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
... 11 more
Caused by: java.lang.ClassNotFoundException: sun.reflect.MethodAccessorImpl
at org.codehaus.janino.ByteArrayClassLoader.findClass(ByteArrayClassLoader.java:68)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 44 more
My theory is that juli->SLF4J->logback->janino ends up using the container class loader that ends up stopped, but the logging framework doesn't realize that.
Any idea on how to work around this?
This turned out to be a problem caused by the logback listener not being first in my web.xml
<listener>
<listener-class>ch.qos.logback.classic.selector.servlet.ContextDetachingSCL</listener-class>
</listener>
https://logback.qos.ch/manual/loggingSeparation.html clearly stated as much:
Most containers invoke the contextInitialized() method of listeners in
the order in which they are declared but invoke their
contextDestroyed() method in reverse order. It follows that if you
have multiple ServletContextListener declarations in your web.xml,
then ContextDetachingSCL should be declared first so that its
contextDestroyed() method is invoked last during application shutdown.

Object is not an instance of declaring class while deploying EAR application

I have such a structure of my project
EmployeeManager (ear)
|--EmployeeManagerEJB (jar)
|--EmployeeManagerJSF (war)
|--EmployeeManagerIntegration (jar)
EmployeeManager - .ear project containing X_EJB, X_JSF, X_Integration
EmployeeManagerEJB - EJB Project packed into jar containing JPA Entities, EJB Stateless Bean Implementations
EmployeeManagerJSF - Dynamic web project containing JSF's xhtml pages and controllers
EmployeeManagerIntegration - Interfaces implemented by EJBs (used in JSF project), DTOs
I am using CDI in EJB Bean Implementations to e.g. inject one EJB into another (i'm referencing by interface, not by implementation class). I am also using these Stateless Beans via CDI in X_JSF's controller classes. When I'm trying to deploy an EAR I receive stack trace:
16:52:13,694 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."EmployeeManager.ear".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."EmployeeManager.ear".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
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.jboss.weld.resolution.QualifierInstance.createValues(QualifierInstance.java:128)
at org.jboss.weld.resolution.QualifierInstance.of(QualifierInstance.java:95)
at org.jboss.weld.resolution.ResolvableBuilder.addQualifier(ResolvableBuilder.java:147)
at org.jboss.weld.resolution.ResolvableBuilder.addQualifiers(ResolvableBuilder.java:197)
at org.jboss.weld.resolution.ResolvableBuilder.addQualifiers(ResolvableBuilder.java:192)
at org.jboss.weld.manager.BeanManagerImpl.resolveDecorators(BeanManagerImpl.java:885)
at org.jboss.weld.injection.producer.BeanInjectionTarget.initializeAfterBeanDiscovery(BeanInjectionTarget.java:109)
at org.jboss.weld.injection.producer.InjectionTargetInitializationContext.initialize(InjectionTargetInitializationContext.java:42)
at org.jboss.weld.injection.producer.InjectionTargetService.initialize(InjectionTargetService.java:63)
at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:434)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:95)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
... 3 more
This is the only error-type message I get from wildfly, don't know what may be wrong here and where to begin searching.
I suspect that CDI error is the reason somehow, but dont know how to debug or something. Any suggestions ?
Sample code with injections:
1. Interface
#Local
public interface ChartService extends Serializable {
Collection<String> getSomething();
}
2. Implementation
#Stateless
public class ChartServiceImpl implements ChartService {
#Inject DateService dateService;
}
1., Use Qualifiers to identify the injectable implementation
https://docs.oracle.com/javaee/6/tutorial/doc/gjbck.html
or
2., Use #Alternative and declare one of the alternatives in the beans.xml
https://docs.oracle.com/javaee/6/tutorial/doc/gjsdf.html

Grails Quartz Plugin error when running in stand-alone tomcat instance

I am working on a grails project that leverages the quartz plugin. The plugin works as expected without issue running the project locally in development mode. However, I am getting the following error when running the project in a stand-alone instance of tomcat.
Error initializing Grails: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class grails.plugins.quartz.DefaultGrailsJobClass
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class grails.plugins.quartz.DefaultGrailsJobClass
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class grails.plugins.quartz.DefaultGrailsJobClass
... 1 more
Caused by: java.lang.reflect.InvocationTargetException
... 1 more
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at grails.plugins.quartz.config.TriggersConfigBuilder.createTrigger(TriggersConfigBuilder.groovy:77)
at grails.plugins.quartz.config.TriggersConfigBuilder.createNode(TriggersConfigBuilder.groovy:251)
at grails.plugins.quartz.config.TriggersConfigBuilder.createNode(TriggersConfigBuilder.groovy:244)
at org.motus.CompetitionJob$__clinit__closure10.doCall(CompetitionJob.groovy:18)
at grails.plugins.quartz.config.TriggersConfigBuilder.build(TriggersConfigBuilder.groovy:51)
at grails.plugins.quartz.DefaultGrailsJobClass.evaluateTriggers(DefaultGrailsJobClass.java:57)
at grails.plugins.quartz.DefaultGrailsJobClass.<init>(DefaultGrailsJobClass.java:47)
... 1 more
Here is what I have in the BuildConfig.groovy
compile ":quartz:1.0.1"
Any ideas or direction on how to remedy would be most appreciated. Thanks in advance for your help.
I am also using the Apache Shiro plugin, which turns out had a quartz dependency that needed to be excluded. Thanks Lalit for the link
compile ":quartz:1.0.1"
compile (":shiro:1.2.1"){
excludes "quartz"
}

Resources