WAR deploy fails to start

Questions and Answers on installation, deployment, management, locking, tranasactions of Servoy Application Server

Re: WAR deploy fails to start

Postby gk1441607435 » Fri Mar 31, 2017 9:43 pm

Finally that thing works :lol:

I would like to show how I solved it in my case and hope that it helps someone. Unfortunately every installation is different and has a different directory structure. So keep trying and never give up even on a windows.

My tomcat7 is running on a ubunutu server 16.04.2 LTS and was installed over apt-get install. The WAR is build by a Servoy 8.1.2.

While deploying the WAR-file I had the following Error in my log:

Code: Select all
Mär 30, 2017 6:24:48 PM org.apache.catalina.core.StandardContext filterStart
SCHWERWIEGEND: Exception starting filter com.servoy.j2db.server.ngclient.NGClientEntryFilter
java.lang.NullPointerException
   at com.servoy.j2db.server.ngclient.NGClientEntryFilter.init(NGClientEntryFilter.java:122)
   at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
   at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
   at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)....

and

Mär 30, 2017 6:24:51 PM org.apache.catalina.core.StandardContext listenerStop
SCHWERWIEGEND: Exception sending context destroyed event to listener instance of class com.servoy.j2db.server.servlets.WarClientServletContextListener
java.lang.NullPointerException
   at com.servoy.j2db.persistence.ContentSpec.clear(ContentSpec.java:389)
   at com.servoy.j2db.server.servlets.WarClientServletContextListener.contextDestroyed(WarClientServletContextListener.java:170)
   at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5115)


If you have similar errors, please search and check a file called 'catalina.out'. It is somewhere in a log folder around your tomcat installation or in my case in /var/log/tomcat. I guess catalina.out is what tomcat tells you when you start it over a console. A lot of java stuff, what tomcat is doing while startup. It can be quiet big. If it's the right file you can delete it and it starts to log new. But be careful with deleting files when you not sure!!!

So look for an error like this in the catalina.out file ('...' means left out lines):

Code: Select all
Mär 30, 2017 6:24:40 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNUNG: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
Mär 30, 2017 6:24:40 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNUNG: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
Mär 30, 2017 6:24:40 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNUNG: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
Mär 30, 2017 6:24:40 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNUNG: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
Mär 30, 2017 6:24:40 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNUNG: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
Mär 30, 2017 6:24:40 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNUNG: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
...
...
NFORMATION: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
java.io.IOException: Datei oder Verzeichnis nicht gefunden
   at java.io.UnixFileSystem.createFileExclusively(Native Method)
   at java.io.File.createNewFile(File.java:1012)
...
...
Couldn't create server properties file in user.home: /usr/share/tomcat7 directory. Please set a SERVOY_USER_HOME variable (env. variable or java -D... arg) which points to a writable directory.
Mär 30, 2017 6:24:48 PM org.apache.catalina.core.StandardContext startInternal
SCHWERWIEGEND: One or more Filters failed to start. Full details will be found in the appropriate container log file
Mär 30, 2017 6:24:48 PM org.apache.catalina.core.StandardContext startInternal
SCHWERWIEGEND: Context [/Menuplanner] startup failed due to previous errors
...
...


On the bottom you see the line 'Couldn't create server properties file in user.home: /usr/share/tomcat7 directory. Please set a SERVOY_USER_HOME variable...'. That's the actual problem. Tomcat can't write in the /usr/share/tomcat7 directory. A naive way would be to give tomcat access to that folder. I guess it's o.k. in a non-production environment to see if that is the only problem, but it's a security hole. So don't do that. Do as suggested and set the SERVOY_USER_HOME variable!

But that was the task where I bit my teeth out. It took me hours! I hope you are faster.

I tried to set it directly with 'export SERVOY_USER_HOME=/var/lib/tomcat/user_home' and changed many files around tomcat. Nothing worked. You can google a bit for 'set tomcat environment variable. Maybe you find a good solution for you.
A way could be to set an setenv script described here: https://tomcat.apache.org/tomcat-7.0-doc/RUNNING.txt (did't work for me)

The only thing that worked for me, was to set a java -D argument. After hours I found a file in /etc/default called tomcat7. I changed:

Code: Select all
JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC"


to

Code: Select all
JAVA_OPTS="-Djava.awt.headless=true -DSERVOY_USER_HOME=/var/lib/tomcat7/user_home -Xmx128m -XX:+UseConcMarkSweepGC"


and created a directory user_home there and gave tomcat read and write access. Be careful when changing such file and make a backup before you do it. In a stand-alone installation the file /etc/default/tomcat7 could be catalina.sh or catalina.bat located in the bin directory. Check out that for JAVA_OPTS.

After a restart everything was o.k. and I could finally deploy my WAR-file.


Thanks to Johan again to bring me on the right way!

Greetings Gregory
gk1441607435
 
Posts: 14
Joined: Mon Sep 07, 2015 8:30 am

Re: WAR deploy fails to start

Postby huber » Thu Oct 17, 2019 9:32 am

This thread was a great help, as we had with Tomcat 9 the same problem and could solve it. Thanks!
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 516
Joined: Mon May 14, 2012 11:31 pm

Previous

Return to Servoy Server

Who is online

Users browsing this forum: No registered users and 2 guests