1 Reply Latest reply on Sep 18, 2012 5:13 AM by Alexander Glintschert

    Error in marshalling functionality with Tomcat6

    Alexander Glintschert Newbie

      Hi,

       

      currently, I upgrade our web application to Errai version 2.0.2. Unfortunately, I ran into a problem I hope someone have a solution or information for.

      We use Tomcat6 as servlet container - installed on a Ubuntu 12.04.1 LTS. It's the standard tomcat installation provided by the Linux distribution.

      Our web application uses GWT 2.4 and SmartGWT 2.5.

       

      We deployed our web application as WAR archive to the tomcat. If we invoke it the application fails to start. We only get the following error message (written to the tomcat log):

       

       

      2012-09-17 16:01:58,636 [80-1] WARN  ErraiMarshalling - could not locate marshaller class. will attempt dynamic generation.
      2012-09-17 16:01:58,653 [80-1] INFO  MarshallerGeneratorFactory - generating marshalling class org.jboss.errai.marshalling.server.impl.ServerMarshallingFactoryImpl...
      2012-09-17 16:01:59,746 [80-1] INFO  MarshallerGeneratorFactory - generated marshalling class in 1092ms.
      java.lang.RuntimeException: could not write file for debug cache
              at org.jboss.errai.common.metadata.RebindUtils.writeStringToFile(RebindUtils.java:229)
              at org.jboss.errai.marshalling.rebind.MarshallerGeneratorFactory.generate(MarshallerGeneratorFactory.java:116)
              at org.jboss.errai.marshalling.server.util.ServerMarshallUtil.getGeneratedMarshallerFactoryForServer(ServerMarshallUtil.java:108)
              at org.jboss.errai.marshalling.server.MappingContextSingleton.loadPrecompiledMarshallers(MappingContextSingleton.java:98)
              at org.jboss.errai.marshalling.server.MappingContextSingleton.<clinit>(MappingContextSingleton.java:78)
              at org.jboss.errai.bus.server.io.MessageFactory.getParts(MessageFactory.java:109)
              at org.jboss.errai.bus.server.io.MessageFactory.createCommandMessage(MessageFactory.java:93)
              at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:117)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
              at com.microdiscovery.dbwebapp.dataviewer.server.communication.DBWebAppServlet.service(DBWebAppServlet.java:28)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
              at java.lang.Thread.run(Thread.java:722)
      Caused by: java.io.FileNotFoundException: /var/lib/tomcat6/.errai/ServerMarshallingFactoryImpl.java (No such file or directory)
              at java.io.FileOutputStream.open(Native Method)
              at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
              at org.jboss.errai.common.metadata.RebindUtils.writeStringToFile(RebindUtils.java:224)
              ... 22 more
      2012-09-17 16:01:59,749 [80-1] ERROR ErraiMarshalling - failed to load static marshallers
      java.lang.RuntimeException: could not write file for debug cache
              at org.jboss.errai.common.metadata.RebindUtils.writeStringToFile(RebindUtils.java:229)
              at org.jboss.errai.marshalling.rebind.MarshallerGeneratorFactory.generate(MarshallerGeneratorFactory.java:116)
              at org.jboss.errai.marshalling.server.util.ServerMarshallUtil.getGeneratedMarshallerFactoryForServer(ServerMarshallUtil.java:108)
              at org.jboss.errai.marshalling.server.MappingContextSingleton.loadPrecompiledMarshallers(MappingContextSingleton.java:98)
              at org.jboss.errai.marshalling.server.MappingContextSingleton.<clinit>(MappingContextSingleton.java:78)
              at org.jboss.errai.bus.server.io.MessageFactory.getParts(MessageFactory.java:109)
              at org.jboss.errai.bus.server.io.MessageFactory.createCommandMessage(MessageFactory.java:93)
              at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:117)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
              at com.microdiscovery.dbwebapp.dataviewer.server.communication.DBWebAppServlet.service(DBWebAppServlet.java:28)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
              at java.lang.Thread.run(Thread.java:722)
      Caused by: java.io.FileNotFoundException: /var/lib/tomcat6/.errai/ServerMarshallingFactoryImpl.java (No such file or directory)
              at java.io.FileOutputStream.open(Native Method)
              at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
              at org.jboss.errai.common.metadata.RebindUtils.writeStringToFile(RebindUtils.java:224)
              ... 22 more
      2012-09-17 16:01:59,750 [80-1] WARN  ErraiMarshalling - failing over to dynamic marshallers ... performance may be affected.
      java.lang.RuntimeException: Error instantiating org.jboss.errai.marshalling.client.marshallers.SQLDateMarshaller
              at org.jboss.errai.marshalling.server.MappingContextSingleton$3.loadMarshallers(MappingContextSingleton.java:233)
              at org.jboss.errai.marshalling.server.MappingContextSingleton$3.<init>(MappingContextSingleton.java:157)
              at org.jboss.errai.marshalling.server.MappingContextSingleton.loadDynamicMarshallers(MappingContextSingleton.java:152)
              at org.jboss.errai.marshalling.server.MappingContextSingleton.<clinit>(MappingContextSingleton.java:84)
              at org.jboss.errai.bus.server.io.MessageFactory.getParts(MessageFactory.java:109)
              at org.jboss.errai.bus.server.io.MessageFactory.createCommandMessage(MessageFactory.java:93)
              at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:117)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
              at com.microdiscovery.dbwebapp.dataviewer.server.communication.DBWebAppServlet.service(DBWebAppServlet.java:28)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
              at java.lang.Thread.run(Thread.java:722)
      Caused by: java.lang.IllegalStateException: Mapping definition collision for java.sql.Date
      Already have: MappingDefinition [mappingClass=java.sql.Date, clientMarshallerClass=class org.jboss.errai.marshalling.client.marshallers.SQLDateMarshaller, serverMarshallerClass=null]
      Attempted to add: MappingDefinition [mappingClass=java.sql.Date, clientMarshallerClass=class org.jboss.errai.marshalling.client.marshallers.SQLDateMarshaller, serverMarshallerClass=null]
              at org.jboss.errai.marshalling.rebind.DefinitionsFactoryImpl.putDefinitionIfAbsent(DefinitionsFactoryImpl.java:119)
              at org.jboss.errai.marshalling.rebind.DefinitionsFactoryImpl.addDefinition(DefinitionsFactoryImpl.java:102)
              at org.jboss.errai.marshalling.server.MappingContextSingleton$3.loadMarshallers(MappingContextSingleton.java:201)
              ... 21 more
      
      

      The reason for the problem is that Errai wants to create an .errai directory directly within the CATALINA_BASE directory of tomcat6. In a valid tomcat6 installation a web application does not have write access to this directory. I changed this temporarily for testing purposes - and the web application runs fine. But this is not a useful solution.

      My question is: what is the strategy that Errai uses to decide which directory to choose for .errai directory creation? Is there a configuration parameter that I could define to change the directory path?

      I searched for an answer to this question in Errai documentation and tried to find information within this forum and using Google - with no results unfortunately.

       

      Thanks in advance for any help.

      Alex.

        • 1. Re: Error in marshalling functionality with Tomcat6
          Alexander Glintschert Newbie

          Hi,

          I found a solution for my problem that works.

          I've searched the Errai source code and detected that Errai creates its cache dir in the working directory of the application (which is $CATALINA_BASE for a tomcat6 installation - normally /var/lib/tomcat6 on a Linux) unless the system property "errai.devel.debugCacheDir" is set and defines another directory. Unfortunately, this property seems not to be described in the Errai documentation. If I define this property via the /etc/default/tomcat6 file by adding "-Derrai.devel.debugCacheDir=/tmp/Errai" to the JAVA_OPTS environment variable, everything works fine after a tomcat restart.

          Now I hope the content of Errai's cache directory is not specific for a web application. Otherwise, it would be necessary to define different cache directories for multiple Errai based web applications. But this would not be possible to achieve with a Tomcat6 (at least as far as I know).

          However, I suggest to change this directory configuration - it should not use a system property but one that can be defined in ErraiApp.properties or ErraiService.properties. At least it would be helpful if this property were described in Errai's documentation.

           

          Greetings,

          Alex.

          1 of 1 people found this helpful