掲示板

Spring MVC, Hibernate Class Cast : net.sf.ehcache.Element

11年前 に tom mahy によって更新されました。

Spring MVC, Hibernate Class Cast : net.sf.ehcache.Element

Junior Member 投稿: 38 参加年月日: 12/05/02 最新の投稿
We are developping a portlet Spring mvc portlet with maven using hibernate to access the database.
We are using liferay 6.1 GA2.

The spring portlet works fine on its own ( without hibernate ). We've used this in several other portlets. However when we integrate hibernate with it we have problems.
I have used the sample-hibernate-portlet-6.1.x as a reference.

My pom.xml

<dependency>
			<groupid>org.hibernate</groupid>
			<artifactid>hibernate-core</artifactid>
			<version>${hibernate.version}</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupid>org.hibernate</groupid>
			<artifactid>hibernate-c3p0</artifactid>
			<version>${hibernate.version}</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupid>org.hibernate</groupid>
			<artifactid>hibernate-validator</artifactid>
			<version>4.3.0.Final</version>
		</dependency>

		<dependency>
			<groupid>net.sf.ehcache</groupid>
			<artifactid>ehcache-core</artifactid>
			<version>${ehcache.version}</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupid>javassist</groupid>
			<artifactid>javassist</artifactid>
			<version>3.11.0.GA</version>
			<scope>provided</scope>
		</dependency>


my liferay-plugin-package.properties

portal-dependency-jars=\
hibernate3.jar,\
antlr2.jar,\
antlr3.jar,\
antlr3-runtime.jar,\
commons-collections.jar,\
ehcache-core.jar,\
javassist.jar,\
c3p0.jar,\
dom4j.jar


my ehcache.xml

<ehcache xsi:nonamespaceschemalocation="ehcache.xsd" name="news_list">

	<defaultcache maxelementsinmemory="1000" eternal="false" timetoliveseconds="600" overflowtodisk="false">
	</defaultcache>

</ehcache>


my hibernate.cfg.xml

<hibernate-configuration>
	<session-factory>
		<property name="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory</property>
		<property name="hibernate.cache.use_query_cache">true</property>
		<property name="hibernate.cache.use_second_level_cache">true</property>

		<property name="current_session_context_class">thread</property>

		<mapping resource="mappings.hbm.xml" />

	</session-factory>
</hibernate-configuration>


The hibernateUtil is copy of the one in the sample.

I deploy the portlet fine. The first time it shows no problems.
After several refreshes i get the error :


