WAR deployment problems

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

Re: WAR deployment problems

Postby Andrei Costescu » Wed Oct 28, 2015 5:54 pm

:) Have fun writing the tutorial.
But I am curious. Is it something that Servoy can improve or did you make some unexpected step (change permissions) that others might not make (and it would work from them at first trial)?

I expected SERVOY_USER_HOME to work as well if it's set at shell level (environment variable) or even if it would have been an exported shell script variable from some script that runs tomcat ('export ...')
But I didn't test this though. -D... is just to make sure only that java process sees it as a 'system property'.

It is mentioned in wiki "If {user.home} is a read-only folder, then a SERVOY_USER_HOME system variable must be defined to point to a writable folder." JAVA_OPTS is a Tomcat thing, although I am sure other war containers would have a similar thing.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 907
Joined: Tue Jun 26, 2007 3:14 pm

Re: WAR deployment problems

Postby steve1376656734 » Wed Oct 28, 2015 6:11 pm

I think the problem comes from following a tutorial on installing Tomcat 8 on Centos 6. Tomcat 8 is not available as a standard yum install for Centos 6 so you need to install it manually and it looks like there is room for improvement (some glaring errors!) in the tutorial I followed :).

I think the only improvement I could suggest is trying to get Tomcat to write to it's own log if you cannot create the servoy log. In my particular situation it would have been so much easier if the error had been in the Tomcat log and would have saved a few hours of frustration (and a lot of your time!). Not sure how feasible this would be though.

The other suggestions I could make are:
[list=]Put a little more explanation in the wiki regarding the SERVOY_USER_HOME variable. I did try setting it as an exported shell variable but that did not seem to work. It was only when I defined it in the JAVA_OPTS string that it seemed to do anything. Not sure if this is a Tomcat specific problem but definitely worth a mention I think.[/list]
[list=]Expand the Troubleshooting section with suggestions on how to trace the issues, enable debugging options etc.[/list]

If I think if anything else as I go along I'll start a new thread. In fact a new section in the forum relating to the Wiki/Documentation might be a good idea as well.

Once again many thanks for your assistance, I think I would have torn out what little of my hair is left by now without your help.
Steve
SAN Developer
steve1376656734
 
Posts: 180
Joined: Fri Aug 16, 2013 2:38 pm
Location: Lanzarote

Re: WAR deployment problems

Postby steve1376656734 » Wed Oct 28, 2015 6:12 pm

Mmmm - not sure the numbered list bit is working as it should!
Steve
SAN Developer
steve1376656734
 
Posts: 180
Joined: Fri Aug 16, 2013 2:38 pm
Location: Lanzarote

Re: WAR deployment problems

Postby Andrei Costescu » Wed Oct 28, 2015 6:39 pm

Ok. The -D.. thing is mentioned in wiki now.
We'll see what we can do about dumping something to the container log file if the servoy log cannot be created.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 907
Joined: Tue Jun 26, 2007 3:14 pm

Re: WAR deployment problems

Postby Gordon McLean » Thu Oct 29, 2015 10:01 am

Steve
Writing a tutorial or similar would be very very much appreciated, great idea !!

Gordon
Gordon McLean
Clickdigital.com
Gordon McLean
 
Posts: 191
Joined: Wed Aug 03, 2005 12:24 pm
Location: UK

Re: WAR deployment problems

Postby jcompagner » Fri Nov 06, 2015 6:32 pm

steve1376656734 wrote:
It may also be worth mentioning the SERVOY_USER_HOME property in the wiki and stating that it should be set in the java options as being a Unix bod an environment variable is set at the shell level not the Java level!



https://wiki.servoy.com/display/DOCS/WAR+Deployment

there the SERVOY_USER_HOME is quite explained. (that it is a java system property)
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 7978
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: WAR deployment problems

Postby Gordon McLean » Tue Aug 09, 2016 12:26 pm

Hi
I am having the same issues as Steve describes here trying to install Servoy 7 on a Tomcat instance within a Docker Container.

I have added the SERVOY_USER_HOME variable and used both /home and /usr/local/tomcat both of which have had 777 permissions set with chmod. ( I hasten to add this is all running locally at the moment)

I have re deployed the war which has created the solution folder however it has not apparently created the .servoy folder or a log file ??

Can you clarify where the SERVOY_USER_HOME directly should be located, how this is set ? I am guessing its in the Tomcat defaults along with CATALINA_HOME etc

