when trying example "Chap7-Recipe3-JPA-Only" from karafCookbook (see https://github.com/jgoodyear/ApacheKarafCookbook) in karaf 3.0.X to 4.1.1 i'm getting the folowing error :
Missing dependencies:
(&(objectClass=org.apache.aries.blueprint.NamespaceHandler)(osgi.service.blueprint.namespace=http://aries.apache.org/xmlns/jpa/v1.1.0))
I didn't find where this dependency was requiered and how to fix it.
here is the commands I typed from fresly installed karaf 4.0.9 :
karaf#root()> version
4.0.9
karaf#root()> install -s mvn:org.apache.derby/derbyclient/10.8.1.2
Bundle ID: 52
karaf#root()> feature:install jndi
karaf#root()> feature:install jpa
karaf#root()> install -s mvn:com.packt/jpa-only
JPA-Only Demo Bundle starting...
Bundle ID: 81
karaf#root()> list
START LEVEL 100 , List Threshold: 50
ID | State | Lvl | Version | Name
--------------------------------------------------------------------------------------------
52 | Active | 80 | 10.8.1000002.1095077 | Apache Derby 10.8
60 | Active | 80 | 3.0.0 | Expression Language 3.0 API
61 | Active | 80 | 1.2.0 | CDI APIs
62 | Active | 80 | 1.2 | javax.interceptor API
63 | Active | 80 | 1.2 | javax.transaction API
64 | Active | 80 | 2.6.0 | Apache Aries JPA Container API
65 | Active | 80 | 2.6.0 | Apache Aries JPA blueprint
66 | Active | 80 | 2.6.0 | Apache Aries JPA container
67 | Active | 80 | 2.6.0 | Apache Aries JPA support
68 | Active | 80 | 3.2.2 | Apache Commons Collections
69 | Active | 80 | 2.6 | Commons Lang
70 | Active | 80 | 1.6.0 | Commons Pool
71 | Active | 80 | 1.0.2 | Apache Felix Coordinator Service
72 | Active | 80 | 1.1.1 | geronimo-jms_1.1_spec
73 | Active | 80 | 1.1 | Apache Geronimo JSR-317 JPA 2.0 Spec API
74 | Active | 80 | 2.4.1 | OpenJPA Aggregate Jar
75 | Active | 80 | 1.7.0.6 | Apache ServiceMix :: Bundles :: ant
76 | Active | 80 | 1.4.0.3 | Apache ServiceMix :: Bundles :: commons-dbcp
77 | Active | 80 | 1.0.0.2 | Apache ServiceMix :: Bundles :: javax.inject
78 | Active | 80 | 1.14.1.1 | Apache ServiceMix :: Bundles :: serp
79 | Active | 80 | 4.3.0 | Apache XBean :: ASM 5 shaded (repackaged)
80 | Active | 80 | 1.0.0.201505202023 | org.osgi:org.osgi.service.jdbc
81 | GracePeriod | 80 | 1.0.0.SNAPSHOT | Chapter 7 :: Recipe 3 :: JPA-ONLY - 4.0.9
karaf#root()> diag 81
Chapter 7 :: Recipe 3 :: JPA-ONLY - 4.0.9 (81)
----------------------------------------------
Status: GracePeriod
Blueprint
09/06/17 11:13
Missing dependencies:
(&(objectClass=org.apache.aries.blueprint.NamespaceHandler)(osgi.service.blueprint.namespace=http://aries.apache.org/xmlns/jpa/v1.1.0))
and finally, I adapted libs versions in the pom.xml so it loads in 4.0.9 :
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>chapter7-recipe3</artifactId>
<groupId>com.packt</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>jpa-only</artifactId>
<packaging>bundle</packaging>
<name>Chapter 7 :: Recipe 3 :: JPA-ONLY - 4.0.9</name>
<dependencies>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.commons-dbcp</artifactId>
<version>1.4_3</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.enterprise</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>2.4.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.8.1.2</version>
<scope>provided</scope>
</dependency>
<!-- custom felix gogo command -->
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<version>4.0.9</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<configuration>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestriction>true</enforcePropertyRestriction>
</configuration>
<executions>
<execution>
<id>enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.6</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.3.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
<Bundle-Activator>com.packt.jpa.demo.Activator</Bundle-Activator>
<Export-Package>
com.packt.jpa.demo.api.*
</Export-Package>
<Import-Package>
org.osgi.service.blueprint;resolution:=optional,
javax.persistence;version="[1.1,2)",
javax.persistence.criteria;version="[1.1,2)",
javax.sql,
org.apache.commons.dbcp;version="[1.4,2)",
org.apache.derby.jdbc,
org.apache.felix.service.command,
org.apache.felix.gogo.commands,
org.apache.karaf.shell.console,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
</project>
blueprint.xml is unchanged and as follows :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<blueprint default-activation="eager"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0"
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0">
<!-- Define RecipeBookService Services, and expose them. -->
<bean id="recipeBookService" class="com.packt.jpa.demo.dao.RecipeBookServiceDAOImpl">
<jpa:unit property="entityManagerFactory" unitname="recipe" />
</bean>
<service ref="recipeBookService" interface="com.packt.jpa.demo.api.RecipeBookService" />
<!-- Standard DataSource -->
<bean id="dataSource" class="org.apache.derby.jdbc.ClientDataSource" >
<property name="databaseName" value="demo"/>
<property name="createDatabase" value="create"/>
</bean>
<service id="demoDataSource" ref="dataSource" interface="javax.sql.DataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/demo"/>
<entry key="transactional" value="false"/>
</service-properties>
</service>
<!-- Apache Karaf Commands -->
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
<action class="com.packt.jpa.demo.commands.AddRecipe">
<property name="recipeBookService" ref="recipeBookService"/>
</action>
</command>
<command>
<action class="com.packt.jpa.demo.commands.RemoveRecipe">
<property name="recipeBookService" ref="recipeBookService"/>
</action>
</command>
<command>
<action class="com.packt.jpa.demo.commands.ListRecipes">
<property name="recipeBookService" ref="recipeBookService"/>
</action>
</command>
</command-bundle>
</blueprint>
Any idea ?
thanks.
Related
I have Cucumber Jbehave Test Automation framework which I am trying to sync up with Report Portal. I updated pom.xml, log4j2.xml and ReportPortal.properties file. If I comment out the line reportPortalScenario.instance in AllStories, test is running fine. I never used retrofit before. Please tell me what am I missing. Thanks in Advance
But when I run a test with ReportPortalScenarioFormat.INSTANCE , I see the below error
[ERROR] Failed to execute goal org.jbehave:jbehave-maven-plugin:4.8.1:run-stories-as-embeddables (embeddable-stories) on project insights-acceptance-tests: Execution embeddable-stories of goal org.jbehave:jbehave-maven-plugin:4.8.1:run-stories-as-embeddables failed: A required class was missing while executing org.jbehave:jbehave-maven-plugin:4.8.1:run-stories-as-embeddables: retrofit2/adapter/rxjava2/RxJava2CallAdapterFactory
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.jbehave:jbehave-maven-plugin:4.8.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/jpt/m2/repo/org/jbehave/jbehave-maven-plugin/4.8.1/jbehave-maven-plugin-4.8.1.jar
[ERROR] urls[1] = file:/C:/jpt/m2/repo/org/jbehave/jbehave-core/4.8.1/jbehave-core-4.8.1.jar
[ERROR] urls[2] = file:/C:/jpt/m2/repo/junit/junit/4.13.1/junit-4.13.1.jar
[ERROR] urls[3] = file:/C:/jpt/m2/repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
[ERROR] urls[4] = file:/C:/jpt/m2/repo/org/hamcrest/hamcrest/2.1/hamcrest-2.1.jar
[ERROR] urls[5] = file:/C:/jpt/m2/repo/commons-io/commons-io/2.6/commons-io-2.6.jar
[ERROR] urls[6] = file:/C:/jpt/m2/repo/org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.jar
[ERROR] urls[7] = file:/C:/jpt/m2/repo/org/apache/commons/commons-text/1.3/commons-text-1.3.jar
[ERROR] urls[8] = file:/C:/jpt/m2/repo/org/codehaus/plexus/plexus-utils/3.1.0/plexus-utils-3.1.0.jar
[ERROR] urls[9] = file:/C:/jpt/m2/repo/org/freemarker/freemarker/2.3.28/freemarker-2.3.28.jar
[ERROR] urls[10] = file:/C:/jpt/m2/repo/com/thoughtworks/paranamer/paranamer/2.8/paranamer-2.8.jar
[ERROR] urls[11] = file:/C:/jpt/m2/repo/com/thoughtworks/xstream/xstream/1.4.14/xstream-1.4.14.jar
[ERROR] urls[12] = file:/C:/jpt/m2/repo/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar
[ERROR] urls[13] = file:/C:/jpt/m2/repo/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar
[ERROR] urls[14] = file:/C:/jpt/m2/repo/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar
[ERROR] urls[15] = file:/C:/jpt/m2/repo/org/codehaus/plexus/plexus-interpolation/1.1/plexus-interpolation-1.1.jar
[ERROR] urls[16] = file:/C:/jpt/m2/repo/org/codehaus/plexus/plexus-archiver/1.2/plexus-archiver-1.2.jar
[ERROR] urls[17] = file:/C:/jpt/m2/repo/org/codehaus/plexus/plexus-io/1.0.1/plexus-io-1.0.1.jar
[ERROR] urls[18] = file:/C:/jpt/m2/repo/org/apache/maven/skins/maven-default-skin/1.0/maven-default-skin-1.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :insights-acceptance-tests
Process finished with exit code 1
This is my pom.xml
ependencies>
<dependency>
<groupId>com.epam.reportportal</groupId>
<artifactId>agent-java-jbehave</artifactId>
<version>5.1.1</version>
</dependency>
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-core</artifactId>
<version>${jbehave.core.version}</version>
</dependency>
<dependency>
<groupId>com.mastercard.commercial.ta</groupId>
<artifactId>insights-application-driver</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.3.2</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.4.5</version>
</dependency>
<dependency>
<groupId>com.mastercard.commercial.ta</groupId>
<artifactId>tenon-io-lib</artifactId>
<version>3.1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc10</artifactId>
<version>19.3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.17.1</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>${jbehave.core.version}</version>
<executions>
<execution>
<id>embeddable-stories</id>
<phase>test</phase>
<configuration>
<includes>
<include>${embeddables}</include>
</includes>
<excludes/>
<ignoreFailureInStories>true</ignoreFailureInStories>
<ignoreFailureInView>false</ignoreFailureInView>
<threads>1</threads>
<metaFilters>
<metaFilter>${meta.filter}</metaFilter>
</metaFilters>
</configuration>
<goals>
<goal>run-stories-as-embeddables</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration packages="com.epam.ta.reportportal.log4j.appender" status="WARN">
<Appenders>
<Console name="ConsoleAppender" target="SYSTEM_OUT">
<PatternLayout
pattern="%d [%t] %-5level %logger{36} - %msg%n%throwable"/>
</Console>
<ReportPortalLog4j2Appender name="ReportPortalAppender">
<PatternLayout
pattern="%d [%t] %-5level %logger{36} - %msg%n%throwable"/>
</ReportPortalLog4j2Appender>
</Appenders>
<Loggers>
<Root level="DEBUG">
<AppenderRef ref="ConsoleAppender" level="info"/>
<AppenderRef ref="ReportPortalAppender"/>
</Root>
</Loggers>
</Configuration>
All Stories.java
public class AllStories extends AdapterUiStories {
/** Set STORY_NAME as "*" to execute all stories. */
private static final String STORY_NAME = "*";
/** This method will select the stories to be executed or re-executed. */
#Override
public List<String> storyPaths() {
String storyPaths = System.getProperty(STORY_PATHS_PROP);
if (storyPaths == null) {
return new StoryFinder()
.findPaths(
CodeLocations.codeLocationFromClass(this.getClass()),
String.format("stories/**/%s.story", STORY_NAME.trim().toLowerCase()),
"");
}
return Arrays.asList(storyPaths.split(FailedStoriesReporter.PATHS_BREAKER));
}
#Override
public Configuration configuration() {
MostUsefulConfiguration configuration = new MostUsefulConfiguration();
configuration.useStoryReporterBuilder(getStoryReporterBuilder(configuration))
.useStoryLoader(new LoadFromClasspath(this.getClass()));
return configuration;
}
private StoryReporterBuilder getStoryReporterBuilder(MostUsefulConfiguration configuration) {
return configuration.storyReporterBuilder()
.withCodeLocation(CodeLocations.codeLocationFromPath("build/reports/jbehave"))
.withDefaultFormats()
.withFormats(Format.HTML, Format.CONSOLE, ReportPortalScenarioFormat.INSTANCE);
}
#Override
protected StoryReporterBuilder getStoryReporterBuilder() {
return super.getStoryReporterBuilder()
.withFailureTraceCompression(false)
.withFailureTrace(true)
.withDefaultFormats();
}
#Override
public ApplicationContext getAnnotatedApplicationContext() {
return new AnnotationConfigApplicationContext(ApplicationConfig.class);
}
You have to specify additional dependencies for jbehave.
Please take a look on our example here: https://github.com/reportportal/examples-java/blob/master/example-jbehave/pom.xml#L56
I've put a comment: "For unknown reason 'jbehave-maven-plugin' does not see these dependencies". Nothing to add here, it's just some kind of bug inside the plugin.
can someone please help me with this issue? I'm new to Spring framework and trying to implement Spring MVC framework as per this tutorial: https://crunchify.com/simplest-spring-mvc-hello-world-example-tutorial-spring-model-view-controller-tips/
But I'm getting the below error:
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [C:\Users\Avanish\Downloads\apache-tomcat-9.0.45\apache-tomcat-9.0.43\wtpwebapps\SpringMVCTutorial\WEB-INF\classes\com\controller\HelloWorld.class]; nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [C:\Users\Avanish\Downloads\apache-tomcat-9.0.45\apache-tomcat-9.0.43\wtpwebapps\SpringMVCTutorial\WEB-INF\classes\com\controller\HelloWorld.class]; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 59
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:454)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:316)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:276)
at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:90)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1391)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1371)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:179)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:149)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:96)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:514)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:394)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:337)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:305)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:195)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:637)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:522)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:591)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1134)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1089)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:761)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [C:\Users\Avanish\Downloads\apache-tomcat-9.0.45\apache-tomcat-9.0.43\wtpwebapps\SpringMVCTutorial\WEB-INF\classes\com\controller\HelloWorld.class]; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 59
at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:61)
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:123)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:430)
... 48 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 59
at org.springframework.asm.ClassReader.<init>(ClassReader.java:195)
at org.springframework.asm.ClassReader.<init>(ClassReader.java:176)
at org.springframework.asm.ClassReader.<init>(ClassReader.java:162)
at org.springframework.asm.ClassReader.<init>(ClassReader.java:283)
at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:58)
... 52 more
Apr 11, 2021 2:10:10 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Servlet.init() for servlet [tutorial] threw exception
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [C:\Users\Avanish\Downloads\apache-tomcat-9.0.45\apache-tomcat-9.0.43\wtpwebapps\SpringMVCTutorial\WEB-INF\classes\com\controller\HelloWorld.class]; nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [C:\Users\Avanish\Downloads\apache-tomcat-9.0.45\apache-tomcat-9.0.43\wtpwebapps\SpringMVCTutorial\WEB-INF\classes\com\controller\HelloWorld.class]; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 59
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:454)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:316)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:276)
at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:90)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1391)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1371)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:179)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:149)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:96)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:514)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:394)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:337)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:305)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:195)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:637)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:522)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:591)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1134)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1089)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:761)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [C:\Users\Avanish\Downloads\apache-tomcat-9.0.45\apache-tomcat-9.0.43\wtpwebapps\SpringMVCTutorial\WEB-INF\classes\com\controller\HelloWorld.class]; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 59
at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:61)
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:123)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:430)
... 48 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 59
at org.springframework.asm.ClassReader.<init>(ClassReader.java:195)
at org.springframework.asm.ClassReader.<init>(ClassReader.java:176)
at org.springframework.asm.ClassReader.<init>(ClassReader.java:162)
at org.springframework.asm.ClassReader.<init>(ClassReader.java:283)
at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:58)
... 52 more
Apr 11, 2021 2:10:10 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet [tutorial]
java.lang.IllegalArgumentException: Unsupported class file major version 59
at org.springframework.asm.ClassReader.<init>(ClassReader.java:195)
at org.springframework.asm.ClassReader.<init>(ClassReader.java:176)
at org.springframework.asm.ClassReader.<init>(ClassReader.java:162)
at org.springframework.asm.ClassReader.<init>(ClassReader.java:283)
at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:58)
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:123)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:430)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:316)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:276)
at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:90)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1391)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1371)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:179)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:149)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:96)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:514)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:394)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:337)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:305)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:195)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:637)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:522)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:591)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1134)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1089)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:761)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:832)
tutorial-servlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<mvc:annotation-driven />
<context:component-scan
base-package="com.controller" />
<mvc:default-servlet-handler />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:beans="http://www.springframework.org/schema/beans"
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_4_0.xsd" id="WebApp_ID" version="4.0">
<display-name>SpringMVCTutorial</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>tutorial</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>tutorial</servlet-name>
<url-pattern>/welcome.jsp</url-pattern>
<url-pattern>/index.jsp</url-pattern>
<url-pattern>/welcome.html</url-pattern>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
HelloWorld.java
package com.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
#Controller
public class HelloWorld {
#RequestMapping("/welcome")
public ModelAndView helloWorld() {
String message = "<br><div style='text-align:center;'>"
+ "<h3>********** Hello World, Spring MVC Tutorial</h3>This message is coming from CrunchifyHelloWorld.java **********</div><br><br>";
return new ModelAndView("welcome", "message", message);
}
}
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SpringMVCTutorial</groupId>
<artifactId>SpringMVCTutorial</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>15</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>5.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
</project>
I've been stuck with this issue from the past 2 days. Have tried so many things but this issue won't go away. I'm not sure what's wrong. please help.
I decided to move into world of Java EE from SE. I analyzed where I should start and most appealing option was spring MVC. I am unable to move forward because mapping for page is just not found.
I already checked some solutions here on stackoverflow and also on other sites on internet. Everything looks like it should just work, but there are no expected results.
I am using Maven with this pom.xml configuration
<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>TDC</groupId>
<artifactId>webApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>webApp</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I would like to define servlet to handle pages using web.xml configuration
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>webApp</display-name>
<servlet>
<servlet-name>IndexPage</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>IndexPage</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
IndexPage-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package="tdc.web" />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
I am starting application with class App.class
#SpringBootApplication
#EnableWebMvc
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
Also using controller IndexController.class
#Controller
#RequestMapping(value = "/")
public class IndexController {
#RequestMapping(method = RequestMethod.GET)
public String index(ModelMap model) {
model.addAttribute("message", "MVC index page");
return "index";
}
}
And i want make application entry point at index.jsp
<%# page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%# page import="java.time.LocalDateTime"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Just title</title>
</head>
<body>
<p>
Hello! Today is
<%=LocalDateTime.now()%></p>
<p>And now another messages ${message}</p>
</body>
</html>
My file structure is: https://imgur.com/a/WJg6ksA
My expectation was to see page, but instead of this I only get default 404 error: https://imgur.com/DS2zGAs
Also i noticed in log of spring application Page not found exception and also, when registering new servlet it should be also logged right ? There is only mention about default servlet.
Here is application log
INFO 16860 --- [ main] tdc.web.App : Starting App v0.0.1-SNAPSHOT on Cycan with PID 16860 (C:XXXX)
INFO 16860 --- [ main] tdc.web.App : No active profile set, falling back to default profiles: default
INFO 16860 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
INFO 16860 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
INFO 16860 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.24]
INFO 16860 --- [ main] org.apache.jasper.servlet.TldScanner : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
INFO 16860 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
INFO 16860 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3752 ms
INFO 16860 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
INFO 16860 --- [ main] tdc.web.App : Started App in 4.843 seconds (JVM running for 5.509)
INFO 16860 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
INFO 16860 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
INFO 16860 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 6 ms
WARN 16860 --- [nio-8080-exec-1] o.s.web.servlet.PageNotFound : No mapping for GET /IndexPage
I am not sure what I missed. I will appreciate any answer :)
I am new to Jersy framework and when I run a test case using Jersey Framework to test RESTful web-services I am getting an error as "No tests executed".
The test looks as below
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.test.framework.AppDescriptor;
import com.sun.jersey.test.framework.JerseyTest;
import com.sun.jersey.test.framework.WebAppDescriptor;
import java.net.URISyntaxException;
import javax.json.JsonException;
import javax.json.JsonObject;
import junit.framework.Assert;
import static junit.framework.Assert.assertEquals;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class UserServiceTestJersy extends JerseyTest {
public UserServiceTestJersy() {
}
#Override
protected AppDescriptor configure(){
return new WebAppDescriptor.Builder().build();
}
#Test
public void testUserFetchesSuccess() throws JsonException, URISyntaxException{
WebResource webResource=client().resource("http://jsonplaceholder.typicode.com/");
JsonObject json=webResource.path("posts/2").get(JsonObject.class);
assertEquals("1",json.get("userId"));
assertEquals("1",json.get("id"));
}
}
I can't sort out the error. I want to test a RESTful web service. But I am getting exceptions as follows,
Running UserServiceTestJersy
org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
Caused by: org.testng.TestNGException:
Cannot instantiate class UserServiceTestJersy
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:38)
org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:522)
at org.testng.SuiteRunner.init(SuiteRunner.java:157)
at org.testng.SuiteRunner.<init>(SuiteRunner.java:111)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1299)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1286)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1057)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:70)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:109)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)
... 9 more
Caused by: java.lang.reflect.InvocationTargetException
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:422)
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
... 28 more
Caused by: java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder;
at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119)
at com.sun.jersey.test.framework.JerseyTest.getBaseURI(JerseyTest.java:496)
at com.sun.jersey.test.framework.JerseyTest.getContainer(JerseyTest.java:342)
at com.sun.jersey.test.framework.JerseyTest.<init>(JerseyTest.java:165)
at UserServiceTestJersy.<init>(UserServiceTestJersy.java:28)
... 33 more
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Here is my POM file
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-core</artifactId>
<version>1.19.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-external</artifactId>
<version>1.19.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I’ve created a simple maven project that demonstrates Spring MVC accepts a request and returns a JSON object.
Here’s the 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>bg-SpringREST3.1</groupId>
<artifactId>RESTexample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.5</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.hibernate</groupId> -->
<!-- <artifactId>hibernate-validator</artifactId> -->
<!-- <version>4.3.0.Final</version> -->
<!-- </dependency> -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.13.v20130916</version> </plugin>
</plugins>
</build>
Here's the web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>JSON and XML RESTful web service example</display-name>
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/application.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Here's the application context
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<mvc:annotation-driven />
<!-- Use the message-converters element to specify the orders of message converters -->
<!--
<mvc:annotation-driven>
<mvc:message-converters register-defaults="false">
<bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" />
<bean class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter" />
</mvc:message-converters>
</mvc:annotation-driven>
-->
<context:component-scan base-package="integration.apps" />
Here is my RESTController.java
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
#Controller
public class RESTController {
#RequestMapping("/users/{id}")
#ResponseBody
public User getUser(#PathVariable Long id, #RequestHeader("Accept") String acceptHeader) {
return new User(id, "John Doe");
}
}
And my User.java
public class User {
private Long id;
private String name;
public User() {
}
public User(Long id, String name) {
this.id = id;
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
As far as I’m aware, I’m not using any validation. When I package the project and run Jetty within Eclipse, I receive no errors and the response to
http://localhost:8080/users/5
is
{"id":5,"name":"John Doe"}
Now I deploy the application in Mule following these steps
Create the following folder structure under scr/main/app/webapps
Drop the war file to this location
The mule configuration is as follows
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jetty="http://www.mulesoft.org/schema/mule/jetty"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/jetty http://www.mulesoft.org/schema/mule/jetty/current/mule-jetty.xsd">
<jetty:connector name="jettyConnector">
<jetty:webapps directory="${app.home}/webapps" port="8083" />
</jetty:connector>
</mule>
Running dependency tree outside of Mule Anypoint studio. Note - I need to "mavenize" the mule project achieve this
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) # RESTexample ---
[INFO] bg-SpringREST3.1:RESTexample:war:0.0.1-SNAPSHOT
[INFO] +- org.springframework:spring-web:jar:3.2.1.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:3.2.1.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:3.2.1.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:3.2.1.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-core:jar:3.2.1.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.2.1.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:3.2.1.RELEASE:compile
[INFO] \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.5:compile
[INFO] \- org.codehaus.jackson:jackson-core-asl:jar:1.9.5:compile
Running dependency tree inside Mule Anypoint studio
[INFO] com.mycompany:springresttest:mule:1.0.0-SNAPSHOT
[INFO] +- org.mule:mule-core:jar:3.5.0:provided
[INFO] | +- commons-beanutils:commons-beanutils:jar:1.8.0:provided
[INFO] | +- com.github.stephenc.eaio-uuid:uuid:jar:3.4.0:provided
[INFO] | | \- com.github.stephenc.eaio-grabbag:grabbag:jar:1.8.1:provided
[INFO] | +- commons-cli:commons-cli:jar:1.2:provided
[INFO] | +- commons-collections:commons-collections:jar:3.2.1:provided
[INFO] | +- commons-io:commons-io:jar:1.4:provided
[INFO] | +- commons-lang:commons-lang:jar:2.4:provided
[INFO] | +- commons-pool:commons-pool:jar:1.6:provided
[INFO] | +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:provided
[INFO] | +- org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:jar:1.1:provided
[INFO] | +- javax.annotation:jsr250-api:jar:1.0:provided
[INFO] | +- org.slf4j:jcl-over-slf4j:jar:1.6.1:provided
[INFO] | +- org.slf4j:slf4j-api:jar:1.6.1:provided
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.6.1:provided
[INFO] | +- log4j:log4j:jar:1.2.16:provided
[INFO] | +- asm:asm:jar:3.1:provided
[INFO] | +- asm:asm-commons:jar:3.1:provided
[INFO] | | \- asm:asm-tree:jar:3.1:provided
[INFO] | +- org.mule.mvel:mule-mvel2:jar:2.1.9-MULE-003:provided
[INFO] | +- org.jgrapht:jgrapht-jdk1.5:jar:0.7.3:provided
[INFO] | +- org.mule.common:mule-common:jar:3.5.0:provided
[INFO] | | +- org.apache.xmlbeans:xmlbeans:jar:2.3.0:provided
[INFO] | | +- javax.xml.stream:stax-api:jar:1.0-2:provided
[INFO] | | \- org.antlr:antlr-runtime:jar:3.5:provided
[INFO] | | \- org.antlr:stringtemplate:jar:3.2.1:provided
[INFO] | \- com.google.guava:guava:jar:16.0.1:provided
[INFO] +- org.mule.modules:mule-module-spring-config:jar:3.5.0:provided
[INFO] | +- org.mule.modules:mule-module-annotations:jar:3.5.0:provided
[INFO] | | \- cglib:cglib-nodep:jar:2.2:provided
[INFO] | +- org.springframework:spring-context:jar:3.2.1.RELEASE:provided
[INFO] | | \- org.springframework:spring-expression:jar:3.2.1.RELEASE:provided
[INFO] | +- dom4j:dom4j:jar:1.6.1:provided
[INFO] | \- jaxen:jaxen:jar:1.1.1:provided
[INFO] +- org.mule.transports:mule-transport-file:jar:3.5.0:provided
[INFO] +- org.mule.transports:mule-transport-http:jar:3.5.0:provided
[INFO] | +- org.mule.transports:mule-transport-ssl:jar:3.5.0:provided
[INFO] | +- commons-codec:commons-codec:jar:1.3:provided
[INFO] | +- commons-httpclient:commons-httpclient:jar:3.1:provided
[INFO] | +- tomcat:tomcat-util:jar:5.5.23:provided
[INFO] | | \- tomcat:tomcat-apr:jar:5.5.23:provided
[INFO] | +- org.samba.jcifs:jcifs:jar:1.3.3:provided
[INFO] | \- joda-time:joda-time:jar:1.6:provided
[INFO] +- org.mule.transports:mule-transport-jdbc:jar:3.5.0:provided
[INFO] | +- commons-dbutils:commons-dbutils:jar:1.2:provided
[INFO] | \- com.experlog:xapool:jar:1.5.0:provided
[INFO] +- org.mule.transports:mule-transport-jms:jar:3.5.0:provided
[INFO] | +- org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1:provided
[INFO] | +- org.apache.geronimo.specs:geronimo-j2ee-management_1.0_spec:jar:1.1:provided
[INFO] | \- org.springframework:spring-jms:jar:3.2.1.RELEASE:provided
[INFO] | \- org.springframework:spring-tx:jar:3.2.1.RELEASE:provided
[INFO] +- org.mule.transports:mule-transport-vm:jar:3.5.0:provided
[INFO] +- org.mule.modules:mule-module-client:jar:3.5.0:provided
[INFO] +- org.mule.modules:mule-module-cxf:jar:3.5.0:provided
[INFO] | +- org.apache.cxf:cxf-rt-core:jar:2.5.9:provided
[INFO] | | +- org.apache.cxf:cxf-api:jar:2.5.9:provided
[INFO] | | | +- org.apache.neethi:neethi:jar:3.0.2:provided
[INFO] | | | \- wsdl4j:wsdl4j:jar:1.6.2:provided
[INFO] | | \- org.apache.ws.xmlschema:xmlschema-core:jar:2.0.3:provided
[INFO] | +- org.apache.cxf:cxf-rt-frontend-simple:jar:2.5.9:provided
[INFO] | | \- org.apache.cxf:cxf-rt-bindings-soap:jar:2.5.9:provided
[INFO] | +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.5.9:provided
[INFO] | | +- xml-resolver:xml-resolver:jar:1.2:provided
[INFO] | | \- org.apache.cxf:cxf-rt-bindings-xml:jar:2.5.9:provided
[INFO] | +- org.apache.cxf:cxf-rt-databinding-aegis:jar:2.5.9:provided
[INFO] | +- org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.5.9:provided
[INFO] | | \- com.sun.xml.bind:jaxb-xjc:jar:2.2.5.1:provided
[INFO] | +- org.apache.cxf:cxf-rt-databinding-jibx:jar:2.5.9:provided
[INFO] | | +- org.apache.cxf:cxf-tools-common:jar:2.5.9:provided
[INFO] | | +- org.jibx:jibx-run:jar:1.2.4.5:provided
[INFO] | | | \- xpp3:xpp3:jar:1.1.3.4.O:provided
[INFO] | | \- org.jibx:jibx-schema:jar:1.2.4.5:provided
[INFO] | | \- org.jibx:jibx-extras:jar:1.2.4.5:provided
[INFO] | | \- org.jdom:jdom:jar:1.1.3:provided
[INFO] | +- org.apache.cxf:cxf-rt-transports-local:jar:2.5.9:provided
[INFO] | +- org.apache.cxf:cxf-rt-ws-security:jar:2.5.9:provided
[INFO] | | +- org.apache.cxf:cxf-common-utilities:jar:2.5.9:provided
[INFO] | | \- org.apache.ws.security:wss4j:jar:1.6.9:provided
[INFO] | | +- org.apache.santuario:xmlsec:jar:1.5.3:provided
[INFO] | | \- org.opensaml:opensaml:jar:2.5.1-1:provided
[INFO] | | \- org.opensaml:openws:jar:1.4.2-1:provided
[INFO] | | \- org.opensaml:xmltooling:jar:1.3.2-1:provided
[INFO] | +- org.apache.cxf:cxf-rt-ws-rm:jar:2.5.9:provided
[INFO] | | \- org.apache.cxf:cxf-rt-management:jar:2.5.9:provided
[INFO] | +- org.apache.cxf:cxf-rt-ws-addr:jar:2.5.9:provided
[INFO] | +- org.apache.cxf:cxf-rt-transports-http:jar:2.5.9:provided
[INFO] | | +- org.apache.cxf:cxf-rt-transports-common:jar:2.5.9:provided
[INFO] | | \- org.springframework:spring-web:jar:3.0.6.RELEASE:provided
[INFO] | +- org.apache.cxf:cxf-wstx-msv-validation:jar:2.5.9:provided
[INFO] | | \- net.java.dev.msv:msv-core:jar:2011.1:provided
[INFO] | | +- com.sun.msv.datatype.xsd:xsdlib:jar:2010.1:provided
[INFO] | | +- isorelax:isorelax:jar:20030108:provided
[INFO] | | \- relaxngDatatype:relaxngDatatype:jar:20020414:provided
[INFO] | +- com.sun.xml.messaging.saaj:saaj-impl:jar:1.3:provided
[INFO] | | \- javax.xml.soap:saaj-api:jar:1.3:provided
[INFO] | +- org.mule.modules:mule-module-spring-security:jar:3.5.0:provided
[INFO] | | +- org.mule.modules:mule-module-spring-extras:jar:3.5.0:provided
[INFO] | | | +- org.springframework:spring-jdbc:jar:3.2.1.RELEASE:provided
[INFO] | | | \- org.springframework:spring-context-support:jar:3.2.1.RELEASE:provided
[INFO] | | +- org.springframework.security:spring-security-core:jar:3.1.0.RELEASE:provided
[INFO] | | | \- org.springframework.security:spring-security-crypto:jar:3.1.0.RELEASE:provided
[INFO] | | +- org.springframework.security:spring-security-config:jar:3.1.0.RELEASE:provided
[INFO] | | +- org.springframework.security:spring-security-web:jar:3.1.0.RELEASE:provided
[INFO] | | +- org.springframework.security:spring-security-ldap:jar:3.1.0.RELEASE:provided
[INFO] | | | \- org.springframework.ldap:spring-ldap-core:jar:1.3.1.RELEASE:provided
[INFO] | | +- org.apache.geronimo.specs:geronimo-servlet_3.0_spec:jar:1.0:provided
[INFO] | | \- org.aspectj:aspectjrt:jar:1.6.11:provided
[INFO] | +- org.mule.transports:mule-transport-tcp:jar:3.5.0:provided
[INFO] | +- net.sourceforge.saxon:saxon:jar:9.1.0.8:provided
[INFO] | +- org.apache.geronimo.specs:geronimo-annotation_1.1_spec:jar:1.0.1:provided
[INFO] | +- org.springframework:spring-beans:jar:3.2.1.RELEASE:provided
[INFO] | +- org.springframework:spring-core:jar:3.2.1.RELEASE:provided
[INFO] | +- javax.mail:mail:jar:1.4.3:provided
[INFO] | +- javax.xml.ws:jaxws-api:jar:2.2.1:provided
[INFO] | | \- javax.jws:jsr181-api:jar:1.0-MR1:provided
[INFO] | \- org.apache.ant:ant:jar:1.7.0:provided
[INFO] | \- org.apache.ant:ant-launcher:jar:1.7.0:provided
[INFO] +- org.mule.modules:mule-module-management:jar:3.5.0:provided
[INFO] | +- mx4j:mx4j-jmx:jar:2.1.1:provided
[INFO] | +- mx4j:mx4j-impl:jar:2.1.1:provided
[INFO] | +- mx4j:mx4j-tools:jar:2.1.1:provided
[INFO] | +- mx4j:mx4j-remote:jar:2.1.1:provided
[INFO] | +- com.yourkit:yjp-controller-api-redist:jar:9.0.8:provided
[INFO] | \- tanukisoft:wrapper:jar:3.2.3:provided
[INFO] +- org.mule.modules:mule-module-scripting:jar:3.5.0:provided
[INFO] | +- org.springframework:spring-aop:jar:3.2.1.RELEASE:provided
[INFO] | | \- aopalliance:aopalliance:jar:1.0:provided
[INFO] | +- org.mule.modules:mule-module-builders:jar:3.5.0:provided
[INFO] | +- org.livetribe:livetribe-jsr223:jar:2.0.5:provided
[INFO] | \- org.codehaus.groovy:groovy-all:jar:1.8.6:provided
[INFO] +- org.mule.modules:mule-module-sxc:jar:3.5.0:provided
[INFO] | +- com.envoisolutions.sxc:sxc-xpath:jar:0.7.3:provided
[INFO] | +- com.envoisolutions.sxc:sxc-runtime:jar:0.7.3:provided
[INFO] | \- com.envoisolutions.sxc:sxc-core:jar:0.7.3:provided
[INFO] +- org.mule.modules:mule-module-xml:jar:3.5.0:provided
[INFO] | +- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:provided
[INFO] | +- commons-jxpath:commons-jxpath:jar:1.3:provided
[INFO] | +- com.thoughtworks.xstream:xstream:jar:1.4.2:provided
[INFO] | | \- xmlpull:xmlpull:jar:1.1.3.1:provided
[INFO] | +- xpp3:xpp3_min:jar:1.1.3.4.O:provided
[INFO] | +- org.codehaus.woodstox:woodstox-core-asl:jar:4.1.4:provided
[INFO] | | \- org.codehaus.woodstox:stax2-api:jar:3.1.1:provided
[INFO] | +- net.java.dev.stax-utils:stax-utils:jar:20080702:provided
[INFO] | +- net.sourceforge.saxon:saxon:jar:dom:9.1.0.8:provided
[INFO] | +- net.sourceforge.saxon:saxon:jar:xqj:9.1.0.8:provided
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.1:provided
[INFO] | \- com.sun.xml.bind:jaxb-impl:jar:2.1.5:provided
[INFO] +- org.mule.tests:mule-tests-functional:jar:3.5.0:test
[INFO] | +- commons-net:commons-net:jar:2.0:test
[INFO] | +- org.apache.ftpserver:ftpserver-core:jar:1.0.2:test
[INFO] | | \- org.apache.mina:mina-core:jar:2.0.0-M6:test
[INFO] | +- org.apache.ftpserver:ftplet-api:jar:1.0.2:test
[INFO] | +- org.apache.sshd:sshd-core:jar:0.6.0:test
[INFO] | +- org.bouncycastle:bcprov-jdk16:jar:1.46:test
[INFO] | +- org.mule:mule-core:test-jar:tests:3.5.0:test
[INFO] | \- org.mockito:mockito-all:jar:1.9.0:test
[INFO] +- mockobjects:mockobjects-core:jar:0.09:test
[INFO] \- junit:junit:jar:4.9:test
[INFO] \- org.hamcrest:hamcrest-core:jar:1.1:test
Finally, the .classpath file for the project
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Now, when I run the mule application (Mule server 3.5.0 CE) I get the following error
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0': Invocation of init method failed; nested exception is javax.validation.ValidationException: Unable to find a default provider
Which is fine, if I uncomment the pom.xml entry on my rest project, I can run successfully in Mule.
So, my question, what is the difference between running the app in Eclipse with Jetty plugin and running in Mule again on Jetty.