17:23:52,399 ERROR [ControllerUser:111] failed to search the users :
com.liferay.portal.kernel.exception.SystemException: java.lang.ClassCastException: net.sf.ehcache.Element cannot be cast to net.sf.ehcache.Element
at com.liferay.portal.service.persistence.UserFinderImpl.findByC_FN_MN_LN_SN_EA_S(UserFinderImpl.java:613)
at com.liferay.portal.service.persistence.UserFinderImpl.findByKeywords(UserFinderImpl.java:337)
at com.liferay.portal.service.impl.UserLocalServiceImpl.search(UserLocalServiceImpl.java:2940)
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 com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:122)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:71)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:211)
at $Proxy97.search(Unknown Source)
at com.liferay.portal.service.UserLocalServiceUtil.search(UserLocalServiceUtil.java:1903)
at be.etnic.portlet.search.type.user.ControllerUser.start(ControllerUser.java:75)
at be.etnic.portlet.SearchController.search(SearchController.java:374)
at be.etnic.portlet.SearchController.getFormView(SearchController.java:342)
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.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:358)
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.doHandle(AnnotationMethodHandlerAdapter.java:345)
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.handleRender(AnnotationMethodHandlerAdapter.java:288)
at org.springframework.web.portlet.DispatcherPortlet.doRenderService(DispatcherPortlet.java:734)
at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:522)
at org.springframework.web.portlet.FrameworkPortlet.doDispatch(FrameworkPortlet.java:470)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:534)
at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:607)
at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:359)
at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1207)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:97)
at com.liferay.portal.servlet.PACLRequestDispatcherWrapper.doDispatch(PACLRequestDispatcherWrapper.java:90)
at com.liferay.portal.servlet.PACLRequestDispatcherWrapper.include(PACLRequestDispatcherWrapper.java:54)
at com.liferay.portal.util.PortalImpl.renderPortlet(PortalImpl.java:5158)
at com.liferay.portal.util.PortalUtil.renderPortlet(PortalUtil.java:1569)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processPortlet(RuntimePortletImpl.java:165)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processPortlet(RuntimePortletImpl.java:97)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.doProcessTemplate(RuntimePortletImpl.java:531)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.doDispatch(RuntimePortletImpl.java:394)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processTemplate(RuntimePortletImpl.java:228)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processTemplate(RuntimePortletImpl.java:216)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil.processTemplate(RuntimePortletUtil.java:113)
at org.apache.jsp.html.portal.layout.view.portlet_jsp._jspService(portlet_jsp.java:507)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
at com.liferay.portal.action.LayoutAction.includeLayoutContent(LayoutAction.java:468)
at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:735)
at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:249)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:176)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:560)
at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:537)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:294)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:138)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:335)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:294)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.servlet.filters.i18n.I18nFilter.processFilter(I18nFilter.java:241)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.servlet.filters.etag.ETagFilter.processFilter(ETagFilter.java:56)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:246)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:80)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:216)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
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:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:219)
at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:333)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
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)
Caused by: java.lang.ClassCastException: net.sf.ehcache.Element cannot be cast to net.sf.ehcache.Element
at net.sf.ehcache.store.compound.factories.DiskStorageFactory.read(DiskStorageFactory.java:292)
at net.sf.ehcache.store.compound.factories.DiskOverflowStorageFactory.retrieve(DiskOverflowStorageFactory.java:151)
at net.sf.ehcache.store.compound.factories.DiskOverflowStorageFactory.retrieve(DiskOverflowStorageFactory.java:43)
at net.sf.ehcache.store.compound.Segment.decode(Segment.java:177)
at net.sf.ehcache.store.compound.Segment.put(Segment.java:447)
at net.sf.ehcache.store.compound.CompoundStore.put(CompoundStore.java:141)
at net.sf.ehcache.Cache.putInternal(Cache.java:1434)
at net.sf.ehcache.Cache.put(Cache.java:1367)
at net.sf.ehcache.Cache.put(Cache.java:1339)
at com.liferay.portal.cache.ehcache.EhcachePortalCache.put(EhcachePortalCache.java:77)
at com.liferay.portal.cache.transactional.TransactionalPortalCache.put(TransactionalPortalCache.java:81)
at com.liferay.portal.kernel.cache.BlockingPortalCache.put(BlockingPortalCache.java:99)
at com.liferay.portal.dao.orm.common.FinderCacheImpl.putResult(FinderCacheImpl.java:156)
at com.liferay.portal.kernel.dao.orm.FinderCacheUtil.putResult(FinderCacheUtil.java:83)
at com.liferay.portal.service.persistence.UserPersistenceImpl.cacheResult(UserPersistenceImpl.java:271)
at com.liferay.portal.service.persistence.UserPersistenceImpl.fetchByPrimaryKey(UserPersistenceImpl.java:1020)
at com.liferay.portal.service.persistence.UserPersistenceImpl.findByPrimaryKey(UserPersistenceImpl.java:961)
at sun.reflect.GeneratedMethodAccessor783.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.liferay.portal.security.pacl.PACLBeanHandler.doInvoke(PACLBeanHandler.java:92)
at com.liferay.portal.security.pacl.PACLBeanHandler.invoke(PACLBeanHandler.java:48)
at $Proxy392.findByPrimaryKey(Unknown Source)
at com.liferay.portal.service.persistence.UserUtil.findByPrimaryKey(UserUtil.java:171)
at com.liferay.portal.service.persistence.UserFinderImpl.findByC_FN_MN_LN_SN_EA_S(UserFinderImpl.java:605)
... 202 more


Any help would be really appreciated.


Thank you
thumbnail
11年前 に Jan Geißler によって更新されました。

RE: Spring MVC, Hibernate Class Cast : net.sf.ehcache.Element

Liferay Master 投稿: 735 参加年月日: 11/07/05 最新の投稿
Probably there are 2 different EHCache.jars in the ClassPath and therefore the exceptions arise.
11年前 に tom mahy によって更新されました。

