Spring MVC did not found mapping - spring-mvc

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 :)

Related

What is this dependency error with Report portal?

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.

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: nested exception is org.springframework

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.

Victorlaerte AsyncTask libray error during maven compile in JavaFX program

I have problem with a build native build and compilation application by maven. I cant solve error:
package com.victorlaerte.asynctask does not exist
i dont know how to deal with it, libray is added by maven and working properly when i run program by intelij.
compile errors:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project PROJECT_NAME: Compilation failure: Compilation failure:
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/api/request/UpdateDownload.java:[6,34] package com.victorlaerte.asynctask does not exist
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/api/request/UpdateDownload.java:[18,37] cannot find symbol
[ERROR] symbol: class AsyncTask
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/api/request/LicenseCheckStatus.java:[5,34] package com.victorlaerte.asynctask does not exist
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/api/request/LicenseCheckStatus.java:[17,41] cannot find symbol
[ERROR] symbol: class AsyncTask
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/controller/PreloaderWindowController.java:[4,34] package com.victorlaerte.asynctask does not exist
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/api/request/LicenseRegister.java:[7,34] package com.victorlaerte.asynctask does not exist
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/api/request/LicenseRegister.java:[19,38] cannot find symbol
The following pom.xml works for me:
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.victorlaerte</groupId>
<artifactId>asynctask</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>12.0.1</version>
</dependency>
<dependency>
<groupId>com.victorlaerte</groupId>
<artifactId>jfx-asynctask</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.2</version>
<configuration>
<mainClass>HelloFX</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Java:
import com.victorlaerte.asynctask.AsyncTask;
public class Test extends AsyncTask {
public void onPreExecute() {
}
public Object doInBackground(Object[] objects) {
return null;
}
public void onPostExecute(Object o) {
}
public void progressCallback(Object[] objects) {
}
}

No mapping found with #RestController an #RequestMapping

