Issue with xss-sanitizer plugin in grails 3.3.x - java

I am using grails-xss-sanitizer in my grails application in v3.2.11. When I tried to upgrade my application to the latest 3.3.4. It reported below issue:
[2018-04-11 11:16:37,627] [main] ERROR o.s.b.SpringApplication -
Application startup failed java.lang.NoClassDefFoundError:
org/springframework/boot/context/embedded/FilterRegistrationBean
at grails.plugin.xss.sanitizer.XssSanitizerGrailsPlugin$_doWithSpring_closure1.doCall(XssSanitizerGrailsPlugin.groovy:38)
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.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
at groovy.lang.Closure.call(Closure.java:418)
at groovy.lang.Closure.call(Closure.java:412)
at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:759)
at grails.spring.BeanBuilder.beans(BeanBuilder.java:588)
at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:531)
at org.grails.plugins.DefaultGrailsPlugin.doWithRuntimeConfiguration(DefaultGrailsPlugin.java:559)
at org.grails.plugins.AbstractGrailsPluginManager.doRuntimeConfiguration(AbstractGrailsPluginManager.java:167)
at grails.boot.config.GrailsApplicationPostProcessor.postProcessBeanDefinitionRegistry(GrailsApplicationPostProcessor.groovy:171)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:272)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:122)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at grails.boot.GrailsApp.run(GrailsApp.groovy:84)
at grails.boot.GrailsApp.run(GrailsApp.groovy:393)
at grails.boot.GrailsApp.run(GrailsApp.groovy:380)
at grails.boot.GrailsApp$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:136)
at com.the41.fraudnet.Application.main(Application.groovy:28) Caused by: java.lang.ClassNotFoundException:
org.springframework.boot.context.embedded.FilterRegistrationBean
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 34 common frames omitted
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':bootRun'.
Process 'command '/opt/jdk1.8.0_131/bin/java'' finished with non-zero exit value 1
I saw in grails 3.3.x upgrade notes:
Spring Boot 1.5.x - supported in grails 3.3.x
Spring Boot 1.5.x removes a number of deprecated classes, notably
several of the classes within the
org.springframework.boot.context.embedded package.
If your application is referencing any of the classes within this
package you will need to alter your imports to use
org.springframework.boot.web.servlet instead.
All classes in the org.springframework.boot.context.web package have
been deprecated and relocated per the Spring Boot 1.4 Release Notes.
And xss-sanitizer plugin is using the classes defined in package "org.springframework.boot.context.embedded"
So, Is there any plans on the upgrade of xss-sanitizer plugin for grails 3.3.x or any workaround for this issue?

There is no reasonable workaround to this other than to upgrade the plugin.
It appears that the plugin is being upgraded; see source here https://github.com/rpalcolea/grails-xss-sanitizer/blob/master/gradle.properties that references grails version 3.3.0. You may also want to track or comment on this issue: https://github.com/rpalcolea/grails-xss-sanitizer/issues/1 since it describes the problem that you are seeing.

Related

Liferay 7.3 - org.hibernate.MappingException: entity class not found

