FeignBuilder ClassNotFoundException issue - java

I'm getting following exception in a project using OpenFeign. Please suggest how to resolve this issue.
Exception is given below:
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.seamless.ers.links.kyc.client.CustomerDetailsClient': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.openfeign.FeignClientFactoryBean] from ClassLoader [sun.misc.Launcher$AppClassLoader#18b4aac2]
at
...
Caused by: java.lang.ClassNotFoundException: feign.Feign$Builder
at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_301]
at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_301]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) ~[na:1.8.0_301]
at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_301]
... 25 common frames omitted
Below are the dependencies added:
spring-cloud-starter
spring-cloud-openfeign-core
spring-boot-starter-test
spring-boot-starter-web

Most famous class loading exception and indicates that compiler have difficulties to detect proper dependent class i.e provided the dependency at runtime, following are most healer to issue
Check the version and probably duplication of your maven artifact for spring-cloud-starter - spring-cloud-openfeign-core if you are not using spring boot parent and if the artifacts imported properly from firtplace,
Check the scope of the dependencies, for the current case in hand the will be provided to compile <scope>provided</scope>
Exclude the duplicate dependencies that they provide spring feign as transparent dependency .

Related

Gradle not including one dependency when creating the artifact

I am using Gradle in an IntelliJ project to manage dependencies in a Spring project to provide REST web services. As long as I run the project in the IDE it works fine, but if I execute the java -jar artifact.jar command it cannot start. The following error is printed
13:42:47.338 [main] WARN org.springframework.boot.SpringApplication - Unable to close ApplicationContext
java.lang.IllegalStateException: Failed to introspect Class [com.(...).web_services.JmsConfiguration] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader#2cdf8d8a]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:358)
at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:414)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$2(AbstractAutowireCapableBeanFactory.java:747)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:746)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:685)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:656)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1670)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:570)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:542)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:667)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:659)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1300)
at org.springframework.boot.SpringApplication.getExitCodeFromMappedException(SpringApplication.java:914)
at org.springframework.boot.SpringApplication.getExitCodeFromException(SpringApplication.java:902)
at org.springframework.boot.SpringApplication.handleExitCode(SpringApplication.java:889)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:830)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:349)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329)
at com.(...).web_services.WebServicesApplication.main(WebServicesApplication.java:10)
Caused by: java.lang.NoClassDefFoundError: javax/jms/ConnectionFactory
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2309)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463)
... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.jms.ConnectionFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 25 common frames omitted
I suppose the javax.jms.ConnectionFactory class comes with the Spring ActiveMQ package, and I already tried to update Gradle manually but that did not solve the problem. Also importing javax.jms.ConnectionFactory in the JMS class did not help. Any clue?
The first attempt was to create a fat jar using the following custom gradle task (as suggested by #MatteoNNZ following this guide).
task customFatJar(type: Jar) {
manifest {
attributes 'Main-Class': '<myPackage>.<myMainClass>'
}
baseName = 'all-in-one-jar'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
However, as this didn't work, I ran the predefined gradle task buildDependents that created a working .jar in the build/libs folder.

ObjectBox Java sometimes throws error java.lang.ClassNotFoundException: kotlin.text.Charsets

Sometimes when i run the application that using ObjectBox java with no kotlin coding, java throws this error. java.lang.ClassNotFoundException: kotlin.text.Charsets
dependencies {
// Optional: include all native libraries for distribution
implementation "io.objectbox:objectbox-linux:$objectboxVersion"
implementation "io.objectbox:objectbox-macos:$objectboxVersion"
implementation "io.objectbox:objectbox-windows:$objectboxVersion"
}
apply plugin: 'io.objectbox'
But run again the error gone and the application started normally... anything wrong? do i need to include kotlin lib in my gradle build manually? or its caused by the ide is building the project so get error on the first run its confusing here. I am using IntelliJ, Gradle,ObjectBox 2.8.1,Java 1.8
Stacktrace:
Exception in thread "Thread-109" java.lang.NoClassDefFoundError: kotlin/text/Charsets
at io.objectbox.reporting.BasicBuildTracker.sendEvent(BasicBuildTracker.kt:166)
at io.objectbox.reporting.BasicBuildTracker$sendEventAsync$1.run(BasicBuildTracker.kt:143)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: kotlin.text.Charsets
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
Caused by: java.lang.ClassNotFoundException: kotlin.text.Charsets
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
java.lang.ClassNotFoundException: kotlin.text.Charsets
Caused by: java.lang.ClassNotFoundException: kotlin.text.Charsets

Remote EJB lookup using Spring Boot and WebSphere 8.5.5

I have a batch application using Spring Batch, and I'm using Spring Boot as well. This application needs to do Remote EJB lookups to load some informations from the application server.
Until now we were using JBoss EAP 6.1. My pom.xml contains a profile specific for JBoss and I was using the following dependency:
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-ejb-client-bom</artifactId>
<version>7.2.0.Final</version>
<type>pom</type>
</dependency>
Now we need to migrate this application to WebSphere 8.5.5. I've created a new maven profile in my pom.xml with the following dependencies for Remote EJB Lookup on WebSphere.
<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>com.ibm.ws.ejb.thinclient</artifactId>
<version>8.5.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>com.ibm.ws.orb</artifactId>
<version>8.5.0</version>
<type>pom</type>
</dependency>
Of course I've already installed this jars in my maven local repository.
Trying to execute the batch again, after configuring all the JNDI properties, Initial Context factory pointing to "com.ibm.websphere.naming.WsnInitialContextFactory" and Provider URL to "corbaloc:iiop:localhost:2817", I got the following exception:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [br.com.cpqd.components.security.api.user.SecurityUser]: Factory method 'securityUserEjb' threw exception; nested exception is javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory [Root exception is java.lang.ClassNotFoundException: com.ibm.websphere.naming.WsnInitialContextFactory]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 27 common frames omitted
Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
at javax.naming.InitialContext.init(InitialContext.java:242)
at javax.naming.InitialContext.<init>(InitialContext.java:216)
at org.springframework.jndi.JndiTemplate.createInitialContext(JndiTemplate.java:136)
at org.springframework.jndi.JndiTemplate.getContext(JndiTemplate.java:103)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:179)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:106)
at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:231)
at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:217)
at br.com.batch.common.BatchCommonConfig.securityUserEjb(BatchCommonConfig.java:101)
at br.com.batch.common.BatchCommonConfig$$EnhancerBySpringCGLIB$$e2167a67.CGLIB$securityUserEjb$4(<generated>)
at br.com.cpqd.saf.events.batch.common.BatchCommonConfig$$EnhancerBySpringCGLIB$$e2167a67$$FastClassBySpringCGLIB$$30b25502.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
at br.com.batch.common.BatchCommonConfig$$EnhancerBySpringCGLIB$$e2167a67.securityUserEjb(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 28 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.ibm.websphere.naming.WsnInitialContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:63)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:671)
... 51 common frames omitted
Ok, the class has not being found. Trying to figure out the problem, I've changed the dependency type of WebSphere libs from "pom" to "jar".
Now, I'm getting the following exception:
(Sorry about this Portuguese text, but the error code may help)
**NMSV0307E**: Um nome de URL java: foi utilizado, mas a Nomenclatura não foi configurada para manipular nomes de URL java:. A causa provável é um erro do usuário ao tentar especificar um nome de URL java: em um cliente não J2EE ou no ambiente do servidor. Emitindo ConfigurationException.
2016-06-06 14:43:18.952 WARN 18856 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor': Invocation of init method failed; nested exception is javax.validation.ValidationException: Could not create Configuration.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:199)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:615)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:465)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at br.com.cpqd.saf.events.batch.BatchProcessingBootstrap.main(BatchProcessingBootstrap.java:62)
Caused by: javax.validation.ValidationException: Could not create Configuration.
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:175)
at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:223)
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor$Jsr303ValidatorFactory.run(ConfigurationPropertiesBindingPostProcessor.java:381)
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.afterPropertiesSet(ConfigurationPropertiesBindingPostProcessor.java:174)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1625)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1562)
... 12 common frames omitted
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:635)
at java.util.ArrayList.get(ArrayList.java:411)
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:173)
... 17 common frames omitted
Googling the error message and reading lots of sites, I think that for some reason Spring Boot is not allowing the embeddable EJB container provided by the com.ibm.ws.ejb.thinclient jar to start, but I'm not sure.
Does anyone already tried to do that?
The IndexOutOfBoundsException is the (poor) exception thrown by javax.validation.Validation when the API is available on the classpath (likely com.ibm.ws.ejb.thinclient JAR) but an implementation provider is not. According to the Spring documentation, the ConfigurationPropertiesBindingPostProcessor class attempts to use the javax.validation API when it is available on the classpath.
I don't know Spring Boot well enough to know if there's a way to disable your behavior, so my best suggestion would to also include a javax.validation implementation on your classpath. For example, you could also include the com.ibm.ws.jpa.thinclient JAR.

