1.on websphere server getting java.lang.ClassCastException: org.jboss.seam.web.ContextFilter incompatible with javax.servlet.Filter - was

1.on websphere server getting java.lang.ClassCastException: org.jboss.seam.web.ContextFilter incompatible with javax.servlet.Filter
2.it is working on jboss app server.
3.ContextFilter is a filter applied to /* in web.xml
hence when applications is accessed , error is shown.
3.class hierarchy of ContextFilter
ContextFilter extends AbstractFilter
AbstractFilter implements javax.servlet.Filter
4.but still while application is accessed from it is showing "not a filter"
5.ContextFilter is a class in jar : jboss-seam.jar
this jar file and class file in present in web-inf/lib
6.complete stack trace :
12/20/22 13:10:23:075 IST] 0000006b webapp ᅠ ᅠ ᅠ ᅠE com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor]: java.lang.ClassCastException: org.jboss.seam.web.ContextFilter incompatible with javax.servlet.Filter
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:572)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:514)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:319)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:392)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:931)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4047)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1016)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:213)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
ᅠ ᅠ ᅠ ᅠ at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
ᅠ ᅠ ᅠ ᅠ at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205)
ᅠ ᅠ ᅠ ᅠ at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)

Related

How is inter module dependencies achieved in wildfly swarm

How is inter module dependencies achieved in wildfly swarm?
For example, I have a module with these contents:
<module xmlns="urn:jboss:module:1.3" name="com.obbi.domain.security">
<resources>
<artifact name="com.obbi.domain.platform:domain-service-security-jboss:2.0.86"/>
<artifact name="com.obbi.domain.platform:domain-service-security-client:2.0.86"/>
</resources>
<dependencies>
<module name="org.jboss.as.web"/>
<module name="org.jboss.logging"/>
<module name="org.picketbox"/>
<module name="javax.api"/>
<module name="javax.security.auth.message.api"/>
<module name="javax.servlet.api"/>
</dependencies>
</module>
At runtime, when I try to access my application, it fails because it can't find the dependencies specified in the module.
2017-07-05 16:58:50,312 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /Test/rest/Ping: java.lang.NoClassDefFoundError: org/jose4j/json/internal/json_simple/parser/ParseException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.getConstructor(Class.java:1825)
at org.jboss.security.auth.message.config.JBossServerAuthConfig.createSAM(JBossServerAuthConfig.java:244)
at org.jboss.security.auth.message.config.JBossServerAuthConfig.getAuthContext(JBossServerAuthConfig.java:178)
at org.jboss.security.plugins.auth.JASPIServerAuthenticationManager.secureResponse(JASPIServerAuthenticationManager.java:158)
at org.wildfly.extension.undertow.security.jaspi.JASPICSecureResponseHandler.handleRequest(JASPICSecureResponseHandler.java:35)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:211)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:809)
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.ClassNotFoundException: org.jose4j.json.internal.json_simple.parser.ParseException from [Module "com.obbi.domain.security:main" from BootModuleLoader#752325ad for finders [BootstrapClasspathModuleFinder, BootstrapModuleFinder(org.wildfly.swarm.bootstrap:main), ClasspathModuleFinder, ContainerModuleFinder(swarm.container:main), ApplicationModuleFinder(swarm.application:main), org.wildfly.swarm.bootstrap.modules.DynamicModuleFinder#279fedbd]]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
... 28 more
I have tried copying the dependencies modules from the normal wildfly modules directory into the wildfly swarm resources, but the issue persists.
So how are these dependencies within the module configured?
Regards
I had to include
<artifact name="org.bitbucket.b_c:jose4j:0.5.0"/>
in my module.xml, as well as
<dependency>
<groupId>org.bitbucket.b_c</groupId>
<artifactId>jose4j</artifactId>
<version>0.5.0</version>
</dependency>
in my POM.
The issue had nothing to do with inter module dependencies

Deploying spring boot web sample, from war, to EAR, to websphere 8 using eclipse

I have created a web project using maven and imported it into eclipse. Then, I executed the command on cmd >> mvn spring-boot:run, the server (embedded tomcat) is starting fine and able to show my pages on browser. However, I have no idea why it failed after deploying it on websphere 8. Something must have went wrong in between the deployment or due to missing config, I guess.. (I do not know! >.<)
I have tried many solutions online, reading documentation, rebuilding samples over samples but nothing seems to work. I can't upload anything to show here thanks to my company's security policy (cant even access google drive due to network security). But follow the steps should be close enough to reproduce my case (I did try this MANY TIMES but it failed and I do not know why! sorry I am frustrated)
Here is what I am using:
Eclipse Kepler
Websphere Application Server v8.0
Java 6
maven
Spring-boot 1.4.1.RELEASE
Just to cut the long story short:
download the sample web project
unzip and import it to eclipse as existing maven project
open cmd, cd to the project directory (where you can see the pom.xml)
issue command: "mvn package", upon successful packaging, issue command: "mvn spring-boot:run" and open [localhost:8080] on your browser. You should be able to see a dummy webpage.
I can get to this point for most samples found online but here comes the trouble
create an EAR Application Project
Open the server tab in eclipse and add the EAR project to WebSphere Application Server v8. Here have an error: [Cannot add an EAR project to the server unless it contains a Web, EJB, or Connector module.] first issue
Then I found this link [http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#howto-servlet-2-5], which I guess I need a web.xml for the project. I created a new file web.xml under /webapp/WEB-INF and copied and pasted the whole codes from the #howto-servlet-2-5 page.
Is this correct??
Now the EAR can be added to Websphere Application Server v8.0, go to the (WAS) admin console, select a virtual host for this project, saved and I restart the server.
Open [localhost:8080] on web browser. You will see the page is now broken with this errorlog. second issue
Recap:
Must I need a web.xml to order to deploy EAR to WAS8? If yes, what should I write in there? Please ref to the documentation/#howto-servlet-2-5 page and please tell me what I need to re-configure.
Given the errorlog below, can someone explain why it is happening and what can I do to solve this?
I hope to see answer that gives a step by step actions from maven spring-boot web project (given a war file), to EAR, and deploy to WAS 8.
Your constructive and practical answer is appreciated.
Ps. Yes, I have to use EAR and WAS8 and Java6 due to company legacy. Please do not suggest anything that divert from the technology that is being mentioned.
errorlog
[10/14/16 12:03:13:246 SGT] 00000015 SystemOut O 2016-10-14 12:03:13.246 INFO 1948 --- [ Default : 2] com.ibm.ws.webcontainer.webapp : SRVE0292I: Servlet Message - [testUploadEAR#testUpload.war]:.Initializing Spring FrameworkServlet 'appServlet'
[10/14/16 12:03:13:247 SGT] 00000015 SystemOut O 12:03:13.246 [Default : 2] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization started
[10/14/16 12:03:13:257 SGT] 00000015 SystemOut O 12:03:13.256 [Default : 2] ERROR org.springframework.web.servlet.DispatcherServlet - Context initialization failed
java.lang.IllegalStateException: No WebApplicationContext found: initializer not registered?
at org.springframework.web.servlet.FrameworkServlet.findWebApplicationContext(FrameworkServlet.java:594)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:549)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:161)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:342)
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:618)
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinally(WebApp.java:587)
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:746)
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:1165)
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:771)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1362)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2163)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:389)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:332)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:119)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:607)
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:621)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:565)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1252)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:69)
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:272)
at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1152)
at java.security.AccessController.doPrivileged(AccessController.java:298)
at com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30)
at sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41)
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1146)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:999)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:847)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:783)
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:1818)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1702)
[10/14/16 12:03:13:257 SGT] 00000015 SystemOut O 2016-10-14 12:03:13.257 ERROR 1948 --- [ Default : 2] c.i.w.w.servlet.ServletWrapper : Uncaught.init.exception.thrown.by.servlet
[10/14/16 12:03:13:265 SGT] 00000015 SystemOut O 2016-10-14 12:03:13.264 ERROR 1948 --- [ Default : 2] com.ibm.ws.webcontainer.webapp : SRVE0266E: Error occured while initializing servlets: {0}
javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:404) ~[com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168) ~[com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.loadOnStartupCheck(ServletWrapper.java:1366) ~[com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.webapp.WebApp.doLoadOnStartupActions(WebApp.java:618) ~[com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinally(WebApp.java:587) ~[com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:421) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:746) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:422) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:714) [com.ibm.ws.webcontainer.jar:na]
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1165) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1369) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:967) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:771) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1362) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2163) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:389) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:332) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:119) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:607) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5468) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5594) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:621) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:565) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1252) [com.ibm.ws.runtime.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) ~[na:1.6.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) ~[na:1.6.0]
at java.lang.reflect.Method.invoke(Method.java:611) ~[na:1.6.0]
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:69) [na:1.6.0]
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) ~[na:1.6.0]
at java.lang.reflect.Method.invoke(Method.java:611) ~[na:1.6.0]
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:272) [na:1.6.0]
at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1152) [na:1.6.0]
at java.security.AccessController.doPrivileged(AccessController.java:298) [na:na]
at com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30) [na:2.6 (04-09-2014)]
at sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41) [na:1.6.0]
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1146) [na:1.6.0]
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:999) [na:1.6.0]
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:847) [na:1.6.0]
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:783) [na:1.6.0]
at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335) [com.ibm.ws.admin.core.jar:na]
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) [bootstrap.jar:WAS80.SERV1 [cf091421.01]]
at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228) [com.ibm.ws.admin.core.jar:na]
at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181) [com.ibm.ws.admin.core.jar:na]
at com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:247) [com.ibm.ws.admin.core.jar:na]
at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:360) [com.ibm.ws.admin.core.jar:na]
at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:602) [com.ibm.ws.admin.core.jar:na]
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175) [com.ibm.ws.runtime.jar:na]
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) [com.ibm.ws.runtime.jar:na]
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) [com.ibm.ws.runtime.jar:na]
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) [com.ibm.ws.runtime.jar:na]
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) [com.ibm.ws.runtime.jar:na]
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) [com.ibm.ws.runtime.jar:na]
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) [com.ibm.ws.runtime.jar:na]
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1702) [com.ibm.ws.runtime.jar:na]
Caused by: java.lang.IllegalStateException: No WebApplicationContext found: initializer not registered?
at org.springframework.web.servlet.FrameworkServlet.findWebApplicationContext(FrameworkServlet.java:594) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:549) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at javax.servlet.GenericServlet.init(GenericServlet.java:161) ~[javax.j2ee.servlet.jar:na]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:342) ~[com.ibm.ws.webcontainer.jar:na]
... 62 common frames omitted
Alright here is the complete setup for a spring boot application to be ran on WebSphere with servlets 2.5. (At least what I'm running)
pom.xml
set your packaging to war
<packaging>war</packaging>
add these 2 dependencies
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-legacy</artifactId>
<version>1.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
and have the spring boot plugin
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Spring Boot Application Class
Make sure that your main class extends SpringBootServletInitializer and override the method shown below.
#SpringBootApplication
public class DemoApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(CustomerSignupServerApplication.class);
}
}
web.xml
Make sure your web.xml is setup like below and the context-param section is pointing to the class annotated with #SpringBootApplication
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>com.demo.DemoApplication</param-value>
</context-param>
<listener>
<listener-class>org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>metricFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>metricFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextAttribute</param-name>
<param-value>org.springframework.web.context.WebApplicationContext.ROOT</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
finally
When you package the application through maven by running mvn clean package it will build 2 WAR files: application.war and application.war.original the latter is what your going to want to take and package into an EAR.
Unlucky there is no clear documentation about deployment spring boot app on web-sphere. I had same problem and after spending lots of time finally I deployed war with flowing steps without eclipse. I hope it helps others.
update pom file
Check web-sphere java version as 8
change class loader orders
dependencies
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
build:
<build>
<finalName>war_name</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Jersey WADL in JBoss AS 5.1

I have trouble in generating wadl from my Jersey application. My setup is:
JBoss AS 5.1,
Maven dependency for the RESTful
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
The url of my app: http://localhost:8080/myrestApp/rest/application.wadl
cause this exception:
GRAVE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class com.sun.jersey.server.wadl.ApplicationDescription, and Java type class com.sun.jersey.server.wadl.ApplicationDescription, and MIME media type application/xml was not found
at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:285)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1437)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.sun.jersey.api.MessageException: A message body writer for Java class com.sun.jersey.server.wadl.ApplicationDescription, and Java type class com.sun.jersey.server.wadl.ApplicationDescription, and MIME media type application/xml was not found
... 28 more
Any help?

Jboss EAP 6.3 class loading issue

While migrating the application from JBOSS EAP 5.2.1 to JBOSS EAP 6.3.0, I am receiving the following linkage error.
ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/txo/amaster]] (ServerService Thread Pool -- 60) JBWEB000287: Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener: java.lang.LinkageError: loader constraint violation: when resolving method "org.dom4j.io.SAXReader.setEntityResolver(Lorg/xml/sax/EntityResolver;)V" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/jboss/seam/util/XML, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for resolved class, org/dom4j/io/SAXReader, have different Class objects for the type setEntityResolver used in the signature
at org.jboss.seam.util.XML.getRootElement(XML.java:22) [jboss-seam-2.1.1.GA.jar:2.1.1.GA]
at org.jboss.seam.init.Initialization.initComponentsFromXmlDocument(Initialization.java:227) [jboss-seam-2.1.1.GA.jar:2.1.1.GA]
at org.jboss.seam.init.Initialization.create(Initialization.java:134) [jboss-seam-2.1.1.GA.jar:2.1.1.GA]
at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:35) [jboss-seam-2.1.1.GA.jar:2.1.1.GA]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3339) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3777) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:161) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:59) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:94) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_11]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_11]
at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_11]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_11]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_11]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_11]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Can you please guide me to fix those errors?
I have fixed the issue. In the dom4j module.xml I have changed the order of the dependencies also provided export="true"
<module xmlns="urn:jboss:module:1.1" name="org.dom4j">
<properties>
<property name="jboss.api" value="unsupported"/>
</properties>
<resources>
<resource-root path="dom4j-1.6.1.redhat-6.jar"/>
</resources>
<dependencies>
<module name="com.sun.xml.bind"/>
<module name="javax.xml.bind.api"/>
<module name="org.jaxen"/>
<module name="javax.api" export="true"/> <!-- This one always goes last. -->
</dependencies>
</module>

How to run JUnit Eclipse Plugin tests with JMock?

I have Eclipse plug-in and junit tests for it, which are using jMock library.
When I run my test 'as junit', all tests are running correctly. But when I run them 'as JUnit plugin test' I'm getting the following error:
java.lang.TypeNotPresentException: Type [unknown] not present
at sun.reflect.annotation.TypeNotPresentExceptionProxy.generateException(TypeNotPresentExceptionProxy.java:27)
at sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:56)
at $Proxy4.value(Unknown Source)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:29)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:40)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:30)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
at org.eclipse.pde.internal.junit.runtime.UITestApplication$1.run(UITestApplication.java:114)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3468)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3115)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.pde.internal.junit.runtime.UITestApplication.start(UITestApplication.java:46)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Caused by: java.lang.NoClassDefFoundError: org/junit/internal/runners/JUnit4ClassRunner
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:183)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:576)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:546)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:477)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:465)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:445)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:376)
at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:33)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:449)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:95)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:107)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:31)
at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:370)
at sun.reflect.annotation.AnnotationParser.parseClassValue(AnnotationParser.java:351)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:280)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:222)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3070)
at java.lang.Class.getAnnotation(Class.java:3029)
at org.junit.internal.builders.IgnoredBuilder.runnerForClass(IgnoredBuilder.java:13)
... 39 more
Caused by: java.lang.ClassNotFoundException: org.junit.internal.runners.JUnit4ClassRunner
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:489)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 70 more
How to fix this?
Appreciate any help.
I've fixed it. JMock plugin, which I initially created, was the following:
plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin
id="jmock-2.5.1"
name="JMockClasses Plug-in"
version="1.0.0"
provider-name="">
<runtime>
<library name="bsh-core-2.0b4.jar">
<export name="*"/>
</library>
<library name="cglib-2.1_3-src.jar">
<export name="*"/>
</library>
...
<library name="jmock-2.5.1.jar">
<export name="*"/>
</library>
<library name="jmock-junit4-2.5.1.jar">
<export name="*"/>
</library>
...
</runtime>
<requires>
<import plugin="org.eclipse.core.runtime.compatibility"/>
</requires>
</plugin>
i. e. it was just a library on my classpath. I've changed it to the following:
META-INF/MANIFEST.MF:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: JMockPlugin
Bundle-SymbolicName: org.jmock_2.5.1
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: jmock.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.junit4
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: bsh-core-2.0b4.jar,
cglib-2.1_3-src.jar,
cglib-nodep-2.1_3.jar,
hamcrest-core-1.1.jar,
hamcrest-library-1.1.jar,
jmock-2.5.1.jar,
jmock-junit3-2.5.1.jar,
jmock-junit4-2.5.1.jar,
jmock-legacy-2.5.1.jar,
jmock-script-2.5.1.jar,
objenesis-1.0.jar
Now Eclipse OSGI classloader is able to load my JMockPlugin and I do not have any problems.