RE: Spring MVC, Hibernate Class Cast : net.sf.ehcache.Element

Junior Member 投稿: 38 参加年月日: 12/05/02 最新の投稿
that was the first thing i thought too. but this is my WEB-INF/lib

ant-1.7.0.jar
ant-launcher-1.7.0.jar
antlr2.jar
antlr3.jar
antlr3-runtime.jar
aopalliance-1.0.jar
axis-1.4.jar
axis-jaxrpc-1.4.jar
c3p0.jar
commons-collections.jar
commons-discovery-0.5.jar
commons-httpclient.jar
commons-io-1.4.jar
commons-lang-2.5.jar
commons-logging.jar
dom4j.jar
ehcache-core.jar
ext-cfwb-patches-ext-util-bridges.jar
ext-cfwb-patches-ext-util-java.jar
ext-cfwb-patches-ext-util-taglib.jar
gson-1.7.1.jar
hibernate3.jar
hibernate-validator-4.3.0.Final.jar
htmlcleaner-2.2.jar
javassist.jar
jboss-logging-3.1.0.CR2.jar
jdom-1.1.jar
joda-time-2.0.jar
jstl-1.1.2.jar
junit-4.8.2.jar
log4j.jar
portlet-library-1.0.0.jar
saaj-api.jar
slf4j-api-1.6.4.jar
slf4j-api.jar
spring-aop-3.0.5.RELEASE.jar
spring-asm-3.0.5.RELEASE.jar
spring-beans-3.0.5.RELEASE.jar
spring-context-3.0.5.RELEASE.jar
spring-context-support-3.0.5.RELEASE.jar
spring-core-3.0.5.RELEASE.jar
spring-expression-3.0.5.RELEASE.jar
spring-oxm-3.0.5.RELEASE.jar
spring-test-3.0.5.RELEASE.jar
spring-web-3.0.5.RELEASE.jar
spring-webmvc-3.0.5.RELEASE.jar
spring-webmvc-portlet-3.0.5.RELEASE.jar
SQLQuery-1.0.0.jar
standard-1.1.2.jar
util-bridges-6.1.0.jar
util-bridges.jar
util-java-6.1.0.jar
util-java.jar
util-taglib-6.1.0.jar
util-taglib.jar
validation-api-1.0.0.GA.jar
xercesImpl-2.9.1.jar
xml-apis-1.3.04.jar
xmlpull-1.1.3.1.jar
xpp3_min-1.1.4c.jar
xstream-1.4.2.jar

No doubles
Also the ROOT/WEBINF/lib and tomcat/lib are default.
thumbnail
11年前 に Mika Koivisto によって更新されました。

RE: Spring MVC, Hibernate Class Cast : net.sf.ehcache.Element

Liferay Legend 投稿: 1519 参加年月日: 06/08/07 最新の投稿
Well actually you have duplicates already on that list: util-java, util-bridges and util-taglib are all twice. Once from maven and and another one from deployment. Also remove the jars dependencies from your liferay-plugin-package.properties if you are using maven to build your portlet.
thumbnail
11年前 に Tom Mahy によって更新されました。

RE: Spring MVC, Hibernate Class Cast : net.sf.ehcache.Element

Regular Member 投稿: 103 参加年月日: 11/05/11 最新の投稿
Thank for spotting that. I forgot that liferay adds some jars when deploying.

I have removed all references inside the liferay-plugin-package.properties
Re-enabled the jars inside the pom.

The new list is :

