Problem with java.lang.ClassNotFoundException only when deployed

2008-09-19 Thread Keith

Hi all,

First off, I am a new user and have built a very simple application.
It works fine under hosted mode.  It compiles with no errors.  When I
deploy it to the web server and point a browser at it, it throws a
ClassNotFoundException.  I suspect this is a really simple problem
(probably caused by a really stupid error).  This is driving me crazy
and I would really appreciate ANY help or suggestions anyone could
throw my way.

I have included a lot of error logs, copies of web.xml, directory
structures etc. below.

Trying to work through this is a learning experience, but I am
stumped.  The fact that the server is able to sort out the URL sent
from the client enough to know the name of the object is
ca.KeithFuller.server.CorpusServiceImpl suggests to me that the server
is finding the web.xml file, which suggests that it should be able to
find the object since I believe that WEB-INF/classes is always on the
search path.  The file CorpusServiceImpl.class is in WEB-INF/classes,
and the corresponding java file starts with:

package ca.KeithFuller.server;

import java.util.*;  // for Scanner
import java.io.*;// for println

import ca.KeithFuller.client.CorpusSearchReturns;
import ca.KeithFuller.client.CorpusSearchService;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class CorpusServiceImpl extends RemoteServiceServlet
implements CorpusSearchService
{
...

A whole pile of details follow:

I use GWT 1.4.61

I use Eclipse 3.2.2

My webserver uses Linux, Tomcat and Apache.

I use FireFox 3.0.1 and the URL is 
http://www.keithfuller.ca:9108/CorpusSearch/CorpusSearch.html

The client code contains:
...
// Create the proxy object
final CorpusSearchServiceAsync serviceProxy =
(CorpusSearchServiceAsync) 
GWT.create(CorpusSearchService.class);

// Cast the proxy object to ServiceDefTarget
String serviceUrl = GWT.getModuleBaseURL() + corpus-search;
//  if (GWT.isScript()){
//  serviceUrl = /corpus-search;
//  }

((ServiceDefTarget)serviceProxy).setServiceEntryPoint(serviceUrl);
...



The localhost.2008-09-18.log file contains:
Sep 18, 2008 10:21:04 AM org.apache.catalina.core.ApplicationContext
log
INFO: Marking servlet corpus-search as unavailable
Sep 18, 2008 10:21:04 AM org.apache.catalina.core.ApplicationContext
log
SEVERE: Error loading WebappClassLoader
  delegate: false
  repositories:
/WEB-INF/classes/
-- Parent Classloader:
[EMAIL PROTECTED]
 ca.KeithFuller.server.CorpusServiceImpl
java.lang.ClassNotFoundException:
ca.KeithFuller.server.CorpusServiceImpl
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1362)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1208)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:
1068)
at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:
791)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
127)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
174)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
117)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
108)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
151)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
874)
at org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:
665)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:
528)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:
81)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)
Sep 18, 2008 10:21:04 AM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Allocate exception for servlet corpus-search
java.lang.ClassNotFoundException:
ca.KeithFuller.server.CorpusServiceImpl
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1362)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1208)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:
1068)
at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:
791)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
127)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
174)
 

Re: Problem with java.lang.ClassNotFoundException only when deployed

2008-09-19 Thread gregor

Hi Keith,

Looking at your deployment structure:

The web server has the directory structure:
apache-tomcat-5.5.25/webapps
CorpusSearch
... a pile of html, rpc, js, html, css, and...
web.xml
WEB-INF
classes
CorpusSearch.class
CorpusSearchReturns.class
CorpusSearchServiceAsync.class
CorpusSearchData.class
CorpusSearchService.class
CorpusServiceImpl.class
web.xml
lib
gwt-servlet.jar
web.xml

the package structure ca.KeithFuller.server seems to be missing which
would explain why you get a ClassNotFoundException for
ca.KeithFuller.server.CorpusServiceImpl. I think you should copy the
entire directory structure under WEB-INF\classes.

