2016-12-29 54 views
1

我試圖在tomcat服務器上實現hazelcast會話。
我已經在tomcat7/lib中放入了以下jar: hazelcast-tomcat8-sessionmanager-1.0.3.jar, hazelcast-3.7.4.jar和hazelcast-client-3.7.4.jar。 在tomcat8/conf目錄/ server.xml中我有:榛樹tomcat會議不從應用上下文類加載

<Listener className="com.hazelcast.session.ClientServerLifecycleListener" /> 

和tomcat8/conf目錄/卡塔利娜/本地主機/ app.xml中:

<Manager className="com.hazelcast.session.HazelcastSessionManager" 
      clientOnly="true"/> 

似乎一切啓動正常,但是當我訪問我得到的應用程序:

29-Dec-2016 16:24:08.073 SEVERE [http-nio-8443-exec-8] org.apache.coyote.http11.AbstractHttp11Processor.process Error processing arequest 
com.hazelcast.nio.serialization.HazelcastSerializationException: java.lang.ClassNotFoundException: org.springframework.security.ui.savedrequest.SavedRequest 
     at com.hazelcast.internal.serialization.impl.JavaDefaultSerializers$JavaSerializer.read(JavaDefaultSerializers.java:224) 
     at com.hazelcast.internal.serialization.impl.StreamSerializerAdapter.read(StreamSerializerAdapter.java:48) 
     at com.hazelcast.internal.serialization.impl.AbstractSerializationService.readObject(AbstractSerializationService.java:251) 
     at com.hazelcast.internal.serialization.impl.ByteArrayObjectDataInput.readObject(ByteArrayObjectDataInput.java:600) 
     at com.hazelcast.session.HazelcastSession.deserializeMap(HazelcastSession.java:141) 
     at com.hazelcast.session.HazelcastSession.readData(HazelcastSession.java:127) 
     at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.readInternal(DataSerializableSerializer.java:151) 
     at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.read(DataSerializableSerializer.java:104) 
     at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.read(DataSerializableSerializer.java:54) 
     at com.hazelcast.internal.serialization.impl.StreamSerializerAdapter.read(StreamSerializerAdapter.java:48) 
     at com.hazelcast.internal.serialization.impl.AbstractSerializationService.toObject(AbstractSerializationService.java:172) 
     at com.hazelcast.client.spi.ClientProxy.toObject(ClientProxy.java:186) 
     at com.hazelcast.client.proxy.ClientMapProxy.getInternal(ClientMapProxy.java:247) 
     at com.hazelcast.client.proxy.ClientMapProxy.get(ClientMapProxy.java:240) 
     at com.hazelcast.session.HazelcastSessionManager.findSession(HazelcastSessionManager.java:222) 
     at org.apache.catalina.connector.Request.isRequestedSessionIdValid(Request.java:2381) 
     at org.apache.catalina.connector.CoyoteAdapter.parseSessionCookiesId(CoyoteAdapter.java:1250) 
     at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:935) 
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:523) 
     at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099) 
     at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670) 
     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520) 
     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476) 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 
     at java.lang.Thread.run(Thread.java:745) 
Caused by: java.lang.ClassNotFoundException: org.springframework.security.ui.savedrequest.SavedRequest 
     at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
     at com.hazelcast.nio.ClassLoaderUtil.tryLoadClass(ClassLoaderUtil.java:151) 
     at com.hazelcast.nio.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:120) 
     at com.hazelcast.nio.IOUtil$ClassLoaderAwareObjectInputStream.resolveClass(IOUtil.java:358) 
     at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1620) 
     at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521) 
     at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1781) 
     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353) 
     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373) 
     at com.hazelcast.internal.serialization.impl.JavaDefaultSerializers$JavaSerializer.read(JavaDefaultSerializers.java:219) 
     ... 26 more 

任何人都有關於我在做什麼錯誤的線索?謝謝

+0

顯然,你的classpath/lib中缺少'spring-security-web-xxx.jar'。 'HazelcastSessionManager'對這個jar有依賴。 –

+0

您正在使用哪個Tomcat版本? 8.0.39或8.5.x? – emre

+0

該應用程序工作完美,無需hazelcast.It是一個應用程序工作5年的生產,它有所有的依賴項。 –

回答

0

看來東西改變你當前線程的上下文ClassLoader所以Hazelcast的序列化服務找不到類。我在Hazelcast Tomcat會話管理器的GitHub存儲庫上爲此創建了一個issue。您可以跟蹤那裏的進展情況。

編輯:
可以請你在this page的JAR,包括對這一問題的初步修復更換hazelcast-tomcat8-sessionmanager-1.0.3.jar,讓我知道這是否解決了問題?

+0

我現在認爲它看到了corect ClassLoader.But我現在有另一個問題。我也有在應用程序中實現的hazelcast 2級緩存。我現在得到了這個:'嚴重:Hazelcast客戶端無法創建。 java.lang.IllegalArgumentException:類型標識必須爲正!當前位置:-200,串行:com[email protected]6d6646ac \t在com.hazelcast.internal.serialization.impl.AbstractSerializationService.register(AbstractSerializationService.java:346) \t' –

+0

看來hazelcast掃描罐子在類序列化器的類路徑中,它發現那些在hazelcast-hibernate上並拋出錯誤。 –

+0

@dinulaurentiu你的新問題似乎與這一個一樣:http://stackoverflow.com/questions/32637634/hazelcast-hibernate-spring-in-payara-glassfish-environment-type-id-must-be和這個在舊的GitHub存儲庫上發佈(https://github.com/hazelcast/hazelcast-hibernate4/issues/3)。我將在官方Hazelcast Hibernate插件GitHub存儲庫中創建一個新問題,以解決此問題。 – emre