Cannot serialize into L2 cache - java
I'm stuck with some misconfiguration of some kind using datanucleus & JDO within an stand-alone Java web app (which uses Jetty, Servlets [yes the architecture is kinda old] and spring).
We are currently working on a new version; the original project didn't had any dependency update in the past 3 years; so we wanted to have those nice security, performance & functionallity upgrades, but as it was expected, the upgrade wasn't that easy.
Most of the problems we had have been already fixed, but one that is becoming really tedious has not:
When the server starts, it checks if there is a default user in the database; which is mongo. If there is no user, the default one is created. In any case, the server starts up.
We are using datanucleus + JDO to acces the underlying database; mainly because it was already there and beacause most of the system is really tied to it. So far, we can confirm that datanucleus can read the database (the debugger shows a non-null result coming from the database which correcty represents the default user; and some other dummy results from active endpoints). But when datanucleus tries to cache the results, it just goes into a dead end.
The error stack is the following:
GRAVE: exception catched
javax.jdo.JDOException: Failed to set object CachedPC : cls=mobi.allshoppings.model.User version=null loadedFlags=[YYYYYYYYYYYYYYYYY] with id com.inodes.datanucleus.model.Key:User("admin") into Redis cache
at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:680)
at org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1747)
at mobi.allshoppings.dao.spi.GenericDAOJDO.get(GenericDAOJDO.java:144)
at mobi.allshoppings.dao.spi.GenericDAOJDO.get(GenericDAOJDO.java:108)
at mobi.allshoppings.bdb.tools.BasicDataBuilder.warmUp(BasicDataBuilder.java:49)
at mobi.allshoppings.bdb.tools.InitAppServlet.init(InitAppServlet.java:21)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:616)
at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:396)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:871)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:163)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at mobi.allshoppings.jetty.JettyServer.startup(JettyServer.java:62)
at mobi.allshoppings.cli.StartServer.main(StartServer.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at mobi.allshoppings.cli.CLI.main(CLI.java:100)
NestedThrowablesStackTrace:
Failed to set object CachedPC : cls=mobi.allshoppings.model.User version=null loadedFlags=[YYYYYYYYYYYYYYYYY] with id com.inodes.datanucleus.model.Key:User("admin") into Redis cache
org.datanucleus.exceptions.NucleusException: Failed to set object CachedPC : cls=mobi.allshoppings.model.User version=null loadedFlags=[YYYYYYYYYYYYYYYYY] with id com.inodes.datanucleus.model.Key:User("admin") into Redis cache
at org.datanucleus.cache.redis.RedisLevel2Cache.put(RedisLevel2Cache.java:280)
at org.datanucleus.ExecutionContextImpl.putObjectIntoLevel2CacheInternal(ExecutionContextImpl.java:4914)
at org.datanucleus.ExecutionContextImpl.putObjectIntoLevel2Cache(ExecutionContextImpl.java:4741)
at org.datanucleus.ExecutionContextImpl.findObject(ExecutionContextImpl.java:3579)
at org.datanucleus.ExecutionContextImpl.findObject(ExecutionContextImpl.java:3016)
at org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1742)
at mobi.allshoppings.dao.spi.GenericDAOJDO.get(GenericDAOJDO.java:144)
at mobi.allshoppings.dao.spi.GenericDAOJDO.get(GenericDAOJDO.java:108)
at mobi.allshoppings.bdb.tools.BasicDataBuilder.warmUp(BasicDataBuilder.java:49)
at mobi.allshoppings.bdb.tools.InitAppServlet.init(InitAppServlet.java:21)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:616)
at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:396)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:871)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:163)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at mobi.allshoppings.jetty.JettyServer.startup(JettyServer.java:62)
at mobi.allshoppings.cli.StartServer.main(StartServer.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at mobi.allshoppings.cli.CLI.main(CLI.java:100)
As the stack shows, the exception is fired during the serialization process. I'm aware that any class that will be stored using datanucleus must extend Serializable and must use some special annotations, like #PersistenceCapable, #NotPersistant or #EmbebedOnly
The thing is that, the current in-production version has the very same configuration, the only changes made that could broken any datanucleus configuration was the upgrade itself and the declaration of two new classes, which: have been already annotated (as in the documentation and as in other working classes) and those classes are not involved at all in the statup process, so even if their configuration is bad, the server should start just fine; but it refuses to. The persitence.xml and package-mongodb.orm seem just fine (again, as in the documentation and as in other working classes).
The datanucleus enhanchement process and dependency addition into classpath are; as far we know, correct.
The Non-Serializable exception that gets reaised during the serialization process is caused due a (malformed?) CachePC object (builded by datanucleus to wrap the actual User object), which has a field that is an instance of StateManagerImpl and appearently does not implements Serializable, hece causing the exception.
Note: the stacktrace above matches the current configuration of the project and it does not shows directly a NoSerializableException, but while debbuging I confirmed this is the first exception raised. It gets raised when ObjectOutputStream determines that StateManagerImpl isn't a valid object to serialize. The current version uses XMemcached, if we switch this version to Memcached, we can clearly see a "Non-Serializable Exception". (we want to switch to Redis because the original server was designed to be a distributed system; but you would get surprise of how manny bottle necks it has)
So; we don't know why it tries to serialize StateManagerImpl; we thought it was a bug on the last datanucleus version, so we switched to version 5.1.0-release with no success. The app, the Jetty server & the servlets start just fine, we can confirm that datanucleus parses the datanucleus.configuration file sucessfully and we can obtain PersistanceManager instances and read mongo database. But when it comes into writting in the cache (which is done automatically); Redis or XMemcached, we always get a Non-Serializable exception because datanucleus builds a CachedPC with a non-serializable StateManagerImpl.
Where should we re-start? What could be wrong? Should we switch datanucleus for a more supported data access layer?
Thanks in advaice.
UPDATE
The following is the stack trace produced when using Memcached instead of Redis (the behaviour is the same, it breaks when serializing into L2 Cache again)
GRAVE: exception catched
javax.jdo.JDOException: Exception thrown in persistence to xmemcached
at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:676)
at org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1747)
at mobi.allshoppings.dao.spi.GenericDAOJDO.get(GenericDAOJDO.java:144)
at mobi.allshoppings.dao.spi.GenericDAOJDO.get(GenericDAOJDO.java:108)
at mobi.allshoppings.bdb.tools.BasicDataBuilder.warmUp(BasicDataBuilder.java:49)
at mobi.allshoppings.bdb.tools.InitAppServlet.init(InitAppServlet.java:21)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:616)
at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:396)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:871)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:163)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at mobi.allshoppings.jetty.JettyServer.startup(JettyServer.java:62)
at mobi.allshoppings.cli.StartServer.main(StartServer.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at mobi.allshoppings.cli.CLI.main(CLI.java:100)
NestedThrowablesStackTrace:
java.lang.IllegalArgumentException: Non-serializable object
at net.rubyeye.xmemcached.transcoders.BaseSerializingTranscoder.serialize(BaseSerializingTranscoder.java:99)
at net.rubyeye.xmemcached.transcoders.SerializingTranscoder.encode(SerializingTranscoder.java:211)
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:189)
at com.google.code.yanf4j.core.impl.AbstractSession.write(AbstractSession.java:383)
at net.rubyeye.xmemcached.impl.MemcachedConnector.send(MemcachedConnector.java:556)
at net.rubyeye.xmemcached.XMemcachedClient.sendCommand(XMemcachedClient.java:322)
at net.rubyeye.xmemcached.XMemcachedClient.sendStoreCommand(XMemcachedClient.java:2537)
at net.rubyeye.xmemcached.XMemcachedClient.set(XMemcachedClient.java:1369)
at net.rubyeye.xmemcached.XMemcachedClient.set(XMemcachedClient.java:1428)
at net.rubyeye.xmemcached.XMemcachedClient.set(XMemcachedClient.java:1415)
at org.datanucleus.cache.xmemcached.XmemcachedLevel2Cache.put(XmemcachedLevel2Cache.java:177)
at org.datanucleus.ExecutionContextImpl.putObjectIntoLevel2CacheInternal(ExecutionContextImpl.java:4914)
at org.datanucleus.ExecutionContextImpl.putObjectIntoLevel2Cache(ExecutionContextImpl.java:4741)
at org.datanucleus.ExecutionContextImpl.findObject(ExecutionContextImpl.java:3579)
at org.datanucleus.ExecutionContextImpl.findObject(ExecutionContextImpl.java:3016)
at org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1742)
at mobi.allshoppings.dao.spi.GenericDAOJDO.get(GenericDAOJDO.java:144)
at mobi.allshoppings.dao.spi.GenericDAOJDO.get(GenericDAOJDO.java:108)
at mobi.allshoppings.bdb.tools.BasicDataBuilder.warmUp(BasicDataBuilder.java:49)
at mobi.allshoppings.bdb.tools.InitAppServlet.init(InitAppServlet.java:21)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:616)
at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:396)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:871)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:163)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at mobi.allshoppings.jetty.JettyServer.startup(JettyServer.java:62)
at mobi.allshoppings.cli.StartServer.main(StartServer.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at mobi.allshoppings.cli.CLI.main(CLI.java:100)
Caused by: java.io.NotSerializableException: org.datanucleus.state.StateManagerImpl
- field (class "org.datanucleus.identity.IdentityReference", name: "client", type: "class java.lang.Object")
- object (class "org.datanucleus.identity.IdentityReference", org.datanucleus.identity.IdentityReference#44fd7ba4)
- field (class "org.datanucleus.cache.CachedPC", name: "id", type: "class java.lang.Object")
- object (class "org.datanucleus.cache.CachedPC", CachedPC : cls=mobi.allshoppings.model.Address version=null loadedFlags=[YYYYYYYYY])
- custom writeObject data (class "java.util.HashMap")
- object (class "java.util.HashMap", {0=1, 1=CachedPC : cls=mobi.allshoppings.model.Address version=null loadedFlags=[YYYYYYYYY], 2=null, 3=null, 4=CachedPC : cls=mobi.allshoppings.model.ContactInfo version=null loadedFlags=[YYYYYYYYYYYY], 5=Sun Oct 29 04:57:34 CST 2017, 6=null, 7=true, 8=User("admin"), 9=null, 10=Sun Oct 29 05:03:40 CST 2017, 11=0, 12=true, 13=CachedPC : cls=mobi.allshoppings.model.UserSecurity version=null loadedFlags=[YYYYYYYYYYYYYYYYY], 14=null, 15=00000000880E0D76, 16=CachedPC : cls=mobi.allshoppings.model.tools.ViewLocation version=null loadedFlags=[Y]})
- field (class "org.datanucleus.cache.CachedPC", name: "fieldValues", type: "interface java.util.Map")
- root object (class "org.datanucleus.cache.CachedPC", CachedPC : cls=mobi.allshoppings.model.User version=null loadedFlags=[YYYYYYYYYYYYYYYYY])
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1182)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
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 java.util.HashMap.internalWriteEntries(HashMap.java:1790)
at java.util.HashMap.writeObject(HashMap.java:1363)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1128)
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.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
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:94)
... 48 more
Also, the following are state of the ObjectOutputStream's debugInfoStack before the actual exception throw from the serialization process:
This is the state just before the exception creation:
- object (class "java.lang.StackTraceElement", java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1182))
- element of array (index: 0)
- array (class "[Ljava.lang.StackTraceElement;", size: 74)
- field (class "java.lang.Throwable", name: "stackTrace", type: "class [Ljava.lang.StackTraceElement;")
- custom writeObject data (class "java.lang.Throwable")
- root object (class "java.io.NotSerializableException", java.io.NotSerializableException: org.datanucleus.state.StateManagerImpl
- field (class "org.datanucleus.identity.IdentityReference", name: "client", type: "class java.lang.Object")
- object (class "org.datanucleus.identity.IdentityReference", org.datanucleus.identity.IdentityReference#44fd7ba4)
- field (class "org.datanucleus.cache.CachedPC", name: "id", type: "class java.lang.Object")
- object (class "org.datanucleus.cache.CachedPC", CachedPC : cls=mobi.allshoppings.model.Address version=null loadedFlags=[YYYYYYYYY])
- custom writeObject data (class "java.util.HashMap")
- object (class "java.util.HashMap", {0=1, 1=CachedPC : cls=mobi.allshoppings.model.Address version=null loadedFlags=[YYYYYYYYY], 2=null, 3=null, 4=CachedPC : cls=mobi.allshoppings.model.ContactInfo version=null loadedFlags=[YYYYYYYYYYYY], 5=Sun Oct 29 04:57:34 CST 2017, 6=null, 7=true, 8=User("admin"), 9=null, 10=Sun Oct 29 05:03:40 CST 2017, 11=0, 12=true, 13=CachedPC : cls=mobi.allshoppings.model.UserSecurity version=null loadedFlags=[YYYYYYYYYYYYYYYYY], 14=null, 15=00000000880E0D76, 16=CachedPC : cls=mobi.allshoppings.model.tools.ViewLocation version=null loadedFlags=[Y]})
- field (class "org.datanucleus.cache.CachedPC", name: "fieldValues", type: "interface java.util.Map")
- root object (class "org.datanucleus.cache.CachedPC", CachedPC : cls=mobi.allshoppings.model.User version=null loadedFlags=[YYYYYYYYYYYYYYYYY]))
This state displays a suppressedException I hadn't noticed before (and one of the last states before firing the exception):
- object (class "java.util.ArrayList", [])
- field (class "java.util.Collections$UnmodifiableCollection", name: "c", type: "interface java.util.Collection")
- object (class "java.util.Collections$UnmodifiableList", [])
- field (class "java.lang.Throwable", name: "suppressedExceptions", type: "interface java.util.List")
- custom writeObject data (class "java.lang.Throwable")
- root object (class "java.io.NotSerializableException", java.io.NotSerializableException: org.datanucleus.state.StateManagerImpl
- field (class "org.datanucleus.identity.IdentityReference", name: "client", type: "class java.lang.Object")
- object (class "org.datanucleus.identity.IdentityReference", org.datanucleus.identity.IdentityReference#44fd7ba4)
- field (class "org.datanucleus.cache.CachedPC", name: "id", type: "class java.lang.Object")
- object (class "org.datanucleus.cache.CachedPC", CachedPC : cls=mobi.allshoppings.model.Address version=null loadedFlags=[YYYYYYYYY])
- custom writeObject data (class "java.util.HashMap")
- object (class "java.util.HashMap", {0=1, 1=CachedPC : cls=mobi.allshoppings.model.Address version=null loadedFlags=[YYYYYYYYY], 2=null, 3=null, 4=CachedPC : cls=mobi.allshoppings.model.ContactInfo version=null loadedFlags=[YYYYYYYYYYYY], 5=Sun Oct 29 04:57:34 CST 2017, 6=null, 7=true, 8=User("admin"), 9=null, 10=Sun Oct 29 05:03:40 CST 2017, 11=0, 12=true, 13=CachedPC : cls=mobi.allshoppings.model.UserSecurity version=null loadedFlags=[YYYYYYYYYYYYYYYYY], 14=null, 15=00000000880E0D76, 16=CachedPC : cls=mobi.allshoppings.model.tools.ViewLocation version=null loadedFlags=[Y]})
- field (class "org.datanucleus.cache.CachedPC", name: "fieldValues", type: "interface java.util.Map")
- root object (class "org.datanucleus.cache.CachedPC", CachedPC : cls=mobi.allshoppings.model.User version=null loadedFlags=[YYYYYYYYYYYYYYYYY]))
The only class holding Lists as attributes, is an attribute of the User class, which has the following declaration:
#PersistenceCapable(detachable="true")
#EmbeddedOnly
public class UserSecurity implements Serializable {
And I don't see it being called during the caching process, only during the mongodb reading. Again: lectures to mongodb work well, but as datanucleus tryies to cache the just readed object; it fails. So, I don't know from where that unmodificable list is coming.
So, maybe I was being a little too salty; but it turns out that actually our problem was caused by a Datanucleus bug: https://github.com/datanucleus/datanucleus-core/issues/283
The docs says that embedded objects shouldn't have an ID, since they are directly liked to the container object which has an ID (under the "same table" scheme) http://www.datanucleus.org/products/datanucleus/jdo/mapping.html#embedded_pc
But our embedded objects were given a IdentityReference which shouldn't be there.
I noticed that the StateManagerImpl was the cause of the exception when serializing the embedded objects, but I didn't put much attention on the IdentityReference object which lead to the serialization of the StateManagerImpl; causing the errors on cache L2 writting. This is what the bug is all about.
So, the solution was to clone the datanucleus-core project, build and install the latest version locally and re-build our project changing the datanuclues-core dependency to a local file. Its working just great.
After diving deep on the documentation of datanucleus and its code itself, I'm more convinced that datanucleus is actually a very nice datastore abstraction, and we'll keep it on our project (but I still believe that support and error messages are vague)
Related
Hazelcast Hibernate Enum Serialization/Deserialization Exception
I am trying to integrate hazelcast with a Spring boot project for hibernate L2 cache. Hazelcast - 3.9.4 hazelcast-hibernate4 Setting up Hibernate L2 cache in Cluster Mode and connecting like a Native client. The setup works fine (both for L2+Query cache) and I can see data in my cluster . But now a weird Exception is coming:- SEVERE: [10.129.252.157]:5701 [dev] [3.9.4] java.io.InvalidObjectException: enum constant DUMMY does not exist in class com.shared.api.bean.pg.PG com.hazelcast.nio.serialization.HazelcastSerializationException: java.io.InvalidObjectException: enum constant DUMMY does not exist in class com.shared.api.bean.pg.PG at com.hazelcast.internal.serialization.impl.SerializationUtil.handleException(SerializationUtil.java:63) at com.hazelcast.internal.serialization.impl.AbstractSerializationService.readObject(AbstractSerializationService.java:279) at com.hazelcast.internal.serialization.impl.ByteArrayObjectDataInput.readObject(ByteArrayObjectDataInput.java:574) at com.hazelcast.hibernate.serialization.Value.readData(Value.java:76) at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.readInternal(DataSerializableSerializer.java:158) at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.read(DataSerializableSerializer.java:105) at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.read(DataSerializableSerializer.java:50) at com.hazelcast.internal.serialization.impl.StreamSerializerAdapter.read(StreamSerializerAdapter.java:48) at com.hazelcast.internal.serialization.impl.AbstractSerializationService.toObject(AbstractSerializationService.java:191) at com.hazelcast.query.impl.CachedQueryEntry.getValue(CachedQueryEntry.java:75) at com.hazelcast.hibernate.distributed.LockEntryProcessor.process(LockEntryProcessor.java:49) at com.hazelcast.hibernate.distributed.LockEntryProcessor.process(LockEntryProcessor.java:32) at com.hazelcast.map.impl.operation.EntryOperator.process(EntryOperator.java:335) at com.hazelcast.map.impl.operation.EntryOperator.operateOnKeyValueInternal(EntryOperator.java:194) at com.hazelcast.map.impl.operation.EntryOperator.operateOnKey(EntryOperator.java:179) at com.hazelcast.map.impl.operation.EntryOperation.runVanilla(EntryOperation.java:395) at com.hazelcast.map.impl.operation.EntryOperation.run(EntryOperation.java:177) at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:194) at com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl.run(OperationExecutorImpl.java:406) at com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl.runOrExecute(OperationExecutorImpl.java:433) at com.hazelcast.spi.impl.operationservice.impl.Invocation.doInvokeLocal(Invocation.java:569) at com.hazelcast.spi.impl.operationservice.impl.Invocation.doInvoke(Invocation.java:554) at com.hazelcast.spi.impl.operationservice.impl.Invocation.invoke0(Invocation.java:513) at com.hazelcast.spi.impl.operationservice.impl.Invocation.invoke(Invocation.java:207) at com.hazelcast.spi.impl.operationservice.impl.InvocationBuilderImpl.invoke(InvocationBuilderImpl.java:60) at com.hazelcast.client.impl.protocol.task.AbstractPartitionMessageTask.processMessage(AbstractPartitionMessageTask.java:67) at com.hazelcast.client.impl.protocol.task.AbstractMessageTask.initializeAndProcessMessage(AbstractMessageTask.java:123) at com.hazelcast.client.impl.protocol.task.AbstractMessageTask.run(AbstractMessageTask.java:103) at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:154) at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.process(OperationThread.java:125) at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.run(OperationThread.java:100) Caused by: java.io.InvalidObjectException: enum constant DUMMY does not exist in class com.shared.api.bean.pg.PG at java.io.ObjectInputStream.readEnum(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373) at java.util.HashMap.readObject(HashMap.java:1404) at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1909) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808) 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:79) at com.hazelcast.internal.serialization.impl.JavaDefaultSerializers$JavaSerializer.read(JavaDefaultSerializers.java:72) at com.hazelcast.internal.serialization.impl.StreamSerializerAdapter.read(StreamSerializerAdapter.java:48) at com.hazelcast.internal.serialization.impl.AbstractSerializationService.readObject(AbstractSerializationService.java:273) ... 29 more Caused by: java.lang.IllegalArgumentException: com.shared.api.bean.pg.PG is not an enum type at java.lang.Class.enumConstantDirectory(Class.java:3344) at java.lang.Enum.valueOf(Enum.java:232) at java.io.ObjectInputStream.readEnum(ObjectInputStream.java:1750) ... 44 more I also tried to Java serialization/Deserialization and able to retreive the values from my Enum What can be the issue with Hazelcast Serialization/Deserialization? Hz Config:- <map name="com.entity.*"> <in-memory-format>BINARY</in-memory-format> <backup-count>0</backup-count> <async-backup-count>0</async-backup-count> <time-to-live-seconds>0</time-to-live-seconds> <max-idle-seconds>0</max-idle-seconds> <eviction-policy>LRU</eviction-policy> <max-size policy="PER_NODE">10000</max-size> <eviction-percentage>20</eviction-percentage> <merge-policy>com.hazelcast.map.merge.PassThroughMergePolicy</merge-policy> <read-backup-data>false</read-backup-data> <cache-deserialized-values>INDEX-ONLY</cache-deserialized-values> </map>
Grails 3.2.4 refuses to save domain instance: java.lang.IllegalArgumentException: object is not an instance of declaring class
I am upgrading from Grails 2.4.4 to Grails 3.2.4. I have setup a few factories to help me with testing, the role factory works fine, which runs before the users get created. Then I have the following code: println "create user." def testUser = new User(username: 'admin#mail.com', firstName: "admin", lastName: "admin", email: "email#mail.com") println "User. :: " + testUser println "User class. :: " + testUser.getClass().toString() println("User Errors: " + testUser.errors) testUser.save() println "create user2." def testUser2 = new User(username: 'trade#mail.com', email: 'trade#mail.com', firstName: "trade", lastName: "trade").save() Of which the output is: create user User. :: Person: admin#mail.com User class. :: class UserManage.User User Errors: grails.validation.ValidationErrors: 0 errors 2017-01-10 10:21:18.400 ERROR --- [ main] o.s.boot.SpringApplication : Application startup failed java.lang.IllegalArgumentException: object is not an instance of declaring class at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaBeanProperty.getProperty(MetaBeanProperty.java:62) at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1245) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1217) at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1125) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:812) at org.grails.validation.ConstrainedPropertyBuilder.doInvokeMethod(ConstrainedPropertyBuilder.java:74) at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:67) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:446) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:369) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166) at UserManage.User$__clinit__closure2.doCall(User.groovy:79) at UserManage.User$__clinit__closure2.doCall(User.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024) at groovy.lang.Closure.call(Closure.java:414) at UserManage.User$__clinit__closure2.call(User.groovy) at groovy.lang.Closure.call(Closure.java:408) at UserManage.User$__clinit__closure2.call(User.groovy) at org.grails.validation.DefaultConstraintEvaluator.evaluateConstraintsMap(DefaultConstraintEvaluator.java:240) at org.grails.validation.DefaultConstraintEvaluator.evaluateConstraints(DefaultConstraintEvaluator.java:132) at org.grails.validation.DefaultConstraintEvaluator.evaluateConstraints(DefaultConstraintEvaluator.java:119) at org.grails.validation.DefaultConstraintEvaluator.evaluate(DefaultConstraintEvaluator.java:108) at org.grails.core.DefaultGrailsDomainClass.initializeConstraints(DefaultGrailsDomainClass.java:755) at org.grails.core.DefaultGrailsDomainClass.getConstrainedProperties(DefaultGrailsDomainClass.java:746) at org.grails.validation.GrailsDomainClassValidator.validate(GrailsDomainClassValidator.java:76) at org.grails.orm.hibernate.AbstractHibernateGormInstanceApi.save(AbstractHibernateGormInstanceApi.groovy:122) at org.grails.datastore.gorm.GormInstanceApi.save(GormInstanceApi.groovy:116) at org.grails.datastore.gorm.GormEntity$Trait$Helper.save(GormEntity.groovy:98) at org.grails.datastore.gorm.GormEntity$Trait$Helper$save$5.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at UserManage.User.save(User.groovy) at UserManage.User.save(User.groovy) at org.grails.datastore.gorm.GormEntity$save$0.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117) at groovy.Factories.UserFactory.Build(UserFactory.groovy:18) at groovy.Factories.UserFactory$Build.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117) at agripedia.BootStrap$_closure1.doCall(BootStrap.groovy:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1089) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024) at groovy.lang.Closure.call(Closure.java:414) at groovy.lang.Closure.call(Closure.java:408) at grails.util.Environment.evaluateEnvironmentSpecificBlock(Environment.java:516) at grails.util.Environment.executeForEnvironment(Environment.java:509) at grails.util.Environment.executeForCurrentEnvironment(Environment.java:485) at org.grails.web.servlet.boostrap.DefaultGrailsBootstrapClass.callInit(DefaultGrailsBootstrapClass.java:62) at org.grails.web.servlet.context.GrailsConfigUtils.executeGrailsBootstraps(GrailsConfigUtils.java:65) at org.grails.plugins.web.servlet.context.BootStrapClassRunner.onStartup(BootStrapClassRunner.groovy:53) at grails.boot.config.GrailsApplicationPostProcessor.onApplicationEvent(GrailsApplicationPostProcessor.groovy:256) at grails.boot.config.GrailsApplicationPostProcessor.onApplicationEvent(GrailsApplicationPostProcessor.groovy) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:383) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:337) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:882) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at grails.boot.GrailsApp.run(GrailsApp.groovy:83) at grails.boot.GrailsApp.run(GrailsApp.groovy:387) at grails.boot.GrailsApp.run(GrailsApp.groovy:374) at grails.boot.GrailsApp$run.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) at agripedia.Application.main(Application.groovy:8) The save method fails, and it is not due to validation errors. My class structure is APEntity as an abstract class and the User class inherits from the APEntity class. This code works fine in Grails 2.4.4 Any suggestions where I can look to fix the error would be greatly appreciated.
The class instance being constructed is User but the type seen is UserManage.User at UserManage.User.save(User.groovy) In my experience Grails 3 is much more type-safe than Grails 2 and less forgiving for ambiguity. Be explicit: User a = new User()
It turned out that validation was the problem. After I ensured that the types were correct, I disabled all of my constraints. Once the constraints were turned off the validation problem became apparent. In my situation, it was that in Grails 2 I would simply input a null value for a date that is not specified. In grails 3 it seems that this is not allowed, I thus gave it a default value and the validation problem was fixed.
Just to add my notes on this topic since this was the post that made me put a lot of focus in the wrong aspects causing the issue, in the hope to save others spending time trying to identify something that doesn't seem correctly defined. input a null value for a date that is not specified This isn't strictly true. I spent ages attempting to track where the issue was created a dummy site under 3.2.8 and tried to recreate the hasMany and actual objects that had nullable true. If this had been the case then a lot of additional work to fill in nulls where not needed and ultimately filling DB with stuff not required and breaking other logics of the code. Either way so far as I understand this issue is caused in grails 3.2 by two things so far : https://github.com/grails/grails-core/issues/10428 This was when a domain class object had String aUser static constraints = { aUser(nullable:true) } The above is already fixed in later versions of 3.2.X A new issue hit recently https://github.com/grails/grails-core/issues/10600 when a domain object has _underscore String _user static constraints = { _user(nullable:true) } This appears to be in for fixing and should hopefully be fixed for 3.9 Meaning if you have _objects it will be safe to say it is likely to break under 3.2.X > - < 3.2.8 (was working in 3.1.10).
xPage managedBean ODA application error
Navigating from one page to other constantly get following error. Error not related with any of my code at least from stack trace. From debug prints seems that it happen after page is loaded. Any thoughts? com.ibm.xsp.FacesExceptionEx: java.io.NotSerializableException: org.openntf.domino.impl.Document com.ibm.xsp.application.AbstractStateManager.saveSerializedView(AbstractStateManager.java:121) com.ibm.xsp.application.StateManagerImpl.saveSerializedView(StateManagerImpl.java:152) com.ibm.xsp.application.ViewHandlerExImpl._saveViewState(ViewHandlerExImpl.java:455) com.ibm.xsp.application.ViewHandlerExImpl.saveViewState(ViewHandlerExImpl.java:449) com.ibm.xsp.application.ViewHandlerExImpl._renderView(ViewHandlerExImpl.java:324) com.ibm.xsp.application.ViewHandlerExImpl.renderView(ViewHandlerExImpl.java:336) com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:103) com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:120) com.ibm.xsp.controller.FacesControllerImpl.render(FacesControllerImpl.java:270) com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:261) com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157) com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160) com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138) com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103) com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:588) com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335) com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:865) com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:808) com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:577) com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319) com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662) com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482) com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357) com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313) com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272) java.io.NotSerializableException: org.openntf.domino.impl.Document java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1185) java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346) java.util.TreeMap.writeObject(TreeMap.java:5740) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) java.lang.reflect.Method.invoke(Method.java:611) java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1059) java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1502) java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433) java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179) java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1555) java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1516) java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433) java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179) java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1555) java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1516) java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433) java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179) java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346) java.util.HashMap.writeObject(HashMap.java:942) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) java.lang.reflect.Method.invoke(Method.java:611) java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1059) java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1502) java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433) java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179) java.io.ObjectOutputStream.writeUnshared(ObjectOutputStream.java:413) com.ibm.xsp.application.AbstractSerializingStateManager$FastObjectOutputStream.writeObjectEx(AbstractSerializingStateManager.java:438) com.ibm.xsp.application.AbstractSerializingStateManager$FastObjectOutputStream.writeObjectEx(AbstractSerializingStateManager.java:417) com.ibm.xsp.application.AbstractSerializingStateManager$FastObjectOutputStream.writeObjectEx(AbstractSerializingStateManager.java:417) com.ibm.xsp.application.AbstractSerializingStateManager$FastObjectOutputStream.writeObjectEx(AbstractSerializingStateManager.java:417) com.ibm.xsp.application.AbstractSerializingStateManager$FastObjectOutputStream.writeObjectEx(AbstractSerializingStateManager.java:417) com.ibm.xsp.application.AbstractSerializingStateManager.saveSerializedView(AbstractSerializingStateManager.java:294) com.ibm.xsp.application.AbstractSerializingStateManager.doSaveSerializedView(AbstractSerializingStateManager.java:269) com.ibm.xsp.application.FileStateManager.doSaveSerializedView(FileStateManager.java:290) com.ibm.xsp.application.FileStateManager.doSaveSerializedView(FileStateManager.java:270) com.ibm.xsp.application.AbstractStateManager.saveSerializedView(AbstractStateManager.java:114) com.ibm.xsp.application.StateManagerImpl.saveSerializedView(StateManagerImpl.java:152) com.ibm.xsp.application.ViewHandlerExImpl._saveViewState(ViewHandlerExImpl.java:455) com.ibm.xsp.application.ViewHandlerExImpl.saveViewState(ViewHandlerExImpl.java:449) com.ibm.xsp.application.ViewHandlerExImpl._renderView(ViewHandlerExImpl.java:324) com.ibm.xsp.application.ViewHandlerExImpl.renderView(ViewHandlerExImpl.java:336) com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:103) com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:120) com.ibm.xsp.controller.FacesControllerImpl.render(FacesControllerImpl.java:270) com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:261) com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157) com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160) com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138) com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103) com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:588) com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335) com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:865) com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:808) com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:577) com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319) com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662) com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482) com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357) com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313) com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
You cannot store any Domino object in a managed bean. As the method says, it's not serializable. ODA cannot work around that issue. My recommendation would be to store either the DominoDocument object (if you need the front-end document, so updating it during the life of the bean but not saving each time) or the UNID (if you just need the backend document). Database.getDocumentByUNID() is extremely fast, so you should not be concerned about the performance impacts of getting the document. If you want to avoid getting the document multiple times in the XPages lifecycle, put the resulting Document object in requestScope and check there before retrieving from the database. Alternatively (I'm not sure how best practice this is or if it is properly cleaned up) it may be an option to set the variable to transient, so it will not be serialized at the end of each request, but will be held in the bean for the duration of each partial refresh.
CXF Webservice issue in weblogic server
I am trying to call a webservice from my webapplication which works fine with servers like Apache Tomcat or JBoss, but fails with below exception in Weblogic server. Any solution for this ? java.lang.ExceptionInInitializerError at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at java.lang.Class.newInstance(Class.java:379) at org.apache.geronimo.osgi.locator.ProviderLocator.getService(ProviderLocator.java:234) at javax.xml.ws.spi.FactoryFinder$3.run(FactoryFinder.java:176) at javax.xml.ws.spi.FactoryFinder.doPrivileged(FactoryFinder.java:220) at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:160) at javax.xml.ws.spi.Provider.provider(Provider.java:43) at javax.xml.ws.Service.<init>(Service.java:35) at com.my.Tpackage.imageSign.FIUsbWebServiceService.<init>(FIUsbWebServiceService.java:40) at com.my.Tpackage.imageSign.SignatureWebServiceClient.getWebServiceResponse(SignatureWebServiceClient.java:32) at com.my.Tpackage.imageSign.MyAction.getMySignatureImage(MyAction.java:47) at com.my.Tpackage.imageSign.MyAction.execute(MyAction.java:28) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) at com.montran.security.SecureRequestProcessor.processActionPerform(SecureRequestProcessor.java:707) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at com.montran.main.action.InheritanceActionServet.process(InheritanceActionServet.java:332) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at com.my.security.ActivityLoggingFilter.doFilter(ActivityLoggingFilter.java:88) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at com.my.security.AuthenticationFilter.doFilter(AuthenticationFilter.java:179) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at com.my.security.InjectionFilter.filter(InjectionFilter.java:453) at com.my.security.InjectionFilter.doFilter(InjectionFilter.java:360) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221) Caused by: javax.xml.ws.WebServiceException: Error creating JAXBContext for W3CEndpointReference. at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:237) at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:232) at java.security.AccessController.doPrivileged(Native Method) at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:232) at com.sun.xml.ws.spi.ProviderImpl.<clinit>(ProviderImpl.java:95) ... 44 more Caused by: javax.xml.bind.JAXBException - with linked exception: [com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions org.w3c.dom.Element is an interface, and JAXB can't handle interfaces. this problem is related to the following location: at org.w3c.dom.Element at public java.util.List com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements.elements at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements com.sun.xml.ws.developer.MemberSubmissionEndpointReference.referenceProperties at com.sun.xml.ws.developer.MemberSubmissionEndpointReference ] at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:263) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:235) at javax.xml.bind.ContextFinder.find(ContextFinder.java:432) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:637) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:584) at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:235) ... 48 more Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions org.w3c.dom.Element is an interface, and JAXB can't handle interfaces. this problem is related to the following location: at org.w3c.dom.Element at public java.util.List com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements.elements at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements com.sun.xml.ws.developer.MemberSubmissionEndpointReference.referenceProperties at com.sun.xml.ws.developer.MemberSubmissionEndpointReference at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:466) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141) at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1163) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145) at sun.reflect.GeneratedMethodAccessor122.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:248) ... 53 more
In your weblogic-application.xml you must define your JAXB-provider to be the one from cxf not the sun reference implementation (com.sun.xml...). Add the following to the mentioned file <prefer-web-inf-classes>true</prefer-web-inf-classes> This leads to reversing the classloading process. So the classes you provide with your war are loaded before the ones from weblogic. EDIT: The Documentation for Provider says: The algorithm used to locate the provider subclass to use consists of the following steps: If a resource with the name of META-INF/services/javax.xml.ws.spi.Provider exists, then its first line, if present, is used as the UTF-8 encoded name of the implementation class. If the $java.home/lib/jaxws.properties file exists and it is readable by the java.util.Properties.load(InputStream) method and it contains an entry whose key is javax.xml.ws.spi.Provider, then the value of that entry is used as the name of the implementation class. If a system property with the name javax.xml.ws.spi.Provider is defined, then its value is used as the name of the implementation class. Finally, a default implementation class name is used. so, if the changing the classloading is not enough add the following <prefer-application-resources> <resource-name>META-INF/services/javax.xml.ws.spi.Provider</resource-name> </prefer-application-resources> to weblogic-application.xml
OpenIDE's Lookup fails with Gephi controller objects
I was able to run the demos just fine and build up a graph builder in my unit tests, but now when I deploy this and run on my local server I get NullPointerExceptions on some but not all of the lookups I call. ProjectController pc = Lookup.getDefault().lookup(ProjectController.class); pc.newProject(); workspace = pc.getCurrentWorkspace(); GraphController gc = Lookup.getDefault().lookup(GraphController.class); GraphModel model = gc.getModel(); Stack trace below: Caused by: java.lang.NullPointerException at com.network.manager.impl.NetworkLayoutManagerImpl.initGraphModel(NetworkLayoutManagerImpl.java:167) at com.network.manager.impl.NetworkLayoutManagerImpl.convertNetworkToGraph(NetworkLayoutManagerImpl.java:49) at com.network.manager.impl.NetworkChartManagerImpl.buildNetworkGEXF(NetworkChartManagerImpl.java:61) at com.network.controller.LoadNetworkControllerImpl.loadNodesAndEdges(LoadNetworkControllerImpl.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328) at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341) at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58) at org.jboss.el.parser.AstValue.invoke(AstValue.java:96) at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87) ... 139 more My GraphController "gc" is what is null in this case, though, I'm able to lookup a ProjectController without issue. Out of curiosity, I added the other controllers I needed (AttributeController and ExportController) and printed them out. (ProjectController --- GraphController --- AttributeController --- ExportController) System.err.println(pc + " --- " + gc + " --- " + ac + " --- " + ec); Gives me the following: org.gephi.project.impl.ProjectControllerImpl#1b819521 --- null --- null --- org.gephi.io.exporter.impl.ExportControllerImpl#3412470a I'm not too familiar with the Lookup API so this is a complete mystery. I'm running this on Tomcat server. Let me know if any more info is needed. There is a similar question posted here and the gephi forums with no response. Streaming Graph to Gephi using toolkit : NullPointerException https://forum.gephi.org/viewtopic.php?t=1599
Lookup depends on files found META-INF/services. It appears that Tomcat isn't finding the ones for GraphController nor AttributeController. There should be files named similarly to how GraphController and AttributeController are imported in your source file.