ant-1.7.0.jar
ant-launcher-1.7.0.jar
antlr-2.7.6.jar
aopalliance-1.0.jar
axis-1.4.jar
axis-jaxrpc-1.4.jar
c3p0-0.9.1.jar
commons-collections-3.1.jar
commons-discovery-0.5.jar
commons-io-1.4.jar
commons-lang-2.5.jar
commons-logging.jar
dom4j-1.6.1.jar
ehcache-core-2.4.6.jar
ext-cfwb-patches-ext-util-bridges.jar
ext-cfwb-patches-ext-util-java.jar
ext-cfwb-patches-ext-util-taglib.jar
gson-1.7.1.jar
hibernate-c3p0-3.6.10.Final.jar
hibernate-commons-annotations-3.2.0.Final.jar
hibernate-core-3.6.10.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate-validator-4.3.0.Final.jar
htmlcleaner-2.2.jar
javassist-3.11.0.GA.jar
jboss-logging-3.1.0.CR2.jar
jdom-1.1.jar
joda-time-2.0.jar
jstl-1.1.2.jar
jta-1.1.jar
junit-4.8.2.jar
log4j.jar
log.log
portlet-library-1.0.0.jar
slf4j-api-1.6.4.jar
spring-aop-3.0.5.RELEASE.jar
spring-asm-3.0.5.RELEASE.jar
spring-beans-3.0.5.RELEASE.jar
spring-context-3.0.5.RELEASE.jar
spring-context-support-3.0.5.RELEASE.jar
spring-core-3.0.5.RELEASE.jar
spring-expression-3.0.5.RELEASE.jar
spring-oxm-3.0.5.RELEASE.jar
spring-test-3.0.5.RELEASE.jar
spring-web-3.0.5.RELEASE.jar
spring-webmvc-3.0.5.RELEASE.jar
spring-webmvc-portlet-3.0.5.RELEASE.jar
SQLQuery-1.0.0.jar
standard-1.1.2.jar
util-bridges.jar
util-java.jar
util-taglib.jar
validation-api-1.0.0.GA.jar
xercesImpl-2.9.1.jar
xml-apis-1.3.04.jar
xmlpull-1.1.3.1.jar
xpp3_min-1.1.4c.jar
xstream-1.4.2.jar

But the error is still there.
thumbnail
11年前 に Jan Geißler によって更新されました。

RE: Spring MVC, Hibernate Class Cast : net.sf.ehcache.Element

Liferay Master 投稿: 735 参加年月日: 11/07/05 最新の投稿
I think the problem still is a duplicated jar, as the Portal itself has ehcache on it's classpath. Try to remove ehcache from your lib folder and include it via plugin dependencys.
thumbnail
11年前 に Tom Mahy によって更新されました。

RE: Spring MVC, Hibernate Class Cast : net.sf.ehcache.Element

Regular Member 投稿: 103 参加年月日: 11/05/11 最新の投稿
Ok.
so i added to liferay-plugin-package.properties

portal-dependency-jars=\
ehcache-core.jar

The list of jars is the same. Of course with ehcache-core.jar ( the one from liferay itself ) and without the one from maven.
Of course i made sure to empty the temp/work folders and restart liferay.

But the error still appears.

If i remove the jar i get class not found exceptions.
09:49:33,921 ERROR [ajp-bio-8009-exec-2][render_portlet_jsp:154] java.lang.ClassNotFoundException: net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory

Am i missing something ?
thumbnail
11年前 に Jan Geißler によって更新されました。

RE: Spring MVC, Hibernate Class Cast : net.sf.ehcache.Element

Liferay Master 投稿: 735 参加年月日: 11/07/05 最新の投稿
I am not sure, but if I had to guess I would say, that you are using a Hibernate Versions which has another EHCache version as dependency as you have right now.
And I want to point out, that aou now have a different error. The error before was a ClassCastException, now you have a ClassNotFound exception.
This are completely different errors ;)
I would suggest you use hibernate and ehcahe from LIferay directly.
Just my wild guessing though ;)
thumbnail
11年前 に Tom Mahy によって更新されました。

RE: Spring MVC, Hibernate Class Cast : net.sf.ehcache.Element

Regular Member 投稿: 103 参加年月日: 11/05/11 最新の投稿
Thats exactly what i did in the original set up. Look at the liferay-plugin-package.properties from the first post. I only use the hibernate and ehcache libraries supplied by liferay. (i came to the same conclusion than you. Hence me posting here.)

I know that they are two different errors. But you asked me to try without the ehcache library. If i remove the jar from my portlet/WEB-INF/lib i get the no class found error ( this was to check if there was a second ehcache inside the classpath).
However if i use the ehcache supplied by liferay i get the Class Cast Error.

Well im out of ideas. Anybody ?
11年前 に tom mahy によって更新されました。

RE: Spring MVC, Hibernate Class Cast : net.sf.ehcache.Element

Junior Member 投稿: 38 参加年月日: 12/05/02 最新の投稿
as a workaround. And im not proud of this.
You can write an ext plugin to overide EhcachePortalCache. On line 77 catch the put method.