I have the following Controller
#RestController("/person")
public class PersonController {
#Autowired
PersonService personService;
#RequestMapping(value = "/list",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE
)
public List<PersonNode> getPersons(){
return personService.getList();
}
}
Now the spring neo4j config:
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- Scan the JavaConfig -->
<context:annotation-config/>
<context:component-scan base-package="server.infrastructure.repositories.neo4j.config" />
</beans>
and spring mvc rest config:
<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/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!--Used for Spring MVC configuration - must have-->
<mvc:annotation-driven />
<!-- This shows where to scan for rest controller -->
<context:component-scan base-package="server.api.rest.controller" />
</beans>
and web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Restful Web Application with Spring MVC 4.0.5x</display-name>
<!-- Root App Context -->
<!-- The definition of the Root Spring Context Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/ApplicationContext.xml</param-value>
</context-param>
<!-- Bootstrap the root application context.Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Web App Settings -->
<!-- Processes application requests -->
<servlet>
<servlet-name>MR.rest.api</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet </servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/SpringMVC/SpringMVC-RESTContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MR.rest.api</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
However when I refer to http://localhost:8080/rest/person/list i keep getting the:
[http-bio-8080-exec-2] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/rest/person/list] in DispatcherServlet with name 'MR.rest.api'
with my Tomcat startup log:
...
INFO: Initializing Spring root WebApplicationContext
01:50:55.703 [localhost-startStop-1] INFO o.s.web.context.ContextLoader - Root WebApplicationContext: initialization started
01:50:55.774 [localhost-startStop-1] INFO o.s.w.c.s.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Wed Dec 16 01:50:55 CET 2015]; root of context hierarchy
01:50:55.805 [localhost-startStop-1] INFO o.s.b.f.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [spring/ApplicationContext.xml]
01:50:55.879 [localhost-startStop-1] INFO o.s.b.f.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [spring/Neo4j-DataSources.xml]
01:50:56.254 [localhost-startStop-1] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'myNeo4jConfiguration' of type [class server.infrastructure.repositories.neo4j.config.MyNeo4jConfiguration$$EnhancerBySpringCGLIB$$7212f882] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01:50:56.257 [localhost-startStop-1] INFO o.s.d.n.config.Neo4jConfiguration - Initialising PersistenceExceptionTranslationPostProcessor
01:50:56.683 [localhost-startStop-1] INFO o.n.o.m.info.ClassFileProcessor - Starting Post-processing phase
01:50:56.684 [localhost-startStop-1] INFO o.n.o.m.info.ClassFileProcessor - Building annotation class map
01:50:56.684 [localhost-startStop-1] INFO o.n.o.m.info.ClassFileProcessor - Building interface class map for 6 classes
01:50:56.684 [localhost-startStop-1] INFO o.n.o.m.info.ClassFileProcessor - Registering default type converters...
01:50:56.692 [localhost-startStop-1] INFO o.n.o.m.info.ClassFileProcessor - Post-processing complete
01:50:56.692 [localhost-startStop-1] INFO o.n.o.m.info.ClassFileProcessor - 6 classes loaded in 22 milliseconds
01:50:56.974 [localhost-startStop-1] INFO o.s.d.n.mapping.Neo4jMappingContext - Neo4jMappingContext initialisation completed
01:50:57.088 [localhost-startStop-1] INFO o.s.d.n.config.Neo4jConfiguration - Initialising PersistenceExceptionTranslator
01:50:57.092 [localhost-startStop-1] INFO o.s.d.n.config.Neo4jConfiguration - Initialising PersistenceExceptionTranslationInterceptor
01:50:57.095 [localhost-startStop-1] INFO o.s.d.n.config.Neo4jConfiguration - Initialising Neo4jTransactionManager
01:50:57.130 [localhost-startStop-1] INFO o.s.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 1424 ms
01:50:57.161 [localhost-startStop-1] INFO o.s.web.servlet.DispatcherServlet - FrameworkServlet 'MR.rest.api': initialization started
gru 16, 2015 1:50:57 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'MR.rest.api'
01:50:57.165 [localhost-startStop-1] INFO o.s.w.c.s.XmlWebApplicationContext - Refreshing WebApplicationContext for namespace 'MR.rest.api-servlet': startup date [Wed Dec 16 01:50:57 CET 2015]; parent: Root WebApplicationContext
01:50:57.166 [localhost-startStop-1] INFO o.s.b.f.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/SpringMVC/SpringMVC-RESTContext.xml]
01:50:57.399 [localhost-startStop-1] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/list],methods=[GET],produces=[application/json]}" onto public java.util.List<server.infrastructure.persistence.neo4j.nodes.PersonNode> server.api.rest.controller.PersonController.getPersons()
01:50:57.626 [localhost-startStop-1] INFO o.s.w.s.m.m.a.RequestMappingHandlerAdapter - Looking for #ControllerAdvice: WebApplicationContext for namespace 'MR.rest.api-servlet': startup date [Wed Dec 16 01:50:57 CET 2015]; parent: Root WebApplicationContext
01:50:57.694 [localhost-startStop-1] INFO o.s.w.s.m.m.a.RequestMappingHandlerAdapter - Looking for #ControllerAdvice: WebApplicationContext for namespace 'MR.rest.api-servlet': startup date [Wed Dec 16 01:50:57 CET 2015]; parent: Root WebApplicationContext
01:50:57.758 [localhost-startStop-1] INFO o.s.w.s.h.BeanNameUrlHandlerMapping - Mapped URL path [/person] onto handler '/person'
01:50:57.826 [localhost-startStop-1] INFO o.s.web.servlet.DispatcherServlet - FrameworkServlet 'MR.rest.api': initialization completed in 665 ms
gru 16, 2015 1:50:57 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
However, when I refer to http://localhost:8080/rest/list I get the expected list of persons.
I want to refer to the http://localhost:8080/rest/person/list while using the #RestController for the person at class level and the `list' at the method level. How this can be done?
you should add #RequestMapping to your Controller Class
#RestController
#RequestMapping("/person")
public class PersonController {
#Autowired
PersonService personService;
#RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<PersonNode> getPersons(){
return personService.getList();
}
}

dpHibernate: serializerFactory not initialized by Spring -> NullPointerException on service access

