You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andrew Bubnic <an...@channelmarketing.com.au> on 2006/05/02 09:05:06 UTC

RE: Applet sharing utility class with Servlet - Solution..

I didn't even realise that the JDBC drivers I was using in the servlet
(previously applet) resided in the main and visible webapps folder in
the Applet code base - in the code base, but not jar'd with the applet. 

A simple Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver")
from the servlet, was able to retrieve the class from the applet
codebase area.

There you go. Too bad I've already modified my design.


-----Original Message-----
From: Andrew Bubnic [mailto:andrew@channelmarketing.com.au] 
Sent: Tuesday, 02 May 2006 01:48 PM
To: Tomcat Users List
Subject: RE: Applet sharing utility class with Servlet

Thanks for the quick reply. Looks like I'm keeping two copies.. serves
me right for making my own storage objects for niceness.

-----Original Message-----
From: Jess Holle [mailto:jessh@ptc.com] 
Sent: Tuesday, 02 May 2006 12:06 PM
To: Tomcat Users List
Subject: Re: Applet sharing utility class with Servlet

This is a "feature" of the servlet spec.

To use a class from both client and server you're forced to have 
multiple copies of it in your web app -- or alternatively to do 
non-standard adjustments to the web app loader / classpath.

If you don't have too many of these copy cases, I advise just having 
your build process produce the necessary copies.

Unfortunately, some of us have *lots* of these cases.  The lack of a 
"common" area which is accessible to client and server classloaders is a

very unfortunate gap in the servlet spec in this case.

Andrew Bubnic wrote:
> Hi guys, hoping someone has an answer to this:
>
> I have a servlet and an applet running in the same webapp. The servlet
> needs to access a class the applet .jar contains. The applet is
visible
> to the browser.
>
> Problem is: I need to access this applet utility class (or it could be
> any class really, outside the WEB-INF folder but inside the current
> webapp) from the servlet. I don't want to actually access the running
> applet on the user's end, just the .class on the server webapp (so I
can
> instantiate it etc). I also don't want to have to keep a copy of this
> utility class with the servlet class as a work-around as it's rather
> inelegant.
>
> I have heard you can modify web.xml in the webapp\WEB-INF folder to
> allow access to any .class/.jar in the current webapp but I haven't
been
> able to find how to do this.
>
> If you have any ideas or leads about this problem, please let us know.
> Thanks guys.
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org