I'm pretty new to Liferay development. I'm working on migrating a project from 6.2 to 7.3.
The plugin I'm working on has the -api / -service / -portlet structure that I've seen in the tutorials.
When I try to deploy the service JAR to my server, I'm getting the following error:
2021-07-07 10:30:11.759 ERROR [pipe-start 1356][LiferayServiceExtender:88] org.hibernate.MappingException: entity class not found: PhishRodLab.db.model.impl.Customer_PreferencesImpl
org.hibernate.MappingException: entity class not found: PhishRodLab.db.model.impl.Customer_PreferencesImpl
at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:125)
at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:191)
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:67)
at org.hibernate.tuple.entity.EntityMetamodel.(EntityMetamodel.java:135)
at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:485)
at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:133)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:286)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:795)
at com.liferay.portal.spring.hibernate.PortalHibernateConfiguration.newSessionFactory(PortalHibernateConfiguration.java:298)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:717)
at com.liferay.portal.spring.hibernate.PortalHibernateConfiguration.buildSessionFactory(PortalHibernateConfiguration.java:99)
at com.liferay.portal.spring.extender.internal.LiferayServiceExtender$LiferayServiceExtension.start(LiferayServiceExtender.java:148)
at com.liferay.portal.spring.extender.internal.LiferayServiceExtender.addingBundle(LiferayServiceExtender.java:83)
at com.liferay.portal.spring.extender.internal.LiferayServiceExtender.addingBundle(LiferayServiceExtender.java:61)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:475)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450)
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:230)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:137)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:129)
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:191)
at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
at org.eclipse.osgi.container.Module.doStart(Module.java:578)
at org.eclipse.osgi.container.Module.start(Module.java:449)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:447)
at org.eclipse.equinox.console.commands.EquinoxCommandProvider.start(EquinoxCommandProvider.java:243)
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.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:139)
at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91)
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599)
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415)
at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416)
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229)
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: PhishRodLab.db.model.impl.Customer_PreferencesImpl
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:200)
at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:122)
... 49 more
I've encountered that error when migrating from previous versions when the DTD of the service.xml file is not the right one. You must make sure you are using the latest version available for the version you are using (7.3 in this case).
For example, the header of the service.xml file should start like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 7.3.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_7_3_0.dtd">
<service-builder...>
The best option is to generate a test servicebuilder project using the tutorial, and then compare the generated code with yours, making note of the differences.
More info: https://help.liferay.com/hc/es/articles/360029028211-Introduction-to-Service-Builder

Spring boot : Unable to load cache item: javax/servlet/Filter

I have a spring boot project and getting some error related to javax servlet filter.
Is it some kind of version compatibility or I am missing something in pom file.
Following is the log from the console and the pom file.
I have been searching all over, couldn't find anything.
Exception in thread "main" java.lang.IllegalStateException: Cannot load configuration class: org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerSecurityConfiguration
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:403)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:249)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:281)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:125)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.abc.application.Application.main(Application.java:15)
Caused by: java.lang.IllegalStateException: Unable to load cache item
at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:79)
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.createClass(ConfigurationClassEnhancer.java:138)
at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:110)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:393)
... 11 more
Caused by: java.lang.NoClassDefFoundError: javax/servlet/Filter
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getDeclaredConstructors(Class.java:2020)
at org.springframework.cglib.proxy.Enhancer.generateClass(Enhancer.java:566)
at org.springframework.cglib.transform.TransformingClassGenerator.generateClass(TransformingClassGenerator.java:33)
at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanFactoryAwareGeneratorStrategy.generate(ConfigurationClassEnhancer.java:252)
at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:329)
at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:492)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
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)
... 19 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 33 more
For me problem were in pom file (in spring boot 2 project),
when I used a parent spring boot in version 2.1.9 which under the hood uses spring-core in version 5.1.10.RELEASE
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
I had dependency:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
removing it resolved problem
I was getting the similar error in my Gradle project(might be a problem with Maven too) when I was trying to upgrade my Spring Boot version to latest one.
A quick gradle clean solved that problem for me.
Usually, this Filter class can be found in embedded tomcat jar.
So please make sure that your application (jar) contains this file:
Open up the Jar file of the compiled spring boot application and check whether the jar named like tomcat-embed-core resides in the BOOT-INF\lib folder.
This answer is valid as long as you're running tomcat of course + use JAR artifact for spring boot application (for WAR the folder is different, probably WEB-INF/lib although I've never worked with WARs of Spring Boot application so I might be wrong here)

ClassNotFoundException: com.allen_sauer.gwt.log.client.WrappedClientThrowable

