JBoss EAP 6.1 Oracle ADF 11 - jsf

I'm trying to migrate JBoss EAP 5.1 application to JBoss EAP 6.1.
My app uses JSF 1.2, MyFaces Trinidad and Oracle ADF 11 as jsf component libraries.
The app was working fine on JBoss EAP 5.1.
The deployment on JBoss EAP 6.1 is fine, but it seems that adf components seems are causing problems.
The application generates exception when trying to open a page that uses ADF components.
Here is the full stack trace:
Failed to define class oracle.jbo.domain.Number in Module "deployment.MyAppServer.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link oracle/jbo/domain/Number (Module "deployment.MyAppServer.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:427) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:260) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:75) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.Module.loadModuleClass(Module.java:526) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:188) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) [jboss-modules.jar:1.2.0.Final-redhat-1]
at oracle.adfinternal.view.rich.marshal.DefaultMarshalingService._registerDefaults(DefaultMarshalingService.java:244) [adf-richclient-impl-11.jar:]
at oracle.adfinternal.view.rich.marshal.DefaultMarshalingService.<init>(DefaultMarshalingService.java:73) [adf-richclient-impl-11.jar:]
at oracle.adfinternal.view.rich.marshal.DefaultMarshalingService.<clinit>(DefaultMarshalingService.java:334) [adf-richclient-impl-11.jar:]
at oracle.adfinternal.view.faces.event.rich.ClientEventUtils._getEventParameters(ClientEventUtils.java:248) [adf-richclient-impl-11.jar:]
at oracle.adfinternal.view.faces.event.rich.ClientEventUtils._parseEvents(ClientEventUtils.java:177) [adf-richclient-impl-11.jar:]
at oracle.adfinternal.view.faces.event.rich.ClientEventUtils._getAndLoadEvents(ClientEventUtils.java:146) [adf-richclient-impl-11.jar:]
at oracle.adfinternal.view.faces.event.rich.ClientEventUtils.decodeAndStoreClientEvents(ClientEventUtils.java:125) [adf-richclient-impl-11.jar:]
at oracle.adfinternal.view.faces.context.RichPhaseListener.beforePhase(RichPhaseListener.java:249) [adf-richclient-impl-11.jar:]
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:258) [adf-richclient-impl-11.jar:]
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177) [adf-richclient-impl-11.jar:]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) [jsf-api-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97) [adf-richclient-impl-11.jar:]
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420) [trinidad-impl-1.2.12.1.jar:1.2.12.1-SNAPSHOT]
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60) [adf-richclient-impl-11.jar:]
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420) [trinidad-impl-1.2.12.1.jar:1.2.12.1-SNAPSHOT]
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247) [trinidad-impl-1.2.12.1.jar:1.2.12.1-SNAPSHOT]
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157) [trinidad-impl-1.2.12.1.jar:1.2.12.1-SNAPSHOT]
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92) [trinidad-api-1.2.12.1.jar:1.2.12.1-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at com.edf.marketlab.web.filter.SessionActivityFilter.doFilter(SessionActivityFilter.java:67) [classes:]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam-2.2.2.EAP5.jar:2.2.2.EAP5]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:389) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: java.lang.NoClassDefFoundError: oracle/sql/ORAData
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_25]
at java.lang.ClassLoader.defineClass(ClassLoader.java:792) [rt.jar:1.7.0_25]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:344) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:422) [jboss-modules.jar:1.2.0.Final-redhat-1]
... 60 more
Caused by: java.lang.ClassNotFoundException: oracle.sql.ORAData from [Module "deployment.MyAppServer.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374) [jboss-modules.jar:1.2.0.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) [jboss-modules.jar:1.2.0.Final-redhat-1]
I'm using the default JSF implementation (Mojorra) provided by JBoss.
Here is my jboss-deployment-structure.xml:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="javax.faces.api" slot="main" />
<module name="com.sun.jsf-impl" slot="main" />
</exclusions>
<dependencies>
<module name="javax.faces.api" slot="1.2" />
<module name="com.sun.jsf-impl" slot="1.2" />
</dependencies>
</deployment>
</jboss-deployment-structure>
Here is my pom.xml with the ADF dependencies :
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>adfm</artifactId>
<version>11.0</version>
<scope>system</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/adfm.jar
</systemPath>
</dependency>
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>adf-richclient-api</artifactId>
<version>11.0</version>
<scope>system</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/adf-richclient-api-11.jar
</systemPath>
</dependency>
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>adf-richclient-impl</artifactId>
<version>11.0</version>
<scope>system</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/adf-richclient-impl-11.jar
</systemPath>
</dependency>
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>adflogginghandler</artifactId>
<version>11.0</version>
<scope>system</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/adflogginghandler.jar
</systemPath>
</dependency>
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>adf-share-base</artifactId>
<version>11.0</version>
<scope>system</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/adf-share-base.jar
</systemPath>
</dependency>
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>adf-share-ca</artifactId>
<version>11.0</version>
<scope>system</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/adf-share-ca.jar
</systemPath>
</dependency>
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>adf-share-support</artifactId>
<version>11.0</version>
<scope>system</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/adf-share-support.jar
</systemPath>
</dependency>
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>dms</artifactId>
<version>11.0</version>
<scope>system</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/dms.jar
</systemPath>
</dependency>
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>mdsrt</artifactId>
<version>11.0</version>
<scope>system</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/mdsrt.jar
</systemPath>
</dependency>
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>xmlparserv2-distilled-9i</artifactId>
<version>11.0</version>
<scope>system</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/xmlparserv2-distilled-9i.jar
</systemPath>
</dependency>
<dependency>
<groupId>org.apache.myfaces.trinidad</groupId>
<artifactId>trinidad-api</artifactId>
<version>1.2.12.1</version>
<scope>system</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/trinidad-api-1.2.12.1.jar
</systemPath>
</dependency>
<dependency>
<groupId>org.apache.myfaces.trinidad</groupId>
<artifactId>trinidad-impl</artifactId>
<version>1.2.12.1</version>
<scope>system</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/trinidad-impl-1.2.12.1.jar
</systemPath>
</dependency>

Related

JakartaSever Faces application setup fails with java.lang.ClassNotFoundException: com.sun.faces.util.Util

I'm in the process of setting up a brand new JavaServer Faces project that uses Jakarta. I'm following this as a guide, and while I understand the problem with the stacktrace, I can't understand why (the new) Jakarta Faces implementation is asking me for an old dependency.
This is what I have in the pom.xml file (simplified):
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...>
<packaging>war</packaging>
<properties>
<jakarta.platform.version>9.1.0</jakarta.platform.version>
<java.version>11</java.version>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-web-api</artifactId>
<version>${jakarta.platform.version}</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>11.0.0</version>
<classifier>jakarta</classifier>
</dependency>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-web-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<classifier>jakarta</classifier>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>11.0.7</version>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-web-api</artifactId>
<version>${jakarta.platform.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
And the web.xml file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>faces-servlet</servlet-name>
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>faces-servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
TIP: I'm running the application with ./mvnw clean jetty:run.
This is the entire stacktrace:
java.lang.NoClassDefFoundError: com/sun/faces/util/Util
at jakarta.faces.CurrentThreadToServletContext.getFactoryFinder (CurrentThreadToServletContext.java:52)
at jakarta.faces.FactoryFinder.getFactory (FactoryFinder.java:260)
at jakarta.faces.webapp.FacesServlet.acquireFacesContextFactory (FacesServlet.java:483)
at jakarta.faces.webapp.FacesServlet.init (FacesServlet.java:328)
at org.eclipse.jetty.servlet.ServletHolder$Wrapper.init (ServletHolder.java:1305)
at org.eclipse.jetty.servlet.ServletHolder.initServlet (ServletHolder.java:633)
at org.eclipse.jetty.servlet.ServletHolder.initialize (ServletHolder.java:415)
at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$2 (ServletHandler.java:690)
at java.util.stream.SortedOps$SizedRefSortingSink.end (SortedOps.java:357)
at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining (StreamSpliterators.java:312)
at java.util.stream.Streams$ConcatSpliterator.forEachRemaining (Streams.java:735)
at java.util.stream.ReferencePipeline$Head.forEach (ReferencePipeline.java:658)
at org.eclipse.jetty.servlet.ServletHandler.initialize (ServletHandler.java:714)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext (ServletContextHandler.java:392)
at org.eclipse.jetty.webapp.WebAppContext.startContext (WebAppContext.java:1305)
at org.eclipse.jetty.server.handler.ContextHandler.doStart (ContextHandler.java:896)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart (ServletContextHandler.java:306)
at org.eclipse.jetty.webapp.WebAppContext.doStart (WebAppContext.java:533)
at org.eclipse.jetty.maven.plugin.MavenWebAppContext.doStart (MavenWebAppContext.java:294)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:171)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:121)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:89)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:171)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:121)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:89)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:171)
at org.eclipse.jetty.server.Server.start (Server.java:469)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:89)
at org.eclipse.jetty.server.Server.doStart (Server.java:414)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.maven.plugin.JettyEmbedder.doStart (JettyEmbedder.java:223)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.maven.plugin.JettyRunMojo.startJettyEmbedded (JettyRunMojo.java:97)
at org.eclipse.jetty.maven.plugin.AbstractWebAppMojo.startJetty (AbstractWebAppMojo.java:441)
at org.eclipse.jetty.maven.plugin.AbstractWebAppMojo.execute (AbstractWebAppMojo.java:419)
at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute (JettyRunMojo.java:85)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61)
Caused by: java.lang.ClassNotFoundException: com.sun.faces.util.Util
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass (SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass (ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass (ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass (ClassRealm.java:239)
at jakarta.faces.CurrentThreadToServletContext.getFactoryFinder (CurrentThreadToServletContext.java:52)
at jakarta.faces.FactoryFinder.getFactory (FactoryFinder.java:260)
at jakarta.faces.webapp.FacesServlet.acquireFacesContextFactory (FacesServlet.java:483)
at jakarta.faces.webapp.FacesServlet.init (FacesServlet.java:328)
at org.eclipse.jetty.servlet.ServletHolder$Wrapper.init (ServletHolder.java:1305)
at org.eclipse.jetty.servlet.ServletHolder.initServlet (ServletHolder.java:633)
at org.eclipse.jetty.servlet.ServletHolder.initialize (ServletHolder.java:415)
at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$2 (ServletHandler.java:690)
at java.util.stream.SortedOps$SizedRefSortingSink.end (SortedOps.java:357)
at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining (StreamSpliterators.java:312)
at java.util.stream.Streams$ConcatSpliterator.forEachRemaining (Streams.java:735)
at java.util.stream.ReferencePipeline$Head.forEach (ReferencePipeline.java:658)
at org.eclipse.jetty.servlet.ServletHandler.initialize (ServletHandler.java:714)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext (ServletContextHandler.java:392)
at org.eclipse.jetty.webapp.WebAppContext.startContext (WebAppContext.java:1305)
at org.eclipse.jetty.server.handler.ContextHandler.doStart (ContextHandler.java:896)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart (ServletContextHandler.java:306)
at org.eclipse.jetty.webapp.WebAppContext.doStart (WebAppContext.java:533)
at org.eclipse.jetty.maven.plugin.MavenWebAppContext.doStart (MavenWebAppContext.java:294)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:171)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:121)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:89)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:171)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:121)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:89)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:171)
at org.eclipse.jetty.server.Server.start (Server.java:469)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:89)
at org.eclipse.jetty.server.Server.doStart (Server.java:414)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.maven.plugin.JettyEmbedder.doStart (JettyEmbedder.java:223)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:93)
at org.eclipse.jetty.maven.plugin.JettyRunMojo.startJettyEmbedded (JettyRunMojo.java:97)
at org.eclipse.jetty.maven.plugin.AbstractWebAppMojo.startJetty (AbstractWebAppMojo.java:441)
at org.eclipse.jetty.maven.plugin.AbstractWebAppMojo.execute (AbstractWebAppMojo.java:419)
at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute (JettyRunMojo.java:85)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61)
[INFO] Started ServerConnector#72b2c5ed{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
[INFO] Started Server#57f8951a{STARTING}[11.0.7,sto=0] #2371ms
[INFO] Scan interval sec = 10
You still need to include some Jakara Faces implementation, and in this case, the easiest one would be the Mojarra because you are using the standard Jakarta Faces API that already requires some classes from the Mojarra implementation.
You can checkout all the required dependencies here: https://github.com/eclipse-ee4j/mojarra
If you want to use the Myfaces, you'll need to replace the standard Jakarta Faces API for the Jakata Faces API provided by them.