jcl-slf4j and axis 1.4 exception while substituting commons-logging

We are trying to substitute commons-logging + log4j by jcl-over-slf4j and logback (OK, at first we will try jcl-over-slf4j and log4j). Our application runs under WAS 8.0. Once the commons-logging jar has been erased and substituted by jcl-over-slf4j, slf4j and slf4j-log4j, we get this error message:
[21/11/14 16:12:08:430 CET] 0000006a webapp E com.ibm.ws.webcontainer.webapp.WebApp commonInitializationFinally SRVE0266E: Se ha producido un error al inicializar los servlets: {0}
javax.servlet.ServletException: SRVE0207E: No se ha detectado la excepción de inicialización creada por el servlet
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:404)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.loadOnStartupCheck(ServletWrapper.java:1366)
at com.ibm.ws.webcontainer.webapp.WebApp.doLoadOnStartupActions(WebApp.java:615)
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinally(WebApp.java:584)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:421)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:422)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:714)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1164)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1369)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:967)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:770)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1361)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2162)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:446)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:389)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:117)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:664)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5468)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5594)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:678)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:622)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1251)
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 sun.reflect.misc.Trampoline.invoke(MethodUtil.java:57)
at sun.reflect.GeneratedMethodAccessor71.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:260)
at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1141)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1135)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:988)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:835)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:771)
at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228)
at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181)
at com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:247)
at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:360)
at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:602)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1819)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:558)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:608)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:985)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1074)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1702)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tareaIntegrationLectSolicitNuevasFacturas': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private es.nexus.facturaelectronica.service.interfaces.integrations.IIntegracionPersistirNuevasFacturas es.nexus.facturaelectronica.service.impl.integrations.IntegrationLectSolicitNuevasFacturas.integracionPersistirNuevasFacturas; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tareaIntegrationPersistirNuevasFacturas' defined in ServletContext resource [/WEB-INF/classes/bean-application-config.xml]: Initialization of bean failed; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1686)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:410)
... 53 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private es.nexus.facturaelectronica.service.interfaces.integrations.IIntegracionPersistirNuevasFacturas es.nexus.facturaelectronica.service.impl.integrations.IntegrationLectSolicitNuevasFacturas.integracionPersistirNuevasFacturas; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tareaIntegrationPersistirNuevasFacturas' defined in ServletContext resource [/WEB-INF/classes/bean-application-config.xml]: Initialization of bean failed; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:240)
... 71 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tareaIntegrationPersistirNuevasFacturas' defined in ServletContext resource [/WEB-INF/classes/bean-application-config.xml]: Initialization of bean failed; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:671)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:610)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
... 73 more
Caused by: java.lang.ExceptionInInitializerError
at org.apache.axis.description.TypeDesc.<clinit>(TypeDesc.java:61)
at es.gob.face.webservice.SRCFFactura.<clinit>(SRCFFactura.java:196)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at com.sun.proxy.$Proxy450.<clinit>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.reflect.Proxy.newInstance(Proxy.java:715)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:706)
at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:117)
at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:488)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:363)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:324)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:361)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1343)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
... 84 more
Caused by: org.apache.commons.discovery.DiscoveryException: Class org.apache.commons.logging.impl.LogFactoryImpl does not implement org.apache.commons.logging.LogFactory
at org.apache.commons.discovery.tools.ClassUtils.verifyAncestory(ClassUtils.java:180)
at org.apache.commons.discovery.tools.SPInterface.verifyAncestory(SPInterface.java:201)
at org.apache.commons.discovery.tools.SPInterface.newInstance(SPInterface.java:195)
at org.apache.commons.discovery.tools.DiscoverClass.newInstance(DiscoverClass.java:579)
at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:418)
at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:378)
at org.apache.axis.components.logger.LogFactory$1.run(LogFactory.java:45)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.axis.components.logger.LogFactory.getLogFactory(LogFactory.java:41)
at org.apache.axis.components.logger.LogFactory.<clinit>(LogFactory.java:33)
... 103 more
It all end with the org.apache.commons.discovery.DiscoveryException: Class org.apache.commons.logging.impl.LogFactoryImpl does not implement org.apache.commons.logging.LogFactory
error message.
Is there some kind of incompatibility between commons-logging and its jcl-over-slf4j substitute?
We've checked some other projects, and it seems a common pattern: axis 1.4 + jcl-over-slf4j = exception.
[Note 1]
Classloader policy: tests.
In order to get commons-logging working with log4j at application level, we have assigned those libraries to the application (first we declare them both as "shared libraries", and we do the same with commons-logging.properties and log4j.properties files, then We assign them all to the application, and then we set the application's classloader policy to "Parent Last". This way, we force the application to load and use it's own copy of commons-logging, with its own configuration file, thus overcoming the commons-logging.properties included within WAS. This said, we have tried some "stupid" configurations, like make all the application use a single application classloader, or setting the web modules classloader policy to Parent Last. Such changes made no difference, as expected.
This far, we have found some nasty scenarios:
Axis + WAS logging facility (write all to SystemOut): OK, it works,
but we do not want everything written down to SystemOut!
Axis + commons-logging + log4j + their configuration files assigned
to the application at application classloader level,policy=Parent
Last. Some applications work, some others don't (theyshow messages
like the one quoted before).
jcl-over-slf4j + log4j + configuration file for log4j: Same result
as in point 2 of this list.
The last application we are dealing with right now, the application that fails with the excetions in the code block quoted previously: we have discovered that it only fails when we use configuration 3 (in this list), but it does not fail with configuration 2, which is very surprising and unexpected: in previous test with other applications, if the configuration fails with configuration 2, then it also fails with configuration 3.
[End of Note 1]
Any help will be welcome.
We have exactly the same Setup here:
WAS 8.0.0.9
log4j for logging
EAR containing jcl-over-slf4j, slf4j and slf4j-log4j
Axis 1.4
Classloader policy Parent Last and WAR policy Single class loader for application
As soon as axis-classes are loaded, some static-initializer-block gets executed and we get this Exception:
DiscoveryException: Class org.apache.commons.logging.impl.LogFactoryImpl does not implement org.apache.commons.logging.LogFactory
It seems like org.apache.commons.logging.LogFactory is loaded from jcl-over-slf4j and org.apache.commons.logging.impl.LogFactoryImpl is provided by WebSphere.
The only way it works for us, is to remove jcl-over-slf4j.jar from our EAR. Of course this way we might lose some Logs or find them in WebSphere SystemOut.log but at least 'it works'...
We encountered the same issues. Our solution is to tell commons-logging to use the slf4j factory implementation in our classloading context (in our case an ejb.jar).
To achieve this we simply added a commons-logging.properties file to our ejb.jar root folder with following content:
priority=1
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.SLF4JLogFactory
This resolved the issue in our application.
Maybe this can help you. I was with a similar problem, and discovered a solution in SLF4J documentation.
http://slf4j.org/faq.html#excludingJCL
alternative 2) provided scope Commons-logging can be rather simply and
conveniently excluded as a dependency by declaring it in the provided
scope within the pom.xml file of your project. The actual
commons-logging classes would be provided by jcl-over-slf4j. This
translates into the following pom file snippet:
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.21</version>
</dependency>
The first dependency declaration essentially states that
commons-logging will be "somehow" provided by your environment. The
second declaration includes jcl-over-slf4j into your project. As
jcl-over-slf4j is a perfect binary-compatible replacement for
commons-logging, the first assertion becomes true. Unfortunately,
while declaring commons-logging in the provided scope gets the job
done, your IDE, e.g. Eclipse, will still place commons-logging.jar on
your project's class path as seen by your IDE. You would need to make
sure that jcl-over-slf4j.jar is visible before commons-logging.jar by
your IDE.
SLF4J documentation gives more alternatives, this worked for me.

