Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Webapp working with startup.bat but not with service.bat

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

I've got this tomcat 7 installation under windows 2008 server. I have a strange behaviour:

This WebApp called SAIKU, works ok if I run the server by executing the startup.bat script. However, if I install tomcat as a service, with service.bat install, the web app is not working. Just shows a blank screen.

Can any one help me troubleshoot this problem? What can be different when running the service with this 2 different methods?

Thanks.

 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One thing potentially is that running as a windows service can run it as a different user.
Your user has permissions/environment variables necessary to execute, whereas the one for the service does not.

- Open the "services: control panel
- Double click your Tomcat service
- check the "Log On" tag settings.

I would also suggest checking the catalina log files to see if Tomcat started up successfully.
It should have some messages in there if things failed to start up which can guide you in troubleshooting.


 
Jack Casas
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the answer. Actually the service user is one of the first things I checked; I'm using the same user I run startup.bat with.

One interesting error I found in the logs is:

Error... Caused by: java.io.FileNotFoundException: C:\saiku\tomcatserver\..\..\repository\configuration.xml

Indeed there is no repository folder in my root c: folder. I can't understand why even when all the files in tomcat's folder are the same, it's looking for the configuration.xml file in the wrong place when running as a windows service, and it works allright when I run with startup.bat

Any ideas?


UPDATE: Well, it turns out that I ran tomcat7w.exe and set the working path to "C:\saiku\tomcatserver\work" in my case. This fixed all the problems I was having.

 
Saloon Keeper
Posts: 25466
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is extremely unsafe to code relative paths in things (especially within webapps) in a webapp environment. The concept of "current/working directory" does not exist there, therefore you don't know what the path is relative to or when it may change.

To a degree, relative paths are safe in the server.xml file, which assumes relative to the Tomcat root directory, but I prefer to be safe and use absolute paths.

One thing you should NOT do, however, is install permanent files in the Tomcat work directory. That directory can be completely emptied out for any number of reasons and there goes your "permanent" file. Same problem as people get when writing files into their WARs. Also, the tomcat temp directory is the base work directory used by java.io.File/mktempfile(), and it can be relocated via Tomcat environmental settings, which could throw any co-dependencies out of whack if you have more than one "permanent" file in there.

 
Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a tiny ad.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic