Spring BlazeDS Integration configuration error - apache-flex

We have an existing (no Spring) Flex/BlazeDS application which we are in the process of migrating to use Spring BlazeDS Integration. Within the Maven pom, there is dependency on spring-flex-core 1.5.2.RELEASE, and this brings in Spring 3.0.5-RELEASE and BlazeDS 4.0.0.14931
I have removed the flex configuration from web.xml, and instead load Spring.
When the Spring application context just includes
<flex:message-broker/>
everything is great, and the application continues to function.
The problem is when I define a message destination, as follows:
<flex:message-destination id="BlazeDs2" />
The following error is thrown, any help is greatly appreciated:
03 Apr 2012 17:44:12,737 ERROR main DispatcherServlet - Context initialization failed
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with
name 'BlazeDs2': Invocation of init method failed; nested exception is
java.lang.IllegalArgumentException: 'name' must not be null at
org.springframework.beans.factory.support.Abstract
AutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.Abstract
AutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean
(AbstractAuto wireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject
(AbstractBeanFactory.java:2 91)
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton
(DefaultSingleton BeanRegistry.java:222)
at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean
(AbstractBeanFactory.java:288 )
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean
(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.
DefaultListableBeanFactory.preInstantiateSingletons
(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplic ationContext.
finishBeanFactoryInitialization(Abstr actApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh
(AbstractApplicationContext.ja va:425)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext
(FrameworkServlet.java:4 42)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext
(FrameworkServlet.java:4 58)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext
(FrameworkServlet.java:339 )
at org.springframework.web.servlet.FrameworkServlet.initServletBean
(FrameworkServlet.java:306)
at org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:4420)
at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4733)
at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDescr iptor(HostConfig.java:675)
at org.apache.catalina.startup.HostConfig.deployDescr iptors(HostConfig.java:601)
at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:1315)
at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent
(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1061)
at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:840)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:463)
at org.apache.catalina.core.StandardService.start(Sta ndardService.java:525)
at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalin a.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:414)
Caused by: java.lang.IllegalArgumentException: 'name' must not be null
at org.springframework.util.Assert.notNull(Assert.jav a:112)
at org.springframework.beans.factory.BeanFactoryUtils .transformedBeanName
(BeanFactoryUtils.java:70)
at org.springframework.beans.factory.support.
AbstractBeanFactory.transformedBeanName (AbstractBeanFactor y.java:993)
at org.springframework.beans.factory.support.Abstract BeanFactory.containsBean
(AbstractBeanFactory.java: 355)
at org.springframework.flex.core.AbstractDestinationF actory.configureAdapter
(AbstractDestinationFactory .java:168)
at org.springframework.flex.core.AbstractDestinationF actory.afterPropertiesSet
(AbstractDestinationFacto ry.java:75)
at org.springframework.beans.factory.support.Abstract
AutowireCapableBeanFactory.invokeInitMethods
(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.Abstract
AutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 41 more

Please provide your services-config.xml and web.xml.
Meanwhile, in the doc sections 7.3 through 7.6 provide useful info about message-destination.

Please change your exposed bean tag to "remoting-destination" from "message-destination",
e.g:-
<flex:remoting-destination ref="myService" />
Make sure your "web.xml" file looks like somewhat this
"<web-app>
<display-name>dzone-server</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/application-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map /spring/* requests to the DispatcherServlet -->
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/spring/*</url-pattern>
</servlet-mapping>
</web-app>"

Related

Spring-mvc support

I'm having troubles adding Spring-mvc support to a JSF based proyect.
Just added a controller:
...
#Controller("arestaController")
#RequestMapping(value="/ArestaController")
public class ArestaController {
#Autowired
private GenericBeanHelper beanHelper;
#Autowired
private GestioDocumentsArestaService gestioDocumentsArestaService;
#RequestMapping(value="/getDocument",method=RequestMethod.POST)
public void getDocument(#RequestBody String documentId,HttpServletRequest request,
HttpServletResponse response){
....
And servlet configuration:
....
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>arestaController</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>config servlet</servlet-name>
<servlet-class>cat.gencat.tei.core.servlet.ConfigServlet</servlet-class>
<load-on-startup>1000</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>arestaController</servlet-name>
<url-pattern>/ArestaController/*</url-pattern>
</servlet-mapping>
...
And I've Spring-context, Spring-web-mvc etc... at build path(and pom).
This is the console output starting server:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/EnvironmentAware
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
Caused by: java.lang.ClassNotFoundException: org.springframework.context.EnvironmentAware
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
... 41 more
Thanks in advance,
David
P.D. Sorry for my english

Anyone successfully deploy a Spring 4 MVC + GAE application?

The Spring 4 MVC + GAE HelloWorld application run successfully in local, but failed after deploying to App Engine Standard. Got below error
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
spring-servlet.xml
<web-app id = "WebApp_ID" version = "2.4"
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">
<display-name>Spring MVC Application</display-name>
<servlet>
<servlet-name>HelloWeb</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>HelloWeb</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
web.xml
<web-app id="WebApp_ID" version="2.4"
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">
<display-name>Spring4MVCHelloWorldDemo Web Application</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
Below error log from GAE:
Uncaught exception from servlet
java.lang.NoClassDefFoundError: org/springframework/web/context/support/ServletRequestHandledEvent
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2591)
at java.lang.Class.getConstructor0(Class.java:2943)
at java.lang.Class.newInstance(Class.java:350)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:428)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:203)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:176)
at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:133)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchServletRequest(JavaRuntime.java:635)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchRequest(JavaRuntime.java:595)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:565)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:453)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:460)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:293)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:319)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:311)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:457)
at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:238)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.support.ServletRequestHandledEvent
at com.google.appengine.runtime.Request.process-85e29f0941d0ef63(Request.java)
at java.lang.ClassLoader.loadClass(ClassLoader.java:375)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2591)
at java.lang.Class.getConstructor0(Class.java:2943)
at java.lang.Class.newInstance(Class.java:350)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:428)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:453)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:460)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:293)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:319)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:311)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:457)
... 1 more
request_id: "58efb14800ff0694c84e7a3c260001737e6a6f6266666572310001323031373034313474303131303235000100"
timestamp: "2017-04-13T17:11:37.491Z"
enter code here

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();
}
}

java.lang.NullPointerException at org.zkoss.less.ZKLessServlet.initLessResource when calling ServletContext#getResourcePaths()

I am using ZK7, ZKLess.Following is my web.xml.
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebAppId" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>SAMPLE</display-name>
<servlet>
<servlet-name>zkLess</servlet-name>
<servlet-class>org.zkoss.less.ZKLessServlet</servlet-class>
<init-param>
<param-name>org.zkoss.less.LessResource</param-name>
<param-value>/css/less/*</param-value><!-- specify to the folder that contains *.less -->
</init-param>
<init-param>
<param-name>org.zkoss.less.OutputFormat</param-name>
<param-value>.css.dsp</param-value><!-- specify output file suffix, default .css.dsp -->
</init-param>
<init-param>
<param-name>org.zkoss.less.CompressOutput</param-name>
<param-value>true</param-value><!-- compress output, default true -->
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>zkLess</servlet-name>
<url-pattern>*.less</url-pattern><!-- specify to folder that contains *.less -->
</servlet-mapping>
<distributable/>
</web-app>
I am getting NullPointerException at org.zkoss.less.ZKLessServlet.initLessResource when calling ServletContext.getResourcePaths(LessResourcePath) while starting the application where LessResourcePath is the path containing less files.
How to rectify this issue?
Full Stack Trace for the error is :
SEVERE: Servlet /IPSMWeb threw load() exception
java.lang.NullPointerException
at org.zkoss.less.ZKLessServlet.initLessResource(ZKLessServlet.java:121)
at org.zkoss.less.ZKLessServlet.init(ZKLessServlet.java:90)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1190)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1103)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1010)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
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:619)

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