sprin2.5 + quartz scheduler...org.springframework.beans.factory.BeanCreationException

I wanted to use cron trigger for my app which has spring2.5
I followed http://www.a2ztechguide.com/2011/11/spring-quartz-scheduler-integration.html this link in creating a simple pgm.. But while trying to dpeloy it to my server(weblogic 10g)...Im getting the below exception....
<Aug 8, 2013 6:17:31 PM IST> <Warning> <HTTP> <BEA-101162> <User defined listener
org.springframework.web.context.ContextLoaderListener failed:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'printCurrentTimeJobDetail' defined in URL [file:/C:/bea/user_projects
/workspaces/One_CMS_Offline/Services/build/onecms-service.xml]: Initialization of
bean failed;
nested exception is java.lang.NoClassDefFoundError: org/quartz/JobDetail
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'printCurrentTimeJobDetail' defined in URL [file:/C:/bea/user_projects/workspaces/One_CMS_Offline/Services/build/onecms-service.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/quartz/JobDetail
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
Truncated. see log file for complete stacktrace
java.lang.NoClassDefFoundError: org/quartz/JobDetail
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at java.beans.Introspector$1.run(Introspector.java:1272)
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1270)
Truncated. see log file for complete stacktrace
Can someone pls tell mw where Im going wrong? I included these 2 jars: spring-context-support-2.5.6.jar and com.springsource.org.quartz-1.6.2.jar
Can someone pls suggest some solution here..
I am not sure whether you have included the quartz related jars also .
Add the latest quartz jar to your server/lib from here .
Thanks
you have to include quartz related jar in your classpath, which version of quartz are you using?
according to the link you posted, you should add quartz dependency to your pom.xml
<dependency>
<groupId>quartz</groupId>
<artifactId>quartz</artifactId>
<version>1.5.1</version>
</dependency>
if you are not using maven, include quartz.jar in your classpath as you do with spring-context-support-2.5.6.jar
--edit--
seems odd, you don't happen to have multiple copies of the quartz in WEB-INF/lib? what is the com.springsource.org.quartz-1.6.2.jar for? try exclude it from WEB-INF/lib

Categories