• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Tomcat error when starting website after porting it from different PC

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I need help with an error that I'm seeing when trying to launch a web site.

I had a PC that was running Apache Tomcat v5.x. The web site that was hosted there was working fine but unfortunately, the PC had to be replaced. The new PC is running Windows Server 2012, whereas the old was running Windows Server 2003. I installed apache tomcat 8.0.24 (server). I also installed the latest Java JRE and JDK (1.8.0_60). The old PC was running JDK 1.4.2_04. I should tell you that I don't know much about tomcat nor Java. As far as the website, I just copied the folder from the old webapps directory into the same folder in the new tomcat installation. I don't know if this was the right way to do it.

I start tomcat (C:\apache...\bin\startup.bat) and all appears to start ok. I open a browser window and try to access the website. I get the error in the browser window: HTTP 500 Internal Server Error. In the command prompt where tomcat is running I see the error:

log4j:ERROR No appenders could be found for category (...[classname???]...)
log4j:ERROR Please initialize the log4j system properly.


I'm not sure what the errors mean. This was a website that was working ok on a different PC. It could be that running the new versions of tocat and java is causing them or maybe I didn't copy the website to the new PC correctly.

Does anyone have an idea?

Thanks in advance for you help.

Regards,
LeoA
 
Saloon Keeper
Posts: 23729
161
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
Welcome to the JavaRanch, Leo!

That's just a message from Log4j indicating that it didn't find logging setup information and it's normally harmless. This information is normally specified in the WEB-INF/classes/log4j.properties or log4j.xml file of the webapp.

The "500" error, is another matter. There's no way to tell without further information what failed. You might not have set up a needed database connection pool or something. Usually, that would be recorded in the log, but if logging wasn't properly configured, it's possible that the stacktrace that describes the error could be lost.
 
Leo Ayala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may be correct. The website logs data to an ODBC database. I dint write the website and all of its db access classes. I don't know if the JDBC connections are hardcoded or if they must be configured via the Windows ODBC Manager. I guess I have to search the classes and find out.

Thanks.
LA
 
Sheriff
Posts: 67537
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your first step is to configure logging correctly so that you can see exception stacks. Otherwise you are flying blind.
 
Leo Ayala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any ideas as to how I can configure the logging?

-LA
 
Bear Bibeault
Sheriff
Posts: 67537
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll need to configure Log4J properly. Tim mentioned where.
 
Bear Bibeault
Sheriff
Posts: 67537
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On Windows, doesn't Tomcat automatically log stack traces to the DOS window that started Tomcat? It's been so long since I've run Windows I can't remember.

You might also want to check the logs folder of the Tomcat installation. Usually output is written to catalina.out.
 
Leo Ayala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's the content of log4j.properties file. This file is located in the website's WEF-INF folder (I'm not sure if it matters).

# Set root category priority to DEBUG and its only appender to A1.
log4j.rootCategory=DEBUG, A1, R

# A1 is set to be a ConsoleAppender.
log4j.rootLogger=debug, stdout
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

; log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R=org.apache.log4j.FileAppender
log4j.appender.R.DatePattern='trace-'yyyy-MM-dd'.log'
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.File=qlog4j.log
log4j.appender.R.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

# Print only messages of priority ERROR or above in the package
log4j.category.com.gunderware.application.Globals=ERROR

 
Tim Holloway
Saloon Keeper
Posts: 23729
161
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

Bear Bibeault wrote:On Windows, doesn't Tomcat automatically log stack traces to the DOS window that started Tomcat? It's been so long since I've run Windows I can't remember.

You might also want to check the logs folder of the Tomcat installation. Usually output is written to catalina.out.



If nothing catches an app exception, it percolates out to Tomcat's logger, yes. Of course, if something catches it and writes it to log4j but log4j isn't functioning, that's where things can get lost.

1. Are you sure that the copy of the webapp has proper file access rights to be read by the Tomcat user?

2. Did you deploy the app properly? If your WEB-INF folder is directly under TOMCAT_HOME/webapps, then it's in the wrong place. You need a directory under TOMCAT_HOME/webapps to hold the files from the WAR for that webapp.
 
Leo Ayala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The website folder is located in:

C:\apache-tomcat-8.0.24\webapps\[websitefolder]

I checked the security settings for the folder and the Windows user group Everyone has Full control (all permissions). The log4j.properties file was from C:\apache-tomcat-8.0.24\webapps\[websitefolder]\WEB-INF\log4j.properties

I checked and there is a Logs directory C:\apache-tomcat-8.0.24\logs and there are several log files there. I stopped the tomcat service and deleted the logs. I restarted the tomcat service and it recreated several logs. I checked all of them and none have any errors. However, if I try to open the website, the logfile localhost.2015-09016.log shows an exception pointing to one of the classes.


 
Tim Holloway
Saloon Keeper
Posts: 23729
161
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
The localhost log is where you find errors that could not be written to the catalina.out log. Mostly having to do with issues encountered specific to starting something up.

I'm afraid that the root cause of the problem is a failure of the application to properly anticipate a problem in the environment. Probably a mis-configuration of the app, although it's also possible that differences in Java versions and/or dependencies on obsolete Tomcat functions could be to blame.

Since we don't have source code for the app, at this point you're pretty much on your own The fact that the failing function is on a JSP will probably earn you a Bear Growl, though.
 
Leo Ayala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help and patience. I'll continue looking.

-LA
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic