2013-07-17 55 views
4

我是新來的河馬和在河馬cms站點上工作。我正在用spring和hibernate創建一個註冊頁面。Hibernate與Spring集成不能在hippo cms站點項目中工作

首先我在eclipse中使用spring和hibernate框架實現了這個註冊示例。

然後我試圖把它集成到Hippo CMS SITE項目中,我做了和eclipse中的工作相同的所有配置。

在hippo cms中執行它時,會導致很多例外。

[INFO] [talledLocalContainer] 17.07.2013 10:26:08 WARN [org.hibernate.cfg.Configuration.getConfigurationInputStream():1135] /hibernate.cfg.xml not found 
[INFO] [talledLocalContainer] 17.07.2013 10:26:08 WARN [org.hippoecm.hst.container.HstFilter.doFilter():523] Fatal error encountered while processing request '/site/addUser': 
[INFO] [talledLocalContainer] org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.HibernateException: /hibernate.cfg.xml not found 
[INFO] [talledLocalContainer] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:681) 
[INFO] [talledLocalContainer] at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585) 
[INFO] [talledLocalContainer] at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) 
[INFO] [talledLocalContainer] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
[INFO] [talledLocalContainer] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
[INFO] [talledLocalContainer] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) 
[INFO] [talledLocalContainer] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) 
[INFO] [talledLocalContainer] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
[INFO] [talledLocalContainer] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) 
[INFO] [talledLocalContainer] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
[INFO] [talledLocalContainer] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) 
[INFO] [talledLocalContainer] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
[INFO] [talledLocalContainer] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) 
[INFO] [talledLocalContainer] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
[INFO] [talledLocalContainer] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) 
[INFO] [talledLocalContainer] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
[INFO] [talledLocalContainer] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) 
[INFO] [talledLocalContainer] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
[INFO] [talledLocalContainer] at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150) 
[INFO] [talledLocalContainer] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
[INFO] [talledLocalContainer] at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183) 
[INFO] [talledLocalContainer] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
[INFO] [talledLocalContainer] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) 
[INFO] [talledLocalContainer] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
[INFO] [talledLocalContainer] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) 
[INFO] [talledLocalContainer] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
[INFO] [talledLocalContainer] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) 
[INFO] [talledLocalContainer] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) 
[INFO] [talledLocalContainer] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) 
[INFO] [talledLocalContainer] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
[INFO] [talledLocalContainer] at org.hippoecm.hst.container.HstFilter.doFilter(HstFilter.java:335) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
[INFO] [talledLocalContainer] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) 
[INFO] [talledLocalContainer] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
[INFO] [talledLocalContainer] at org.hippoecm.hst.container.XSSUrlFilter.doFilter(XSSUrlFilter.java:49) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
[INFO] [talledLocalContainer] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
[INFO] [talledLocalContainer] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
[INFO] [talledLocalContainer] at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615) 
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
[INFO] [talledLocalContainer] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) 
[INFO] [talledLocalContainer] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) 
[INFO] [talledLocalContainer] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602) 
[INFO] [talledLocalContainer] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 
[INFO] [talledLocalContainer] at java.lang.Thread.run(Thread.java:662) 
[INFO] [talledLocalContainer] Caused by: org.hibernate.HibernateException: /hibernate.cfg.xml not found 
[INFO] [talledLocalContainer] at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1136) 
[INFO] [talledLocalContainer] at org.hibernate.cfg.Configuration.configure(Configuration.java:1160) 
[INFO] [talledLocalContainer] at org.hibernate.cfg.Configuration.configure(Configuration.java:1147) 
[INFO] [talledLocalContainer] at org.vnp.common.controller.LoginController.addUser(LoginController.java:145) 
[INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
[INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
[INFO] [talledLocalContainer] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
[INFO] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:597) 
[INFO] [talledLocalContainer] at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) 
[INFO] [talledLocalContainer] at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436) 
[INFO] [talledLocalContainer] at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424) 
[INFO] [talledLocalContainer] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) 
[INFO] [talledLocalContainer] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) 
[INFO] [talledLocalContainer] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669) 
[INFO] [talledLocalContainer] ... 55 more 
+0

同樣的解決方案是在eclipse中使用spring和hibernate。當我將這個與hippo cms整合時,我得到這個錯誤。 –

+0

我已經添加了所有的hibernate jar。 –

回答

3

根據堆棧跟蹤,很明顯,在類路徑中找不到hibernate.cfg.xml。這通常是由於包含它的罐子/戰爭未包括在內。

+1

hibernate.cfg.xml是用戶提供的配置,不要與hibernate jars本身混淆。通常這是在你的應用程序的jar/war中 – gerrytan