Hi there. I think problem there that you trying to store in session class
that not implements serializable interface.


On 30 May 2017 at 09:26, Ilya Obshadko <ilya.obsha...@gmail.com> wrote:

> I’m upgrading my installation to a clustered solution that uses Elasticache
> (memcached) to store session information.
>
> I use embedded Jetty, Memcached initialization is like this:
>
> Optional.ofNullable(System.getProperty("memcached.server"
> )).ifPresent(memcachedServer
> -> {
>     final MemcachedSessionDataMapFactory dataMapFactory = new
> MemcachedSessionDataMapFactory();
>     final CachingSessionDataStoreFactory dataStoreFactory = new
> CachingSessionDataStoreFactory();
>     dataStoreFactory.setSessionDataMapFactory(dataMapFactory);
>     dataStoreFactory.setSessionStoreFactory(new
> NullSessionDataStoreFactory());
>
>     final String[] hostAndPort = StringUtils.split(memcachedServer, ':');
>     assert hostAndPort.length == 2;
>     dataMapFactory.setAddresses(new InetSocketAddress(hostAndPort[0],
> Integer.parseInt(hostAndPort[1])));
>     dataMapFactory.setExpirySec(3600 * 24);
>
>     try {
>         SessionHandler sessionHandler = mainAppContext.
> getSessionHandler();
>         SessionCache sessionCache = new
> DefaultSessionCacheFactory().getSessionCache(sessionHandler);
>         //new CachingSessionDataStore(new
> MemcachedSessionDataMap("localhost", "11211"), new
> NullSessionDataStore());
>         sessionCache.setSessionDataStore(dataStoreFactory.
> getSessionDataStore(sessionHandler));
>         sessionHandler.setSessionCache(sessionCache);
>     } catch (Exception e) {
>         System.err.println("WARNING error initializing memcached: " +
> e.getMessage());
>     }
> });
>
>
> I have the following exception in logs:
>
> [2017-05-30 06:06:33,816] [WARN] [session]
> java.lang.IllegalArgumentException: Non-serializable object
> at
> net.rubyeye.xmemcached.transcoders.BaseSerializingTranscoder.serialize(
> BaseSerializingTranscoder.java:96)
> at
> net.rubyeye.xmemcached.transcoders.SerializingTranscoder.encode(
> SerializingTranscoder.java:208)
> at
> net.rubyeye.xmemcached.command.text.TextStoreCommand.
> encodeValue(TextStoreCommand.java:199)
> at
> net.rubyeye.xmemcached.command.text.TextStoreCommand.
> encode(TextStoreCommand.java:155)
> at
> net.rubyeye.xmemcached.impl.MemcachedTCPSession.wrapMessage(
> MemcachedTCPSession.java:178)
> at
> com.google.code.yanf4j.core.impl.AbstractSession.write(
> AbstractSession.java:382)
> at
> net.rubyeye.xmemcached.impl.MemcachedConnector.send(
> MemcachedConnector.java:516)
> at
> net.rubyeye.xmemcached.XMemcachedClient.sendCommand(
> XMemcachedClient.java:315)
> at
> net.rubyeye.xmemcached.XMemcachedClient.sendStoreCommand(
> XMemcachedClient.java:2496)
> at net.rubyeye.xmemcached.XMemcachedClient.set(XMemcachedClient.java:1338)
> at net.rubyeye.xmemcached.XMemcachedClient.set(XMemcachedClient.java:1396)
> at net.rubyeye.xmemcached.XMemcachedClient.set(XMemcachedClient.java:1383)
> at
> org.eclipse.jetty.memcached.session.MemcachedSessionDataMap.store(
> MemcachedSessionDataMap.java:154)
> at
> org.eclipse.jetty.server.session.CachingSessionDataStore.store(
> CachingSessionDataStore.java:163)
> at
> org.eclipse.jetty.server.session.AbstractSessionCache.
> put(AbstractSessionCache.java:520)
> at
> org.eclipse.jetty.server.session.SessionHandler.
> complete(SessionHandler.java:371)
> at
> org.eclipse.jetty.server.session.SessionHandler.
> complete(SessionHandler.java:388)
> at
> org.eclipse.jetty.server.session.SessionHandler.
> doScope(SessionHandler.java:1577)
> at
> org.eclipse.jetty.server.handler.ScopedHandler.
> nextScope(ScopedHandler.java:166)
> at
> org.eclipse.jetty.server.handler.ContextHandler.
> doScope(ContextHandler.java:1155)
> at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(
> ScopedHandler.java:141)
> at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(
> ContextHandlerCollection.java:219)
> at
> org.eclipse.jetty.security.SecurityHandler.handle(
> SecurityHandler.java:548)
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(
> HandlerWrapper.java:132)
> at org.eclipse.jetty.server.Server.handle(Server.java:564)
> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
> at
> org.eclipse.jetty.server.HttpConnection.onFillable(
> HttpConnection.java:251)
> at
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(
> AbstractConnection.java:279)
> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
> at org.eclipse.jetty.io.ssl.SslConnection.onFillable(
> SslConnection.java:278)
> at
> org.eclipse.jetty.io.ssl.SslConnection$3.succeeded(SslConnection.java:148)
> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
> at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
> at
> org.eclipse.jetty.util.thread.Invocable.invokePreferred(
> Invocable.java:128)
> at
> org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.
> invoke(Invocable.java:222)
> at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.
> doProduce(EatWhatYouKill.java:294)
> at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(
> EatWhatYouKill.java:199)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
> QueuedThreadPool.java:672)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(
> QueuedThreadPool.java:590)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: java.io.NotSerializableException:
> org.apache.tapestry5.internal.services.LinkImpl
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
> at
> java.util.concurrent.ConcurrentHashMap.writeObject(
> ConcurrentHashMap.java:1413)
> at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at java.io.ObjectStreamClass.invokeWriteObject(
> ObjectStreamClass.java:1028)
> at java.io.ObjectOutputStream.writeSerialData(
> ObjectOutputStream.java:1496)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(
> ObjectOutputStream.java:1432)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
> at
> org.eclipse.jetty.server.session.SessionData.writeObject(SessionData.java:
> 347)
> at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at java.io.ObjectStreamClass.invokeWriteObject(
> ObjectStreamClass.java:1028)
> at java.io.ObjectOutputStream.writeSerialData(
> ObjectOutputStream.java:1496)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(
> ObjectOutputStream.java:1432)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
> at
> net.rubyeye.xmemcached.transcoders.BaseSerializingTranscoder.serialize(
> BaseSerializingTranscoder.java:91)
> ... 39 more
>
> Any ideas which part of Tapestry is causing this? I can’t figure out where
> exactly this is happening.
>
> --
> Ilya Obshadko
>



-- 
С уважением,
Черняк Павел Александрович

Reply via email to