Also I would recommend you take a little time to make an Ant build
script that creates a WAR file for you application and copies it
straight to your Tomcat deployment directory where it will
automatically redeploy. This will kill problems like this (because Ant
doesn't make mistakes) and save you a lot of time in the long run.
There are lots of examples of how to do this in the group - just
search for ant build WAR.

regards
gregor




On Sep 18, 4:40 pm, Keith [EMAIL PROTECTED] wrote:
 Hi all,

 First off, I am a new user and have built a very simple application.
 It works fine under hosted mode.  It compiles with no errors.  When I
 deploy it to the web server and point a browser at it, it throws a
 ClassNotFoundException.  I suspect this is a really simple problem
 (probably caused by a really stupid error).  This is driving me crazy
 and I would really appreciate ANY help or suggestions anyone could
 throw my way.

 I have included a lot of error logs, copies of web.xml, directory
 structures etc. below.

 Trying to work through this is a learning experience, but I am
 stumped.  The fact that the server is able to sort out the URL sent
 from the client enough to know the name of the object is
 ca.KeithFuller.server.CorpusServiceImpl suggests to me that the server
 is finding the web.xml file, which suggests that it should be able to
 find the object since I believe that WEB-INF/classes is always on the
 search path.  The file CorpusServiceImpl.class is in WEB-INF/classes,
 and the corresponding java file starts with:

 package ca.KeithFuller.server;

 import java.util.*;                              // for Scanner
 import java.io.*;                                // for println

 import ca.KeithFuller.client.CorpusSearchReturns;
 import ca.KeithFuller.client.CorpusSearchService;

 import com.google.gwt.user.server.rpc.RemoteServiceServlet;

 public class CorpusServiceImpl extends RemoteServiceServlet
 implements CorpusSearchService
 {
 ...

 A whole pile of details follow:

 I use GWT 1.4.61

 I use Eclipse 3.2.2

 My webserver uses Linux, Tomcat and Apache.

 I use FireFox 3.0.1 and the URL 
 ishttp://www.keithfuller.ca:9108/CorpusSearch/CorpusSearch.html

 The client code contains:
 ...
                 // Create the proxy object
                 final CorpusSearchServiceAsync serviceProxy =
                         (CorpusSearchServiceAsync) 
 GWT.create(CorpusSearchService.class);

                 // Cast the proxy object to ServiceDefTarget
                 String serviceUrl = GWT.getModuleBaseURL() + corpus-search;
 //              if (GWT.isScript()){
 //                      serviceUrl = /corpus-search;
 //              }
                 
 ((ServiceDefTarget)serviceProxy).setServiceEntryPoint(serviceUrl);
 ...

 The localhost.2008-09-18.log file contains:
 Sep 18, 2008 10:21:04 AM org.apache.catalina.core.ApplicationContext
 log
 INFO: Marking servlet corpus-search as unavailable
 Sep 18, 2008 10:21:04 AM org.apache.catalina.core.ApplicationContext
 log
 SEVERE: Error loading WebappClassLoader
   delegate: false
   repositories:
     /WEB-INF/classes/
 -- Parent Classloader:
 [EMAIL PROTECTED]
  ca.KeithFuller.server.CorpusServiceImpl
 java.lang.ClassNotFoundException:
 ca.KeithFuller.server.CorpusServiceImpl
         at
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
 1362)
         at
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
 1208)
         at
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:
 1068)
         at
 org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:
 791)
         at
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
 127)
         at
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
 174)
         at
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
 127)
         

Re: Problem with java.lang.ClassNotFoundException only when deployed

2008-09-19 Thread Keith Fuller

Hi Gregor,

Yup, that fixed it.  Stupid newbie error - fortunately the sort of
error that only gets made once.  Now I can start putting back in the
server functionality that I took out to debug it.

Thank you very much for your help,

Keith

On Fri, Sep 19, 2008 at 7:45 AM, gregor [EMAIL PROTECTED] wrote:

 Hi Keith,

 Looking at your deployment structure:

 The web server has the directory structure:
 apache-tomcat-5.5.25/webapps