Payara MicroProfile 5.191 intermitted "converter not found" after clean, compile, package, run

I've a Java EE 8 web project (war) with a JSF page that uses a converter.
When I try to load that page (after mvn clean compile package and java -jar payara-micro-5.191.jar --deploy rbooking.war) "sometimes" the converter class was not found.
To solve the problem the only solution is to recompile the war.
Here some details:
the pom file:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sartorieinformatiche.it.rbooking</groupId>
<artifactId>rbooking</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<repositories>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.10</version>
</dependency>
<dependency>
<groupId>uaihebert.com</groupId>
<artifactId>uaiCriteria</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>3.3</version>
</dependency>
</dependencies>
<build>
<finalName>rbooking</finalName>
</build>
</project>
the converter class:
package sartorieinformatiche.it.rbooking.control;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import javax.inject.Inject;
import sartorieinformatiche.it.rbooking.entity.Language;
#FacesConverter(value = "languageConverter", managed = true)
public class LanguageConverter implements Converter<Language> {
#Inject
private LanguageService languageService;
#Override
public String getAsString(FacesContext context, UIComponent component, Language language) {
if (language == null) {
return "";
}
return language.getId().toString();
}
#Override
public Language getAsObject(FacesContext context, UIComponent component, String value) {
if (value == null || value.trim().isEmpty()) {
return null;
}
Long id = Long.parseLong(value);
return languageService.findById(id);
}
}
the JSF page fragment:
...<p:selectOneMenu id="language"
value="#{bookingBean.booking.language}"
converter="languageConverter">
<f:selectItems value="#{bookingBean.allLanguages}"
itemLabel="#{language.description}"
itemValue="#{language.id}" />
<p:column>
<h:outputText value="#{language.description}" />
</p:column>
</p:selectOneMenu>...
the error when the JSF page is loaded:
StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
javax.faces.FacesException: Expression Error: Named Object: languageConverter not found.
at com.sun.faces.util.Util.notNullNamedObject(Util.java:467)
at com.sun.faces.application.applicationimpl.InstanceFactory.createConverter(InstanceFactory.java:456)
at com.sun.faces.application.ApplicationImpl.createConverter(ApplicationImpl.java:502)
at javax.faces.application.ApplicationWrapper.createConverter(ApplicationWrapper.java:420)
at org.omnifaces.cdi.converter.ConverterManager.createConverter(ConverterManager.java:131)
at org.omnifaces.cdi.converter.ConverterManager$Proxy$_$$_WeldClientProxy.createConverter(Unknown Source)
at org.omnifaces.application.OmniApplication.createConverter(OmniApplication.java:83)
at com.sun.faces.facelets.tag.jsf.ValueHolderRule$LiteralConverterMetadata.applyMetadata(ValueHolderRule.java:45)
at com.sun.faces.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:40)
at javax.faces.view.facelets.MetaTagHandler.setAttributes(MetaTagHandler.java:100)
at javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:92)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.doNewComponentActions(ComponentTagHandlerDelegateImpl.java:453)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:155)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:111)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:55)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:179)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:111)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:55)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:179)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:111)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:179)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:111)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:179)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:111)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:55)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:179)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:111)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:179)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:111)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:55)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:52)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:46)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:120)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:358)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:199)
at javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:708)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:451)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1628)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:339)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:209)
at org.glassfish.tyrus.servlet.TyrusServletFilter.doFilter(TyrusServletFilter.java:305)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:251)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:209)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:755)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:575)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:159)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$0(WorkerThreadIOStrategy.java:90)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
at java.lang.Thread.run(Thread.java:748)
To solve the issue I have to recompile the project and the converter is correctly loaded...
Any idea to solve the issue ?
PS:
I'm using OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.16.04.1-b03) Linux Mint 18.3 Sylvia.
The issue has been solved on Payara Micro 5.192