I'm getting class not found exception for com.allen_sauer.gwt.log.client.WrappedClientThrowable while starting my application in tomcat 8.0.36.
Libraries used
- gwt-user-2.8
- gwt-servlet-2.7.0
- spring4gwt-0.0.1
- gwt-log-3.1.2
This class is present in gwt-log but in package com.allen_sauer.gwt.log.shared. My application code is referring to the correct package but still I'm getting this exception:
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:940)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1816)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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:748)
Caused by: java.lang.NoClassDefFoundError: com/allen_sauer/gwt/log/client/WrappedClientThrowable
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.apache.catalina.util.Introspection.getDeclaredMethods(Introspection.java:127)
at org.apache.catalina.startup.WebAnnotationSet.loadMethodsAnnotation(WebAnnotationSet.java:273)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:133)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:335)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:782)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:306)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5202)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 10 more
Caused by: java.lang.ClassNotFoundException: com.allen_sauer.gwt.log.client.WrappedClientThrowable
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
... 24 more
Not sure which library is referring to the old package. Any help is appreciated. Thanks in advance.
Seems like you have a gwt-user and gwt-servlet in different versions.
It would be great if you could post your full "mvn dependency:tree" (or gradle equivalent)
EDIT:
Feels like you are using a somewhat outdated logging library.
https://github.com/fredsa/gwt-log/wiki/GettingStarted
Try adding this guy to your dependencies: compile 'com.allen-sauer.gwt.log:gwt-log:3.3.2
Seems this issue was introduced due to some duplicate compiled classes. I got the application from a different team who have recently converted it to gradle build. When I checked the project structure and gradle scripts, I found many inconsistencies. Basically project was not converted correctly.
After I converted it correctly, this error was gone.
Thanks for the insights, really appreciate it

Spring resource not found - 3.2

We have a project which is using Spring with 3.0 xsd running on tomcat 7. I tried to change the xsd to Spring 3.2 as we have been using spring jars for spring 3.2.4 and 'exclude-mapping' cannot be used with spring 3.0 xsd.
After this change, application stops working, though it does not throw any errors while starting/stopping the server or adding and removing the application.
After the change any request to the application fails with error 404.
Here are the Jars we are using:
beandoc-0.7.0.jar
commons-fileupload-1.2.2.jar
commons-io-1.3.2.jar
commons-logging-1.2-javadoc.jar
commons-logging-1.2.jar
jstl.jar
log4j-1.2.14.jar
ojdbc6.jar
slf4j-api-1.5.6.jar
slf4j-log4j12-1.5.6.jar
spring-beandoc-0.7.1.jar
spring-beans-3.2.4.RELEASE.jar
spring-context-3.2.4.RELEASE.jar
spring-context-support-3.2.4.RELEASE.jar
spring-core-3.2.4.RELEASE.jar
spring-dao-2.0.8.jar
spring-expression-3.2.4.RELEASE.jar
spring-jdbc-3.2.4.RELEASE.jar
spring-web-3.2.4.RELEASE.jar
spring-webmvc-3.2.4.RELEASE.jar
spring-webmvc-portlet-3.2.4.RELEASE.jar
standard.jar
When we try to clean the server, it results in the below exception:
SEVERE: Exception starting Context with name [/COETOOLSACCL]
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/COETOOLSACCL]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:4119)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:425)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1341)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1542)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1552)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1552)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1520)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/support/ServletRequestHandledEvent
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredFields(Unknown Source)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:270)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:139)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:416)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:890)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:387)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5503)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 8 more
Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.support.ServletRequestHandledEvent
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1891)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1734)
... 22 more
This exception prevails regardless of the xsd versions and with 3.0 application runs normal despite we get this error while cleaning the server.
Please help.

Optional bundle resolution