I am trying to get dpHibernate 2.0 RC6 running on an Apache Tomcat 7.0.12 with BlazeDS 4.0.0.14931, Spring 3.0.5 and Spring-BlazeDS-Integration 1.5.0.M2
With the following configuration the server starts fine, but as soon as I want to access a service or the RDSDispatchServlet via FlashBuilder4 DCD I am getting a NullPointerException. It seems the serializerFactory is not correctly injected into the dpHibernate HibernateUtil. Did I miss something in the configuration in remoting-config.xml?
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Server</display-name>
<description>Server Side based on BlazeDS, Spring and Hibernate</description>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>flex.messaging.HttpFlexSession</listener-class>
</listener>
<!-- begin SPRING INTEGRATION -->
<servlet>
<servlet-name>springMessageBroker</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<!-- <init-param> -->
<!-- <param-name>contextConfigLocation</param-name> -->
<!-- <param-value></param-value> Do not use if using ContextLoaderListener (would load app context twice -> Error) -->
<!-- </init-param> -->
<init-param>
<param-name>services.configuration.file</param-name>
<param-value>/WEB-INF/flex/services-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springMessageBroker</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
<!-- end SPRING INTEGRATION -->
<!-- begin rds -->
<servlet>
<servlet-name>RDSDispatchServlet</servlet-name>
<servlet-class>flex.rds.server.servlet.FrontEndServlet</servlet-class>
<init-param>
<param-name>useAppserverSecurity</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>messageBrokerId</param-name>
<param-value>_messageBroker</param-value>
</init-param>
<load-on-startup>10</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>RDSDispatchServlet</servlet-name>
<url-pattern>/CFIDE/main/ide.cfm</url-pattern>
</servlet-mapping>
<!-- end rds -->
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
<filter>
<filter-name>dpHibernateSessionFilter</filter-name>
<filter-class>org.dphibernate.filters.HibernateSessionServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>dpHibernateSessionFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
applicationContext.xml (Spring Servlet default configuration file)
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:flex="http://www.springframework.org/schema/flex"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/flex
http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<import resource="flexContext.xml" />
<import resource="dataAccessContext.xml" />
<import resource="dpHibernateContext.xml"/>
<!-- Enable Spring Transaction Manager with Annotations -->
<tx:annotation-driven />
<context:annotation-config />
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="/WEB-INF/server.properties" /></bean>
<context:component-scan base-package="com.mycompany.myproject.*" />
</beans>
flexContext.xml (definitions of services available for flex)
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:flex="http://www.springframework.org/schema/flex"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/flex
http://www.springframework.org/schema/flex/spring-flex-1.0.xsd">
<flex:message-destination id="chat"/>
<flex:message-broker services-config-path="/WEB-INF/flex/services-config.xml">
<flex:remoting-service default-adapter-id="dpHibernateRemotingAdapter" default-channels="my-amf,my-secure-amf" />
<flex:message-service default-channels="my-streaming-amf,my-polling-amf"/>
</flex:message-broker>
</beans>
fpHibernateContext.xml (configuration of dpHibernate)
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:flex="http://www.springframework.org/schema/flex"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-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/flex
http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd
">
<!-- Defines the remoting adapter, which intercepts inbound & outbound messages, and routes them thruogh dpHibernate -->
<bean id="dpHibernateRemotingAdapter"
class="org.springframework.flex.core.ManageableComponentFactoryBean">
<constructor-arg value="org.dphibernate.adapters.RemotingAdapter" />
<property name="properties">
<value>
{"dpHibernate" :
{
"serializerFactory" : "org.dphibernate.serialization.SpringContextSerializerFactory"
}
}
</value>
</property>
</bean>
<bean id="dpHibernateMessagingAdapter"
class="org.springframework.flex.core.ManageableComponentFactoryBean">
<constructor-arg value="org.dphibernate.adapters.MessagingAdapter" />
</bean>
<bean id="dataAccessService" class="org.dphibernate.services.SpringLazyLoadService" autowire="constructor">
<flex:remoting-destination />
</bean>
<!-- Required -->
<bean id="hibernateSessionFilter" class="org.dphibernate.filters.SpringHibernateSessionServletFilter" />
<!-- The cache is used to prevent serializing the same object many times during serialization. Required -->
<bean id="dpHibernateCache"
class="org.dphibernate.serialization.DPHibernateCache" scope="prototype" />
<!-- The main serializer. Converts outbound POJO's to ASObjects with dpHibernate proxies for lazy loading. Required -->
<bean id="dpHibernateSerializer"
class="org.dphibernate.serialization.HibernateSerializer" scope="prototype">
<property name="pageSize" value="10"/>
</bean>
<bean id="dpHibernateDeserializer" class="org.dphibernate.serialization.HibernateDeserializer" scope="prototype" />
<!-- Handles entity updates (CRUD). Required if using entity persistence. -->
<bean id="objectChangeUpdater"
class="org.dphibernate.persistence.state.AuthenticatedObjectChangeUpdater"
scope="prototype">
<property name="preProcessors" ref="dpHibernatePreProcessors" />
<property name="postProcessors" ref="dpHibernatePostProcessors" />
</bean>
</beans>
remoting-config.xml (imported in services-config.xml)
<service id="remoting-service"
class="flex.messaging.services.RemotingService"
messageTypes="flex.messaging.messages.RemotingMessage">
<adapters>
<adapter-definition id="hibernate-object" class="org.dphibernate.adapters.RemotingAdapter" default="true">
<properties>
<hibernate>
<sessionFactory>
<class>org.dphibernate.utils.HibernateUtil</class>
<getCurrentSessionMethod>getCurrentSession</getCurrentSessionMethod>
</sessionFactory>
</hibernate>
</properties>
</adapter-definition>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter"/>
</adapters>
<default-channels>
<channel ref="my-amf"/>
</default-channels>
</service>
NullPointerException (on service access or rds access via FB4 DCD)
startInternal INFO: Starting Servlet
Engine: Apache Tomcat/7.0.12
11.04.2011 18:34:19 org.apache.catalina.core.ApplicationContext
log INFO: Initializing Spring root
WebApplicationContext 1027 [Thread-2]
INFO
org.hibernate.annotations.common.Version
- Hibernate Commons Annotations 3.2.0.Final 1066 [Thread-2] INFO org.hibernate.cfg.Environment -
Hibernate 3.6.2.Final 1074 [Thread-2]
INFO org.hibernate.cfg.Environment -
hibernate.properties not found 1085
[Thread-2] INFO
org.hibernate.cfg.Environment -
Bytecode provider name : javassist
1116 [Thread-2] INFO
org.hibernate.cfg.Environment - using
JDK 1.4 java.sql.Timestamp handling
2146 [Thread-2] INFO
org.hibernate.cfg.Configuration -
Hibernate Validator not found:
ignoring 2182 [Thread-2] INFO
org.hibernate.cfg.search.HibernateSearchEventListenerRegister
- Unable to find org.hibernate.search.event.FullTextIndexEventListener
on the classpath. Hibernate Search is
not enabled. 2194 [Thread-2] INFO
org.hibernate.connection.ConnectionProviderFactory
- Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
2658 [Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Database ->
name : MySQL
version : 5.0.51a-24+lenny5-log
major : 5
minor : 0 2658 [Thread-2] INFO org.hibernate.cfg.SettingsFactory -
Driver ->
name : MySQL-AB JDBC Driver
version : mysql-connector-java-5.1.15 (
Revision: ${bzr.revision-id} )
major : 5
minor : 1 2861 [Thread-2] INFO org.hibernate.dialect.Dialect - Using
dialect:
org.hibernate.dialect.MySQLInnoDBDialect
2981 [Thread-2] INFO
org.hibernate.transaction.TransactionFactoryFactory
- Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory
2991 [Thread-2] INFO
org.hibernate.transaction.TransactionManagerLookupFactory
- No TransactionManagerLookup configured (in JTA environment, use of
read-write or transactional
second-level cache is not recommended)
2991 [Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Automatic flush during
beforeCompletion(): disabled 2991
[Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Automatic session close at end of
transaction: disabled 2991 [Thread-2]
INFO org.hibernate.cfg.SettingsFactory
- JDBC batch size: 20 2991 [Thread-2] INFO org.hibernate.cfg.SettingsFactory
- JDBC batch updates for versioned data: disabled 2998 [Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Scrollable result sets: enabled 2998
[Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
JDBC3 getGeneratedKeys(): enabled 2998
[Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Connection release mode: auto 3003
[Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Maximum outer join fetch depth: 2 3003
[Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Default batch fetch size: 1 3003
[Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Generate SQL with comments: disabled
3003 [Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Order SQL updates by primary key:
disabled 3003 [Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Order SQL inserts for batching:
disabled 3003 [Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Query translator:
org.hibernate.hql.ast.ASTQueryTranslatorFactory
3023 [Thread-2] INFO
org.hibernate.hql.ast.ASTQueryTranslatorFactory
- Using ASTQueryTranslatorFactory 3023 [Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Query language substitutions: {} 3023
[Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
JPA-QL strict compliance: disabled
3023 [Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Second-level cache: enabled 3023
[Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Query cache: disabled 3029 [Thread-2]
INFO org.hibernate.cfg.SettingsFactory
- Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
3074 [Thread-2] INFO
org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
- Cache provider: org.hibernate.cache.HashtableCacheProvider
3084 [Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Optimize cache for minimal puts:
disabled 3084 [Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Structured second-level cache entries:
disabled 3131 [Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Echoing all SQL to stdout 3138
[Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Statistics: disabled 3138 [Thread-2]
INFO org.hibernate.cfg.SettingsFactory
- Deleted entity synthetic identifier rollback: disabled 3138 [Thread-2]
INFO org.hibernate.cfg.SettingsFactory
- Default entity-mode: pojo 3138 [Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Named query checking : enabled 3138
[Thread-2] INFO
org.hibernate.cfg.SettingsFactory -
Check Nullability in Core (should be
disabled when Bean Validation is on):
enabled 3239 [Thread-2] INFO
org.hibernate.impl.SessionFactoryImpl
- building session factory 3282 [Thread-2] INFO
org.hibernate.type.BasicTypeRegistry -
Type registration [blob] overrides
previous :
org.hibernate.type.BlobType#17f7be7b
3282 [Thread-2] INFO
org.hibernate.type.BasicTypeRegistry -
Type registration [java.sql.Blob]
overrides previous :
org.hibernate.type.BlobType#17f7be7b
3282 [Thread-2] INFO
org.hibernate.type.BasicTypeRegistry -
Type registration [materialized_clob]
overrides previous :
org.hibernate.type.MaterializedClobType#9fa8988
3282 [Thread-2] INFO
org.hibernate.type.BasicTypeRegistry -
Type registration
[wrapper_materialized_blob] overrides
previous :
org.hibernate.type.WrappedMaterializedBlobType#1f5b44d6
3282 [Thread-2] INFO
org.hibernate.type.BasicTypeRegistry -
Type registration [clob] overrides
previous :
org.hibernate.type.ClobType#21044daf
3282 [Thread-2] INFO
org.hibernate.type.BasicTypeRegistry -
Type registration [java.sql.Clob]
overrides previous :
org.hibernate.type.ClobType#21044daf
3282 [Thread-2] INFO
org.hibernate.type.BasicTypeRegistry -
Type registration [characters_clob]
overrides previous :
org.hibernate.type.PrimitiveCharacterArrayClobType#21882d18
3282 [Thread-2] INFO
org.hibernate.type.BasicTypeRegistry -
Type registration
[wrapper_characters_clob] overrides
previous :
org.hibernate.type.CharacterArrayClobType#734893da
3282 [Thread-2] INFO
org.hibernate.type.BasicTypeRegistry -
Type registration [materialized_blob]
overrides previous :
org.hibernate.type.MaterializedBlobType#21e30857
3379 [Thread-2] INFO
org.hibernate.impl.SessionFactoryObjectFactory
- Not binding factory to JNDI, no JNDI name configured
11.04.2011 18:34:36 org.apache.catalina.core.ApplicationContext
log INFO: Initializing Spring
FrameworkServlet 'springMessageBroker'
11.04.2011 18:34:36 org.apache.coyote.AbstractProtocolHandler
start INFO: Starting ProtocolHandler
["http-bio-8080"]
11.04.2011 18:34:36 org.apache.coyote.AbstractProtocolHandler
start INFO: Starting ProtocolHandler
["ajp-bio-8009"]
11.04.2011 18:34:36 org.apache.catalina.startup.Catalina
start INFO: Server startup in 21332 ms
11.04.2011 18:49:02 org.apache.catalina.core.StandardWrapperValve
invoke SCHWERWIEGEND:
Servlet.service() for servlet
[RDSDispatchServlet] in context with
path [/myJavaServer] threw
exception
java.lang.NullPointerException at
org.dphibernate.utils.HibernateUtil.getSessionFactory(Unknown
Source) at
org.dphibernate.filters.HibernateSessionServletFilter.getSessionFactory(Unknown
Source) at
org.dphibernate.filters.AbstractHibernateSessionServletFilter.doFilter(Unknown
Source) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at
java.lang.Thread.run(Thread.java:662)
org.dphibernate.utils.HibernateUtil (snippet)
private static ISerializerFactory serializerFactory; // should be injected by Spring
public static SessionFactory getSessionFactory() throws HibernateException
{
return serializerFactory.getSessionFactory(); // but is null on this call?
}
The remotingConfig.xml isn't needed, and appears to be what's causing your problems.
Typically, in a Spring configuration, the HibernateUtil class you've shown there isn't used (the SpringContextSerializerFactory returns the SessionFactory to ensure you're getting the correct one from your Spring session)
However, it looks like your remotingConfig.xml file is overwriting the default settings, forcing it to use the old HibernateUtil approach, which is throwing your NPE.

Resources