CorpusSearch
... a pile of html, rpc, js, html, css, and...
web.xml
WEB-INF
classes
CorpusSearch.class
CorpusSearchReturns.class
CorpusSearchServiceAsync.class
CorpusSearchData.class
CorpusSearchService.class
CorpusServiceImpl.class
web.xml
lib
gwt-servlet.jar
web.xml

 the package structure ca.KeithFuller.server seems to be missing which
 would explain why you get a ClassNotFoundException for
 ca.KeithFuller.server.CorpusServiceImpl. I think you should copy the
 entire directory structure under WEB-INF\classes.

 Also I would recommend you take a little time to make an Ant build
 script that creates a WAR file for you application and copies it
 straight to your Tomcat deployment directory where it will
 automatically redeploy. This will kill problems like this (because Ant
 doesn't make mistakes) and save you a lot of time in the long run.
 There are lots of examples of how to do this in the group - just
 search for ant build WAR.

 regards
 gregor




 On Sep 18, 4:40 pm, Keith [EMAIL PROTECTED] wrote:
 Hi all,

 First off, I am a new user and have built a very simple application.
 It works fine under hosted mode.  It compiles with no errors.  When I
 deploy it to the web server and point a browser at it, it throws a
 ClassNotFoundException.  I suspect this is a really simple problem
 (probably caused by a really stupid error).  This is driving me crazy
 and I would really appreciate ANY help or suggestions anyone could
 throw my way.

 I have included a lot of error logs, copies of web.xml, directory
 structures etc. below.

 Trying to work through this is a learning experience, but I am
 stumped.  The fact that the server is able to sort out the URL sent
 from the client enough to know the name of the object is
 ca.KeithFuller.server.CorpusServiceImpl suggests to me that the server
 is finding the web.xml file, which suggests that it should be able to
 find the object since I believe that WEB-INF/classes is always on the
 search path.  The file CorpusServiceImpl.class is in WEB-INF/classes,
 and the corresponding java file starts with:

 package ca.KeithFuller.server;

 import java.util.*;  // for Scanner
 import java.io.*;// for println

 import ca.KeithFuller.client.CorpusSearchReturns;
 import ca.KeithFuller.client.CorpusSearchService;

 import com.google.gwt.user.server.rpc.RemoteServiceServlet;

 public class CorpusServiceImpl extends RemoteServiceServlet
 implements CorpusSearchService
 {
 ...

 A whole pile of details follow:

 I use GWT 1.4.61

 I use Eclipse 3.2.2

 My webserver uses Linux, Tomcat and Apache.

 I use FireFox 3.0.1 and the URL 
 ishttp://www.keithfuller.ca:9108/CorpusSearch/CorpusSearch.html

 The client code contains:
 ...
 // Create the proxy object
 final CorpusSearchServiceAsync serviceProxy =
 (CorpusSearchServiceAsync) 
 GWT.create(CorpusSearchService.class);

 // Cast the proxy object to ServiceDefTarget
 String serviceUrl = GWT.getModuleBaseURL() + corpus-search;
 //  if (GWT.isScript()){
 //  serviceUrl = /corpus-search;
 //  }
 
 ((ServiceDefTarget)serviceProxy).setServiceEntryPoint(serviceUrl);
 ...

 The localhost.2008-09-18.log file contains:
 Sep 18, 2008 10:21:04 AM org.apache.catalina.core.ApplicationContext
 log
 INFO: Marking servlet corpus-search as unavailable
 Sep 18, 2008 10:21:04 AM org.apache.catalina.core.ApplicationContext
 log
 SEVERE: Error loading WebappClassLoader
   delegate: false
   repositories:
 /WEB-INF/classes/
 -- Parent Classloader:
 [EMAIL PROTECTED]
  ca.KeithFuller.server.CorpusServiceImpl
 java.lang.ClassNotFoundException:
 ca.KeithFuller.server.CorpusServiceImpl
 at
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
 1362)
 at
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
 1208)
 at
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:
 1068)
 at