I'm new in OSGi. I wrote JIRA plugin which is Apache Felix Bundle. My bundle uses Sprring Framework RestTemplate and Jackson XML for a simple REST API call.
So I use other bundle (available on OSGi containter) : Apache ServiceMix :: Bundles :: spring-web which has <Import-Package> set to com.fasterxml.jackson.*; version="[2,3)";resolution:="optional"
I installed jackson-databind, jackson-core and jackson-annotations (all in version 2.6.5) on OSGi container to provide missing, optional dependencies.
Full source code available on my github.
When I install my plugin everything is ok, but during runtime I recieve error :
2016-03-09 10:47:55,431 http-nio-2990-exec-11 ERROR achomont 647x10800x1 1wof9hv 0:0:0:0:0:0:0:1 /secure/CreateWorklog.jspa [c.a.event.internal.AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [WorklogCreatedEvent{worklog=com.atlassian.jira.issue.worklog.WorklogImpl2#555b9717}] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.company.soft.mycompany.work.log.plugin.listeners.WorkLogIssueListener.onWorklogEvent(com.atlassian.jira.event.worklog.WorklogEvent), listener=com.company.soft.mycompany.work.log.plugin.listeners.WorkLogIssueListener#7491b5aa}]
java.lang.RuntimeException: com/fasterxml/jackson/core/JsonProcessingException
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:107)
at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:160)
at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:79)
at java.util.Optional.ifPresent(Optional.java:159)
at com.atlassian.jira.issue.worklog.DefaultTimeTrackingIssueUpdater.dispatchEvent(DefaultTimeTrackingIssueUpdater.java:242)
at com.atlassian.jira.issue.worklog.DefaultTimeTrackingIssueUpdater.doUpdate(DefaultTimeTrackingIssueUpdater.java:221)
at com.atlassian.jira.issue.worklog.DefaultTimeTrackingIssueUpdater.updateIssue(DefaultTimeTrackingIssueUpdater.java:202)
at com.atlassian.jira.issue.worklog.DefaultTimeTrackingIssueUpdater.updateIssueOnWorklogCreate(DefaultTimeTrackingIssueUpdater.java:89)
at com.atlassian.jira.issue.worklog.DefaultWorklogManager.create(DefaultWorklogManager.java:68)
at com.atlassian.jira.bc.issue.worklog.DefaultWorklogService.create(DefaultWorklogService.java:724)
at com.atlassian.jira.bc.issue.worklog.DefaultWorklogService.createAndAutoAdjustRemainingEstimate(DefaultWorklogService.java:381)
at com.atlassian.jira.web.action.issue.CreateWorklog.doExecute(CreateWorklog.java:100)
... 1 filtered
at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:63)
... 7 filtered
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
... 74 filtered
at com.atlassian.labs.httpservice.resource.ResourceFilter.doFilter(ResourceFilter.java:59)
... 38 filtered
at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:70)
... 37 filtered
at com.atlassian.fastdev.AutoReloadFilter.doFilter(AutoReloadFilter.java:63)
... 55 filtered
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException
at com.company.soft.mycompany.connector.impl.MycompanyConnectorImpl.sendWorklogData(MycompanyConnectorImpl.java:80)
at com.company.soft.mycompany.connector.impl.MycompanyConnectorImpl.sendWorklogData1(MycompanyConnectorImpl.java:96)
at com.company.soft.mycompany.connector.impl.MycompanyConnectorImpl.sendWorklogDataWithCheck(MycompanyConnectorImpl.java:100)
at com.company.soft.mycompany.connector.impl.MycompanyConnectorImpl.sendAddWorkLogData(MycompanyConnectorImpl.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
... 1 filtered
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy2639.sendAddWorkLogData(Unknown Source)
at com.company.soft.mycompany.work.log.plugin.listeners.WorkLogIssueListener.sendWorkLogData(WorkLogIssueListener.java:115)
at com.company.soft.mycompany.work.log.plugin.listeners.WorkLogIssueListener.onWorklogEvent(WorkLogIssueListener.java:63)
... 3 filtered
at java.lang.reflect.Method.invoke(Method.java:497)
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36)
... 235 more
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingException not found by org.apache.servicemix.bundles.spring-web [13]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 267 more
It looks like OSGi containter do not figure out that com.fasterxml.jackson.core is now available.
Should I somehow reload Apache ServiceMix :: Bundles :: spring-web?
Or mayby I need to do it in another way?
I hope someone could help me with this.
If your bundle has an optional import and you allow it to resolve without the import being wired to an exporter, then that situation will continue until you do a "refresh" operation. OSGi tries to leave bundle import/export wiring as static as possible, because it can be expensive to recalculate and it also forced bundles to restart.
So if you want OSGi to wire to the import that is now available, you need to refresh. This can be done in the Gogo shell by typing the refresh command.

Categories

Resources