You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nancy Crisostomo Martinez <na...@correo.uqroo.mx> on 2001/07/17 02:03:35 UTC

Applet-Servlet communication using Tomcat-Apache cooperation

Hi everybody!!

I'm new using Tomcat, instead I'm new developing web applications, so I
need help and patient...
I'm trying to make a applet-servlet communication thru Apache-Tomcat
cooperation.

Before I tried it with a Blazix web server, but it was just for tests,
because the web server was installed locally in a PC.. and it works
perfect and I got the Applet-Servlet communication.

Now, I'm trying to do the same with Apache-Tomcat installed in a Solaris
Server, and I had been trying that communication for days and I can't
yet.

I'm trying to make an application that can solve a educational
situation, like registration of subjects in my database (Oracle).
In this case the Applet only is used like an interface for the user. The
user can register a new subject thru the Applet, then the Applet send an
object to the Servlet thru a serializable class (Ubc.class) [all this
using ObjectInputStream and ObjectOutputStream classes]. The Servlet
recieve the Ubc object and interpret it from register all data like a
field in a table of the database.
Anyway, if the user only want to see all the list of subjects, the
Applet sends the url of the Servlet next to a parameter (UserOption =
"Display") and the servlet recieve the parameter and make a vector with
Ubc objects filling them with the database information and finally the
Servlet sends the vector with a writeObject method to the Applet, whose
displays the information in the screen. And that's all!!.

So, in Tomcat I create the next stucture:
tomcat-directory/webapps/proyectoprueba2/WEB-INF/classes/
---in classes directory store the servlet classes and the ubc.class

in Apache I did this:
apache-directory/htdocs/proyectoprueba2/
---in proyectoprueba2 directory store the html file that invokes the
applet class, of course, I store the applet class, and the ubc.class.

Now I invoke the html file and it works very well, but when I tried to
register a subject invoking the servlet thru the applet, I only got an
error:
       Error: 500
       Location: /proyectoprueba2/servlet/Servlet3
       Internal Servlet Error:

         java.lang.NullPointerException
         at java.lang.ClassLoader.resolveClass0(Native Method)
         at java.lang.ClassLoader.resolveClass0(Compiled Code)
         at java.lang.ClassLoader.resolveClass(Compiled Code)
         at
org.apache.tomcat.loader.AdaptiveClassLoader.loadClass(Compiled Code)
         at
org.apache.tomcat.loader.AdaptiveServletLoader.loadClass(AdaptiveServletLoader.java:174)

         at org.apache.tomcat.core.ServletWrapper.loadServlet(Compiled
Code)
         at org.apache.tomcat.core.ServletWrapper.init(Compiled Code)
         at org.apache.tomcat.core.Handler.service(Handler.java:254)
         at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)

         at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
         at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)

         at org.apache.tomcat.service.TcpWorkerThread.runIt(Compiled
Code)
         at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(Compiled Code)
         at java.lang.Thread.run(Compiled Code)


All the classes I did are part of a proyectoprueba2 package, so I had to
create the directory...
Where do I have put the Ubc class in Tomcat??
I'm working with Tomcat in a stand alone mode. Do I need to connect it
with Apache?? HOW???
I had been testing other servlets that are like "HelloWorld"... they
only print a text.. and they works perfect with Tomcat...

Can you help me???
I'll be waiting for your help....
Thank you advanced..

Nancy.