Invoking RunCukeTest with #ExtendedCucumberOptions throwing Initialization Error

Environment - Cucumber V. 4.0.0 | Selenium V.3.8.1 | JUnit V.4.12 | cucumber-runner & cucumber-report-generator 1.3.3
First time i am trying to implement #ExtendedCucumberOptions so that i can run failed test case again. Getting initialization error -
More Info about Error -
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
cucumber/runtime/ExtendedRuntime.runStep(Ljava/lang/String;Lgherkin/formatter/model/Step;Lgherkin/formatter/Reporter;Lgherkin/I18n;)V #94: invokeinterface
Reason:
Type 'cucumber/runtime/StepDefinitionMatch' (current frame, stack[1]) is not assignable to 'gherkin/formatter/model/Match'
Current Frame:
bci: #94
flags: { }
locals: { 'cucumber/runtime/ExtendedRuntime', 'java/lang/String', 'gherkin/formatter/model/Step', 'gherkin/formatter/Reporter', 'gherkin/I18n', 'cucumber/runtime/StepDefinitionMatch' }
stack: { 'gherkin/formatter/Reporter', 'cucumber/runtime/StepDefinitionMatch' }
Bytecode:
0x0000000: 2ab6 0070 2b2c 1904 b900 6504 003a 05a7
0x0000010: 0047 3a06 2d19 06b6 0072 03b9 0073 0200
0x0000020: c000 52b9 0074 0200 bb00 5059 1260 09b8
0x0000030: 0059 1906 b200 5ab7 005b 3a07 2d19 07b9
0x0000040: 0075 0200 2a19 07b7 0076 2a19 06b6 0061
0x0000050: 2a04 b500 0cb1 1905 c600 0e2d 1905 b900
0x0000060: 7402 00a7 0022 2db2 0077 b900 7402 002d
0x0000070: b200 78b9 0075 0200 2ab2 0078 b700 762a
0x0000080: 04b5 000c b12a b400 14b6 004c 9900 082a
0x0000090: 04b5 000c 2ab4 000c 9900 162a b200 79b7
0x00000a0: 0076 2db2 0079 b900 7502 00a7 0114 1251
0x00000b0: 3a06 013a 072a b400 15b9 0056 0100 1905
0x00000c0: 1904 b600 6f2a b400 15b9 0058 0100 3708
0x00000d0: bb00 5059 1906 1608 b800 5919 07b2 005a
0x00000e0: b700 5b3a 0a2a 190a b700 762d 190a b900
0x00000f0: 7502 00a7 00cc 3a08 1908 3a07 1260 3a06
0x0000100: 2a19 08b6 0061 2ab4 0015 b900 5801 0037
0x0000110: 08bb 0050 5919 0616 08b8 0059 1907 b200
0x0000120: 5ab7 005b 3a0a 2a19 0ab7 0076 2d19 0ab9
0x0000130: 0075 0200 a700 8b3a 0819 083a 0719 08b8
0x0000140: 0045 9900 0a12 5f3a 06a7 0007 1260 3a06
0x0000150: 2a19 08b6 0061 2a04 b500 0c2a b400 15b9
0x0000160: 0058 0100 3708 bb00 5059 1906 1608 b800
0x0000170: 5919 07b2 005a b700 5b3a 0a2a 190a b700
0x0000180: 762d 190a b900 7502 00a7 0036 3a0b 2ab4
0x0000190: 0015 b900 5801 0037 0cbb 0050 5919 0616
0x00001a0: 0cb8 0059 1907 b200 5ab7 005b 3a0e 2a19
0x00001b0: 0eb7 0076 2d19 0eb9 0075 0200 190b bfb1
0x00001c0:
Exception Handler Table:
bci [0, 15] => handler: 18
bci [190, 197] => handler: 246
bci [190, 197] => handler: 311
bci [190, 197] => handler: 396
bci [246, 262] => handler: 396
bci [311, 347] => handler: 396
bci [396, 398] => handler: 396
Stackmap Table:
same_locals_1_stack_item_frame(#18,Object[#311])
append_frame(#86,Object[#303])
same_frame(#102)
same_frame(#133)
same_frame(#148)
same_frame(#174)
full_frame(#246,{Object[#194],Object[#277],Object[#302],Object[#275],Object[#312],Object[#303],Object[#277],Object[#278]},{Object[#313]})
same_locals_1_stack_item_extended(#311,Object[#278])
append_frame(#332,Object[#278])
same_frame(#336)
full_frame(#396,{Object[#194],Object[#277],Object[#302],Object[#275],Object[#312],Object[#303],Object[#277],Object[#278]},{Object[#278]})
chop_frame(#447,2)
at com.github.mkolisnyk.cucumber.runner.ExtendedCucumber.createRuntime(ExtendedCucumber.java:93)
at com.github.mkolisnyk.cucumber.runner.ExtendedCucumber.<init>(ExtendedCucumber.java:52)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:87)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:73)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:46)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:522)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
First let me share my understanding on implementation, we have to add below 2 dependencies -
<dependency>
<groupId>com.github.mkolisnyk</groupId>
<artifactId>cucumber-runner</artifactId>
<version>1.3.3</version>
</dependency>
<dependency>
<groupId>com.github.mkolisnyk</groupId>
<artifactId>cucumber-report-generator</artifactId>
<version>1.3.3</version>
<scope>test</scope>
</dependency>
I also added below 2 as i was under impression, these shall be added as well by doing some research on net.
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>4.1.3</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.28</version>
</dependency>
Below is RunCukeTest.java Class -
#RunWith(ExtendedCucumber.class)
#ExtendedCucumberOptions(
jsonReport = "target/cucumber-json/cucumber.json",
retryCount = 3,
detailedReport = true,
detailedAggregatedReport = true,
overviewReport = true,
coverageReport = true,
jsonUsageReport = "target/cucumber-reports/cucumber-usage.json",
usageReport = false,
toPDF = true,
// excludeCoverageTags = {"#sanity" },
includeCoverageTags = {"#regression" },
outputFolder = "target/cucumber-reports/extended-report")
#CucumberOptions(features = "classpath:features/functional/",
glue = {"com.jacksparrow.automation.steps_definitions.functional" },
plugin = { "pretty","json:target/cucumber-json/cucumber.json",
"junit:target/cucumber-reports/Cucumber.xml", "html:target/cucumber-reports",
"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"},
tags = { "#regression" },
junit ={ "--step-notifications"},
strict = false,
dryRun = false,
monochrome = true)
public class RunCukeTest {
}
POM.XML
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jacksparrow.automation</groupId>
<artifactId>TheDayAfterTomorrow</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scm>
<connection>scm:git:https://github.com/extent-framework/extentreports-cucumber4-adapter.git</connection>
<developerConnection>scm:git:https://github.com/extent-framework/extentreports-cucumber4-adapter.git</developerConnection>
<url>https://github.com/extent-framework/extentreports-cucumber4-adapter</url>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<cucumberversion>4.0.0</cucumberversion>
<selenium.version>3.8.1</selenium.version>
<junit.version>4.12</junit.version>
<assertj-core.version>3.12.0</assertj-core.version>
<cucumberdatatableversion>1.1.12</cucumberdatatableversion>
<webdrivermanager.version>3.0.0</webdrivermanager.version>
<extent.report.version>3.1.1</extent.report.version>
<extent-cucumber-adapter.version>1.0.5</extent-cucumber-adapter.version>
<maven-surefire.plugin.version>3.0.0-M3</maven-surefire.plugin.version>
<maven.compiler.plugin.version>3.8.0</maven.compiler.plugin.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.failsafe.plugin.version>2.22.1</maven.failsafe.plugin.version>
<maven.build.helper.plugin.version>3.0.0</maven.build.helper.plugin.version>
<joda-time>2.5</joda-time>
<mysql>5.1.6</mysql>
<jackson-core>2.6.3</jackson-core>
<common-db-utils>1.6</common-db-utils>
<commons-io>2.6</commons-io>
<commons-lang>3.4</commons-lang>
<lombok>1.16.4</lombok>
<slf4jVersion>1.7.7</slf4jVersion>
<apache.poi.version>3.16</apache.poi.version>
<generated.runner.directory>${project.build.directory}/parallel/runners</generated.runner.directory>
<generated.feature.directory>${project.build.directory}/parallel/features</generated.feature.directory>
</properties>
<dependencies>
<!-- ********************************()() IO.CUCUMBER & SELENIUM DEPENDENCIES ()()******************************** -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumberversion}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumberversion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>${cucumberversion}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm</artifactId>
<version>2.0.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>${cucumberversion}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>datatable</artifactId>
<version>${cucumberdatatableversion}</version>
</dependency>
<dependency>
<groupId>com.github.mkolisnyk</groupId>
<artifactId>cucumber-runner</artifactId>
<version>1.3.3</version>
</dependency>
<dependency>
<groupId>com.github.mkolisnyk</groupId>
<artifactId>cucumber-report-generator</artifactId>
<version>1.3.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>4.1.3</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.28</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>${webdrivermanager.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<!-- ************************************()() EXTENT REPORT DEPENDENCY ()()******************************* -->
<!-- <dependency> -->
<!-- <groupId>com.aventstack</groupId> -->
<!-- <artifactId>extentreports</artifactId> -->
<!-- <version>4.0.9</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>com.vimalselvam</groupId> -->
<!-- <artifactId>cucumber-extentsreport</artifactId> -->
<!-- <version>${extent.report.version}</version> -->
<!-- </dependency> -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports-cucumber4-adapter</artifactId>
<version>${extent-cucumber-adapter.version}</version>
</dependency>
<!-- *******************************()() CUCUMBER MAVEN REPORTING DEPENDENCY ()()***************************** -->
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>1.0.0</version>
</dependency>
<!-- **************************************()() SLF4J DEPENDENCY ()()************************************ -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4jVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4jVersion}</version>
</dependency>
<!-- ****************************************()() JSON DEPENDENCY ()()************************************** -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-cucumber4-jvm</artifactId>
<version>2.9.0</version>
</dependency>
<!-- **********************************()() JAVA MAIL API DEPENDENCY ()()************************************ -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.5.5</version>
</dependency>
<!-- **************************************()() LOG4J DEPENDENCY ()()*************************************** -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- ************************************()() POI & XML DEPENDENCY ()()************************************** -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.11-beta3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io}</version>
</dependency>
<!-- ***************************************()() REPORTNG DEPENDENCY ()()********************************* -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>velocity</groupId>
<artifactId>velocity-dep</artifactId>
<version>1.4</version>
</dependency>
<!-- ***************************************()() APPIUM DEPENDENCY ()()********************************* -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>3.4.0</version>
</dependency>
<!-- *****************************************()() PDF DEPENDENCY ()()********************************** -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.4.0</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>1.3.1</version>
</dependency>
<!-- ************************************()() ATUTestRecorder DEPENDENCY ()()**************************** -->
<dependency>
<groupId>com.CA.ATU21</groupId>
<artifactId>ATUTestRecorder</artifactId>
<version>2.1</version>
<scope>system</scope>
<systemPath>${basedir}/lib/ATUTestRecorder-2.1.jar</systemPath>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId>
<version>2.0.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${apache.poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${apache.poi.version}</version>
</dependency>
</dependencies>
<!-- ************************************()() MAVEN COMPILER PLUGIN ()()*************************************** -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerVersion>1.8</compilerVersion>
</configuration>
</plugin>
<!-- ************************************()() MAVEN SUREFIRE PLUGIN ()()*************************************** -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire.plugin.version}</version>
<configuration>
<parallel>methods</parallel>
<threadCount>1</threadCount>
<reuserForks>false</reuserForks>
<testFailureIgnore>true</testFailureIgnore>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<includes>
<include>**/*RunCukeTest.java</include>
</includes>
</configuration>
</plugin>
<!-- ***********************************()() CLUECUMBER REPORT PLUGIN ()()*********************************** -->
<plugin>
<groupId>com.trivago.rta</groupId>
<artifactId>cluecumber-report-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<id>report</id>
<phase>post-integration-test</phase>
<goals>
<goal>reporting</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceJsonReportDirectory>${project.build.directory}\cucumber-json</sourceJsonReportDirectory>
<generatedHtmlReportDirectory>${project.build.directory}\cluecumber-report</generatedHtmlReportDirectory>
</configuration>
</plugin>
<!-- ******************************()() MAVEN CUCUMBER HTML REPORT PLUGIN ()()******************************** -->
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>4.2.3</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>TheDayAfterTomorrow</projectName>
<!-- output directory for the generated report -->
<outputDirectory>${project.build.directory}/cucumber-maven-report</outputDirectory>
<inputDirectory>${project.build.directory}/cucumber-json</inputDirectory>
<jsonFiles>
<!-- supports wildcard or name pattern -->
<param>**/*.json</param>
</jsonFiles>
<skippedFails>true</skippedFails>
<enableFlashCharts>true</enableFlashCharts>
<buildNumber>10.2.1</buildNumber>
<parallelTesting>false</parallelTesting>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.9</version>
<configuration>
<reportVersion>2.7.0</reportVersion>
<allureDownloadUrl>https://github.com/allure-framework/allure2/releases/download/2.7.0/allure-2.7.0.zip</allureDownloadUrl>
</configuration>
</plugin>
</plugins>
</build>
</project>
What could be wrong here.
Now its clear #ExtendedCucumberOptions were supported till Cucumber V 1.2.5 and Someone working on Cucumber 4.0.0 or later of V 1.2.5 shall not use this option in case someone like to re-run their failed test cases.

Class Not Found Error when Integrating Spark Streaming and Apache Ignite

I am trying to integrate Apache Ignite into an existing Spark Streaming project written in Java that counts the words in a text file. However, I'm getting a Class Not Found Error when I add in the dependency for ignite-spark:
java.lang.ClassNotFoundException: org.spark_project.protobuf.GeneratedMessage
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:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(DynamicAccess.scala:67)
at akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(DynamicAccess.scala:66)
at scala.util.Try$.apply(Try.scala:161)
at akka.actor.ReflectiveDynamicAccess.getClassFor(DynamicAccess.scala:66)
at akka.serialization.Serialization$$anonfun$6.apply(Serialization.scala:181)
at akka.serialization.Serialization$$anonfun$6.apply(Serialization.scala:181)
at scala.collection.TraversableLike$WithFilter$$anonfun$map$2.apply(TraversableLike.scala:722)
at scala.collection.immutable.HashMap$HashMap1.foreach(HashMap.scala:224)
at scala.collection.immutable.HashMap$HashTrieMap.foreach(HashMap.scala:403)
at scala.collection.TraversableLike$WithFilter.map(TraversableLike.scala:721)
at akka.serialization.Serialization.<init>(Serialization.scala:181)
at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:15)
at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:12)
at akka.actor.ActorSystemImpl.registerExtension(ActorSystem.scala:713)
at akka.actor.ExtensionId$class.apply(Extension.scala:79)
at akka.serialization.SerializationExtension$.apply(SerializationExtension.scala:12)
at akka.remote.RemoteActorRefProvider.init(RemoteActorRefProvider.scala:175)
at akka.actor.ActorSystemImpl.liftedTree2$1(ActorSystem.scala:620)
at akka.actor.ActorSystemImpl._start$lzycompute(ActorSystem.scala:617)
at akka.actor.ActorSystemImpl._start(ActorSystem.scala:617)
at akka.actor.ActorSystemImpl.start(ActorSystem.scala:634)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:142)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:119)
at org.apache.spark.util.AkkaUtils$.org$apache$spark$util$AkkaUtils$$doCreateActorSystem(AkkaUtils.scala:121)
at org.apache.spark.util.AkkaUtils$$anonfun$1.apply(AkkaUtils.scala:53)
at org.apache.spark.util.AkkaUtils$$anonfun$1.apply(AkkaUtils.scala:52)
at org.apache.spark.util.Utils$$anonfun$startServiceOnPort$1.apply$mcVI$sp(Utils.scala:1920)
at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:141)
at org.apache.spark.util.Utils$.startServiceOnPort(Utils.scala:1911)
at org.apache.spark.util.AkkaUtils$.createActorSystem(AkkaUtils.scala:55)
at org.apache.spark.rpc.akka.AkkaRpcEnvFactory.create(AkkaRpcEnv.scala:253)
at org.apache.spark.rpc.RpcEnv$.create(RpcEnv.scala:53)
at org.apache.spark.SparkEnv$.create(SparkEnv.scala:254)
at org.apache.spark.SparkEnv$.createDriverEnv(SparkEnv.scala:194)
at org.apache.spark.SparkContext.createSparkEnv(SparkContext.scala:277)
at org.apache.spark.SparkContext.<init>(SparkContext.scala:450)
at org.apache.spark.SparkContext.<init>(SparkContext.scala:162)
at org.apache.spark.SparkContext.<init>(SparkContext.scala:180)
at org.apache.spark.api.java.JavaSparkContext.<init>(JavaSparkContext.scala:67)
at wordCount_test.TestSparkWordCount.setUp(TestSparkWordCount.java:25)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)`
Here is my pom.xml file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>wordCount_Spark</groupId>
<artifactId>wordCount_Spark</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>wordCount_Spark</name>
<description>Count words using spark</description>
<dependencies>
<!-- Spark Streaming dependencies -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.10</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.5.2</version>
<exclusions>
<exclusion>
<artifactId>protobuf-java</artifactId>
<groupId>com.google.protobuf</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.spark-project.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.5.0-spark</version>
</dependency>
<!-- Apache Ignite dependencies -->
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-core</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-indexing</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-log4j</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spark</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.0</version>
<!-- <scope>test</scope> -->
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
</plugins>
</build>
I have tried switching the order of Spark and Ignite in the POM, but it still throws an error when I try to run my JUnit test. Here is the test I am running:
package wordCount_test;
import static org.junit.Assert.*;
import java.io.File;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class TestSparkWordCount {
JavaSparkContext jsc;
File txtFile;
#Before
public void setUp() throws Exception {
jsc = new JavaSparkContext("local[2]", "testSparkWordCount");
txtFile = new File("AIW_WordCount");
if(txtFile.exists()){
txtFile.delete();
}
}
#After
public void tearDown() throws Exception {
if(jsc != null){
jsc.stop();
jsc = null;
}
}
#Test
public void testSparkInit() {
assertNotNull(jsc.sc());
}
}
Is it possible to have both Ignite and Spark Streaming in the same project? Am I missing a dependency? Did I do something wrong or miss a step?
Any help or guidance you can provide would be greatly appreciated!
The test works for me if I remove the exclusion for com.google.protobuf artifact.
My current dependencies list is the following:
<dependencies>
<!-- Spark Streaming dependencies -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.10</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.5.2</version>
</dependency>
<!-- Apache Ignite dependencies -->
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-core</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-indexing</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-log4j</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spark</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.0</version>
<!-- <scope>test</scope> -->
</dependency>
</dependencies>

Mockito:: Null pointer exception for MockMVC

I am having project in spring-mvc. I wrote a test case in mockito, Below is the code:
#RunWith(SpringJUnit4ClassRunner.class)
#ContextConfiguration({"classpath:applicationContext.xml"})
#Configurable
public class ABCControllerTest {
#InjectMocks
CustomerController instance;
#Mock
Service paymentService;
#Mock
OfferService offerService;
#Mock
CategoryRepository categoryRepository;
#Mock
Category category;
#Mock
RuleService ruleService ;
private MockMvc mockMvc;
public PaymentCustomerControllerTest() {
}
#Before
public void setup() {
// this must be called for the #Mock annotations above to be processed
// and for the mock service to be injected into the controller under
// test.
MockitoAnnotations.initMocks(this);
mockMvc = MockMvcBuilders.standaloneSetup(instance).build();
}
#Test
public void testGetNewCashback() throws Exception {
int a= 100;
int b=200;
// System.out.print(mockMvc);
try{
mockMvc.perform(
get("repo/getTotalSum?Id=306187C35A5C98A1B01E3DCDE8BAC1DA&visitId=306187C35A5C98A1B01E3DCDE8BAC1DA&mobileStatus=0"))
.andExpect(MockMvcResultMatchers.status().isOk());
}catch(Exception ex){
System.out.print(ex.getMessage());
}
a = 100;
}
#Test
public void testGetNewCashback() throws Exception {
ResultDTO result = instance.getTotalSum(Id, visitId, mobileStatus);
assertEquals(result, expResult);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
}
and this is my pom file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ssww.cust</groupId>
<artifactId>cust</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<name>Settlement</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<skipTests>true</skipTests>
<spring.core.version>3.1.2.RELEASE</spring.core.version>
<spring.security.core.version>3.1.0.RELEASE</spring.security.core.version>
<spring.data.jpa.version>1.1.0.RELEASE</spring.data.jpa.version>
<mysql.connector.version>5.1.21</mysql.connector.version>
<hibernate.version>4.1.6.Final</hibernate.version>
<c3p0.version>0.9.1.2</c3p0.version>
<querydsl.version>2.7.0</querydsl.version>
<log4j.version>1.2.17</log4j.version>
<cglib.version>2.2.2</cglib.version>
<aspectj.version>1.6.12</aspectj.version>
<slf4j.version>1.6.1</slf4j.version>
<javax.servlet-api.version>2.5</javax.servlet-api.version>
<javax.jstl-taglibs.version>1.1.2</javax.jstl-taglibs.version>
<jackson.version>1.9.3</jackson.version>
<!-- Testing -->
<mockito.version>1.8.5</mockito.version>
<junit.version>4.8.2</junit.version>
<!-- Plugins -->
<maven.copy.plugin.version>0.2.3</maven.copy.plugin.version>
<maven.compiler.plugin.version>2.3.2</maven.compiler.plugin.version>
<maven.apt.plugin.version>1.0</maven.apt.plugin.version>
<netbeans.hint.deploy.server>Tomcat</netbeans.hint.deploy.server>
</properties>
<dependencies>
<!-- javamelody-core >
<dependency>
<groupId>net.bull.javamelody</groupId>
<artifactId>javamelody-core</artifactId>
<version>1.49.0</version>
</dependency-->
<!-- itext, option to add PDF export -->
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
<exclusions>
<exclusion>
<artifactId>bcmail-jdk14</artifactId>
<groupId>bouncycastle</groupId>
</exclusion>
<exclusion>
<artifactId>bcprov-jdk14</artifactId>
<groupId>bouncycastle</groupId>
</exclusion>
<exclusion>
<artifactId>bctsp-jdk14</artifactId>
<groupId>bouncycastle</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>-->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<!-- <dependency>
<groupId>com.ocpsoft.rewrite</groupId>
<artifactId>rewrite-impl-servlet</artifactId>
<version>1.0.0.Alpha3</version>
</dependency>-->
<!-- <dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>-->
<!-- Spring Core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.core.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.core.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.core.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.core.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.core.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.core.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.core.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- A seamless aspect-oriented extension to the Java programming language -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
<!-- Cglib is a powerful, high performance and quality Code Generation
Library, It is used to extend JAVA classes and implements interfaces at runtime. -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>${cglib.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<!-- The JavaServer Pages Standard Tag Library (JSTL) encapsulates, as
simple tags, core functionality common to many JSP applications. -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${javax.jstl-taglibs.version}</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>${javax.jstl-taglibs.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-hibernate4</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.4.0</version>
</dependency>
<!-- Data Mapper package is a high-performance data binding package built
on Jackson JSON processor -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Jackson is a high-performance JSON processor (parser, generator) -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>${jackson.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Logger -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- The Simple Logging Facade for Java or (SLF4J) serves as a simple facade
or abstraction for various logging frameworks, e.g. java.util.logging, log4j
and logback, allowing the end user to plug in the desired logging framework
at deployment time. -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${spring.security.core.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.security.core.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.security.core.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${spring.security.core.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Spring Data JPA -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${spring.data.jpa.version}</version>
</dependency>
<!-- Database pooling -->
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>${c3p0.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- MySQL Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.connector.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Hibernate and JPA -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- QueryDSL -->
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>${querydsl.version}</version>
</dependency>
<!-- Javax Servlet. This needs to be included for runtime only! -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${javax.servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<!-- Testing dependencies -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.0.6.RELEASE</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.4</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.8</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.modeshape</groupId>
<artifactId>modeshape-sequencer-msoffice</artifactId>
<version>3.1.2.Final</version>
<type>jar</type>
</dependency>
<!-- <dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>core-renderer</artifactId>
<version>R8</version>
<type>jar</type>
</dependency>-->
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>core-renderer</artifactId>
<version>R8</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>net.sf.supercsv</groupId>
<artifactId>super-csv</artifactId>
<version>2.1.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.mixpanel</groupId>
<artifactId>mixpanel-java</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.50</version>
</dependency>
<!-- <dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.1</version>
<scope>test</scope>
</dependency>-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
<type>jar</type>
</dependency>
</dependencies>
<build>
<finalName>settlement</finalName>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.1.2.v20100523</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.0</version>
<configuration>
<skipTests>false</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>maven-apt-plugin</artifactId>
<version>1.0.3</version><!--$NO-MVN-MAN-VER$ -->
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>src/main/java</outputDirectory>
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.5.7.201204190339</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<configuration>
<addContextWarDependencies>true</addContextWarDependencies>
</configuration>
<version>2.1</version>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<ajpPort>8391</ajpPort>
<port>8392</port>
<addContextWarDependencies>true</addContextWarDependencies>
</configuration>
<version>2.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories>
<!-- For main Spring releases -->
<repository>
<id>org.springframework.maven.release</id>
<name>Spring Maven Release Repository</name>
<url>http://maven.springframework.org/release</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<!--
<repository>
<id>jboss</id>
<name>JBoss repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
</repository>
-->
</repositories>
</project>
But on building the project , i am getting this exception:
java.lang.NullPointerException
at ABCControllerTest.testGetNewCashback(ABCControllerTest.java:46)
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.codehaus.surefire.battery.AbstractBattery.executeTestMethod(AbstractBattery.java:124)
at org.codehaus.surefire.battery.AbstractBattery.executeTestMethods(AbstractBattery.java:70)
at org.codehaus.surefire.battery.AbstractBattery.execute(AbstractBattery.java:49)
at org.codehaus.surefire.battery.JUnitBattery.execute(JUnitBattery.java:224)
at org.codehaus.surefire.Surefire.executeBattery(Surefire.java:204)
at org.codehaus.surefire.Surefire.run(Surefire.java:153)
at org.codehaus.surefire.Surefire.run(Surefire.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at the value of mock is getting null, so getting null pointer exception. I googled out, changed spring version to 4.0.0Release, still same.
Any idea? Thanks.
After changing to standalone:i am getting java.lang.Exception: mvc is having null value.this is my code
#RunWith(MockitoJUnitRunner.class)
#ContextConfiguration({"classpath:applicationContext.xml"})
#WebAppConfiguration
public class PaymentCustomerControllerTest {
#Autowired
private WebApplicationContext wac;
private MockMvc mockMvc;
#Before
public void setUp() {
MockitoAnnotations.initMocks(this);
CustomerController instance = new CustomerController();
mockMvc = MockMvcBuilders.standaloneSetup(instance).build();
}
#Test
public void testGetNewCashback() throws Exception {
if(mockMvc==null){
throw new Exception("mvc is having null value");
}
mockMvc.perform(
get("info/getInfo?Id=306&visitId=30618&mobileStatus=0"))
.andExpect(MockMvcResultMatchers.status().isOk());
}
If you want to use Mockito for your tests, you must use MockitoJUnitRunner not SpringJUnit4ClassRunner

Resources