3 Replies Latest reply on Nov 14, 2008 8:51 AM by manik

    Cannot Marshal velocity template object

    lords_diakonos

      OK SO I have JBoss cache plugged into Velocity. I am getting the following though

      [13/11/08 04:45:21:021 EST] ERROR app.VelocityEngine: Velocimacro : Velocimacro : Error using VM library : dotCMS_library.vm
      org.jboss.cache.CacheException: java.lang.Exception: Don't know how to marshall object of type class org.apache.velocity.Template
       at org.jboss.cache.interceptors.InterceptorChain.invoke(InterceptorChain.java:227)
       at org.jboss.cache.invocation.CacheInvocationDelegate.put(CacheInvocationDelegate.java:480)
       at com.dotmarketing.business.DotJBCacheAdministratorImpl.put(DotJBCacheAdministratorImpl.java:194)
       at com.dotmarketing.velocity.DotResourceCache.put(DotResourceCache.java:113)
       at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:339)
       at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1102)
       at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1077)
       at org.apache.velocity.runtime.VelocimacroFactory.initVelocimacro(VelocimacroFactory.java:196)
       at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:251)
       at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:534)
       at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:144)
       at com.dotmarketing.util.VelocityUtil.init(VelocityUtil.java:17)
       at com.dotmarketing.util.VelocityUtil.getEngine(VelocityUtil.java:26)
       at com.dotmarketing.velocity.VelocityServlet.init(VelocityServlet.java:242)
       at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1172)
       at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:808)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.Exception: Don't know how to marshall object of type class org.apache.velocity.Template
       at org.jboss.cache.marshall.CacheMarshaller200.marshallObject(CacheMarshaller200.java:408)
       at org.jboss.cache.marshall.CacheMarshaller200.marshallCommand(CacheMarshaller200.java:445)
       at org.jboss.cache.marshall.CacheMarshaller200.marshallObject(CacheMarshaller200.java:277)
       at org.jboss.cache.marshall.CacheMarshaller200.marshallCommand(CacheMarshaller200.java:445)
       at org.jboss.cache.marshall.CacheMarshaller200.marshallObject(CacheMarshaller200.java:277)
       at org.jboss.cache.marshall.CacheMarshaller200.objectToObjectStream(CacheMarshaller200.java:161)
       at org.jboss.cache.marshall.CacheMarshaller200.objectToObjectStream(CacheMarshaller200.java:106)
       at org.jboss.cache.marshall.VersionAwareMarshaller.objectToByteBuffer(VersionAwareMarshaller.java:162)
       at org.jboss.cache.marshall.CommandAwareRpcDispatcher.invokeRemoteCommands(CommandAwareRpcDispatcher.java:87)
       at org.jboss.cache.RPCManagerImpl.callRemoteMethods(RPCManagerImpl.java:403)
       at org.jboss.cache.RPCManagerImpl.callRemoteMethods(RPCManagerImpl.java:375)
       at org.jboss.cache.RPCManagerImpl.callRemoteMethods(RPCManagerImpl.java:380)
       at org.jboss.cache.interceptors.BaseRpcInterceptor.replicateCall(BaseRpcInterceptor.java:143)
       at org.jboss.cache.interceptors.BaseRpcInterceptor.replicateCall(BaseRpcInterceptor.java:117)
       at org.jboss.cache.interceptors.BaseRpcInterceptor.replicateCall(BaseRpcInterceptor.java:89)
      


      My question is this; what is the best way for me to handle this?

      Do I need a custom marshaler? if so how does that work in this case?

      Is it that the velocity template isn't serializable? If that is the problem any recommendations? I'd rather not mess with velocity source code if it can be avoided.