While deploying my application to a tomcat server I'm facing following errors:
2013-06-14 07:54:36 ErrorLogger [ERROR] Job (DEFAULT.NearByRioDeJaneiro threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.NoClassDefFoundError: Could not initialize class com.frrole.service.common.OAuthUtil]
at org.quartz.core.JobRunShell.run(JobRunShell.java:224)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.frrole.service.common.OAuthUtil
at com.frrole.service.common.City._getTweetsByQueryObj(City.java:357)
at com.frrole.service.common.City.getTweetsByGeoLocSearch(City.java:340)
at com.frrole.service.api.TwitterSearch.nearbyLocationSearch(TwitterSearch.java:148)
at com.frrole.service.imports.jobs.NearByRioDeJaneiro.execute(NearByRioDeJaneiro.java:14)
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
As it can be observed from this error log the main problem is with tomcat not being able to locate: com.frrole.service.common.OAuthUtil
class. This class is referenced by the method _getTweetsByQueryObj
in class com.frrole.service.common.City
. Hence, somewhere while executing this method, tomcat is unable to locate OAuthUtil class. The OAuthUtil class has proper package statement defined in its code. The application also compiles successfully otherwise ws.war would not have been produced.
The confusing part is that OAuthUtil
class is in same package (and directory) as City
class. Below is a ls
of directory tree in ws directory of tomcat's webapps folder.
root@servicesfrrole3:/usr/tomcat/apache-tomcat-7.0.25/webapps/ws/WEB-INF/classes/com/frrole/service/common# ls -l
total 88
-rw-r--r-- 1 root root 12284 2013-06-14 13:15 City.class
-rw-r--r-- 1 root root 21350 2013-06-14 13:15 DBUtil.class
-rw-r--r-- 1 root root 1064 2013-06-14 13:15 Messages.class
-rw-r--r-- 1 root root 2026 2013-06-14 13:15 OAuthUtil$_AccessToken.class
-rw-r--r-- 1 root root 2741 2013-06-14 13:15 OAuthUtil.class
-rw-r--r-- 1 root root 1710 2013-06-14 13:15 ReTweet.class
-rw-r--r-- 1 root root 1431 2013-06-14 13:15 SQLUtils.class
-rw-r--r-- 1 root root 6397 2013-06-14 13:15 TimeAgo.class
-rw-r--r-- 1 root root 3363 2013-06-14 13:15 Tweet.class
-rw-r--r-- 1 root root 3730 2013-06-14 13:15 TweetUtil.class
-rw-r--r-- 1 root root 5982 2013-06-14 13:15 TweetVO.class
-rw-r--r-- 1 root root 1328 2013-06-14 13:15 TwitterResults.class
-rw-r--r-- 1 root root 1941 2013-06-14 13:15 ViaTweet.class
As it can be observed, clearly there is a OAuthUtil.class residing in the same directory as City.class. The code compiles properly and runs perfectly on localhost which has Java 7 and Tomcat 7.0.40. The server has Java 7 and Tomcat 7.0.25 on server.
While deploying application, I'm simply compiling it on localhost and copying the ws.war file into webapps directory of server followed by rm -r of ws folder from previous application and finally restarting the server.
If anyone has any explanation of what is happening here, please provide some solution.