I suspect the issues here are permissions related and the fact I can not find a .servoy file is the problem but without a log of any sort I am a bit stuck. The console is reporting the following none of which appears to be pointing at an inability to write .servoy

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:745)
09-Aug-2016 10:15:29.253 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesRmiTargets Found RMI Target with stub class class [sun.rmi.registry.RegistryImpl_Stub] and value [RegistryImpl_Stub[UnicastRef2 [liveRef: [endpoint:[127.0.0.1:1099,com.servoy.j[email protected]6f48db18,com.servoy.j[email protected]268427](local),objID:[0:0:0, 0]]]]]. This RMI Target has been forcibly removed to prevent a memory leak.
09-Aug-2016 10:16:19.304 INFO [localhost-startStop-3] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /usr/local/tomcat/webapps/clipper.war
09-Aug-2016 10:16:30.462 INFO [localhost-startStop-3] org.apache.jasper.servlet.TldScanner.scanJars 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.
09-Aug-2016 10:16:30.904 INFO [localhost-startStop-3] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /usr/local/tomcat/webapps/clipper.war has finished in 11,600 ms
Gordon McLean
Clickdigital.com
Gordon McLean
 
Posts: 191
Joined: Wed Aug 03, 2005 12:24 pm
Location: UK

Re: WAR deployment problems

Postby steve1376656734 » Tue Aug 09, 2016 12:56 pm

Hi Gordon,

After a lot of experimenting with WAR deployments the best advice I can give you is to make sure that the user that is running the Tomcat process has write access to their own home directory. This sounds a little obvious but when I followed some internet tutorials to install the Tomcat server you end up creating the directory as the root user but then add a new user to the system to run the Tomcat process and set the directory you created as root to be the home directory. The Tomcat user then does not have write access to their own home directory but the Tomcat server will run without problems - until you try to deploy a Servoy WAR!

The SERVOY_USER_HOME variable can be used to override the default home directory and can be set in one of two ways. The first is by adding it as a parameter to the JVM directly or by adding it to the JAVA_OPTS string in the Tomcat startup script. The format is -DSERVOY_USER_HOME=yourdir.

Since setting the permissions correctly on the all the directories I have not had to use the SERVOY_USER_HOME variable at all.

Hope this helps
Steve
Steve
SAN Developer
steve1376656734
 
Posts: 180
Joined: Fri Aug 16, 2013 2:38 pm
Location: Lanzarote

Re: WAR deployment problems

Postby Gordon McLean » Tue Aug 09, 2016 1:16 pm

Hi Steve, I am certain your dead right about the permissions and the tomcat user. The problem is I am using a docker container which is a bit peculiar in that it appear to be a super cut down version of linux with one process Tomcat and only a root user. Its apparently working i.e. you can see the default home page. I will go and investigate how Tomcat gets to be a user and where its home is located as currently its suggesting CATALINA_HOME is /usr/local/tomcat which I have already given max permissions

thanks again for your input I will post my findings if any

Gordon
Gordon McLean
Clickdigital.com
Gordon McLean
 
Posts: 191
Joined: Wed Aug 03, 2005 12:24 pm
Location: UK

Re: WAR deployment problems

Postby Gordon McLean » Tue Aug 09, 2016 1:25 pm

Steve

Can I just be really clear about the user here. Are you talking about the TOMCAT user as set in /usr/local/tomcat/conf/ which is by default blank and affect the Tomcat management page OR the linux user that Tomcat is logged in as which as far as I can see is ROOT so should have permissions ??

Cheers
Gordon
Gordon McLean
Clickdigital.com
Gordon McLean
 
Posts: 191
Joined: Wed Aug 03, 2005 12:24 pm
Location: UK

Re: WAR deployment problems

Postby steve1376656734 » Tue Aug 09, 2016 4:34 pm

The linux Tomcat user. It is not best practice to run the Tomcat process as root so I always have a specific user for it (called tomcat and in the group tomcat). If your process is genuinely running as root then you shouldn't have any permission issues but I would also check the Tomcat startup script as this often sets the user that Tomcat will run as.

Steve
Steve
SAN Developer
steve1376656734
 
Posts: 180
Joined: Fri Aug 16, 2013 2:38 pm
Location: Lanzarote

Re: WAR deployment problems

Postby Gordon McLean » Wed Aug 10, 2016 11:02 am

Steve, thanks for your help much appreciated

Interesting developments on this which Servoy may want to consider:

1) I have installed two war deployments one in Servoy 8 and the other Servoy 7. The Servoy 8 version correctly adds .servoy folder to the /root directory where this version of Tomcat is running, this however does not happen with Servoy 7.

2) Accepting this should not be running as root, I have however experimented with the /root folder and version setting 777 privileges to /root so there is no way that Tomcat has a permissions issue as a) its root and b) the target home is 777 enabled

What is really hard to understand is why the Servoy war deployment would differ from one version to the other and why both fail to function with the 'official' version of Tomcat in a container ? this would appear to be the benchmark version with no tweaks. The fact the container runs as root may well be bad idea for Tomcat, however it does mean there is less likelihood of a permissions issue preventing this from running

so all in all no progress made yet :(

Cheers
Gordon
Gordon McLean
Clickdigital.com
Gordon McLean
 
Posts: 191
Joined: Wed Aug 03, 2005 12:24 pm
Location: UK

Re: WAR deployment problems

Postby Gordon McLean » Wed Aug 10, 2016 11:05 am

The other worry development on this is this terminal message

10-Aug-2016 08:51:45.599 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [funky] appears to have started a thread named [acceptor-0.0.0.0/0.0.0.0:1099] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.net.PlainSocketImpl.socketAccept(Native Method)
java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
java.net.ServerSocket.implAccept(ServerSocket.java:530)
java.net.ServerSocket.accept(ServerSocket.java:498)
com.sebster.tunnel.socket.ServerSocketSocketAcceptor.accept(ServerSocketSocketAcceptor.java:8)
com.sebster.tunnel.impl.c.run(c.java:5)
java.lang.Thread.run(Thread.java:745)
10-Aug-2016 08:51:45.601 SEVERE [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesRmiTargets Found RMI Target with stub class class [sun.rmi.registry.RegistryImpl_Stub] and value [RegistryImpl_Stub[UnicastRef2 [liveRef: [endpoint:[127.0.0.1:1099,com.servoy.j[email protected]22d859fe,com.servoy.j[email protected]268427](local),objID:[0:0:0, 0]]]]]. This RMI Target has been forcibly removed to prevent a memory leak.

These two being the key issues:

The web application [funky] appears to have started a thread named [acceptor-0.0.0.0/0.0.0.0:1099] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:

This RMI Target has been forcibly removed to prevent a memory leak.

I have opened the port 1099 to the host and it should be accepting traffic so I am not seeing why this should be a problem bit I guess shutting it down altogether would be a probably cause of issues
Gordon McLean
Clickdigital.com
Gordon McLean
 
Posts: 191
Joined: Wed Aug 03, 2005 12:24 pm
Location: UK

Re: WAR deployment problems

Postby jcompagner » Wed Aug 10, 2016 4:51 pm

Not sure in what version you get that leak stuff (that tomcat checks) but in the latest releases of servoy we tried to clean up as much as possible when the WAR is undeployed (so when you redeploy the war on a running tomcat)

If you use smart clients then you have to start the rmi port (that will leak no matter what some stuff as far as i know that can't be fixed by servoy)
if you don't use smart clients then do turn of the rmi port when exporting the WAR

I don't know what the difference could be between servoy 7 or 8, i think both should just make that dir at the moment it needs it. But running it at root is not the best thing.
I guess in this situation the best thing to do is define the -DSERVOY_USER_HOME= to point to a /xxx/yyy writable dir for tomcat
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 7978
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: WAR deployment problems

Postby Gordon McLean » Thu Aug 11, 2016 1:06 pm

Firstly thanks to both of you @johan and @steve for your help, I have now at least got to a point where I can see the admin even if the solutions won't at this stage run.

@johan
As you suggest I have turned off the RMI port but will review this now the solution is running as it would appear to be a warning and not a show stopper

The difference between 7 and 8 is 7 will not make the .servoy directory or appears unable, whereas 8 will and if you install 8 first then 7 will install using .servoy folder created by 8. Interestingly it creates the servoy_log.txt and servoy_server.properties files but does not write anything to them nor does Servoy when running. Servoy 8 creates import.ser, servoy_log.txt, servoy_server.properties and solution.servoy all of which have the same permissions as 7 and are written to.

As you both mentioned not running Tomcat as root I looked into why the Docker Containers would do this. it appears that the way the docker containers work is encapsulated in their own space. As a consequence they are effectively running chroot'd in their own space hence only have access within the container that has no other features. I will however try to get this to run as tomcat as @steve suggested.

This whole exercise was started to get Docker to run Servoy which is partially has. The reason for this is I like the idea of having a local Tomcat server running in a contained space that can be used for development and once working pushed live onto Amazon Elastic Cloud without alteration. It also makes working with other developers significantly easier as each of us have effectively the same matched solution.

Thanks again for your help, I hope to soon have a working containerised version of servoy on the cloud serving customers

Best
Gordon
Gordon McLean
Clickdigital.com
Gordon McLean
 
Posts: 191
Joined: Wed Aug 03, 2005 12:24 pm
Location: UK

PreviousNext

Return to Servoy Server

Who is online

Users browsing this forum: No registered users and 1 guest