You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by lr...@gmail.com on 2009/03/12 14:03:04 UTC

How can JSP use the .jar file out of Tomcat's Home ?

Hi, All,

   I have to make a JSP invoke a Class which is in a .jar file out of Tomcat
Home,

How can I deal with it? I have try to add the path of .jar file to system
CLASSPACH, but it seems useless..

 

Thanks!


Re: How can JSP use the .jar file out of Tomcat's Home ?

Posted by 李睿 <lr...@gmail.com>.
Thanks :)

On Thu, Mar 12, 2009 at 10:43 PM, Mikolaj Rydzewski <mi...@ceti.pl> wrote:

> lrvberg@gmail.com wrote:
>
>>   I have to make a JSP invoke a Class which is in a .jar file out of
>> Tomcat
>> Home,
>>
>>
> You need to create new instance of ClassLoader (e.g. URLClassLoader) and
> load 'external' jar using it.
>
> You're on right way to shoot yourself in both feet ;-)
>
> --
> Mikolaj Rydzewski <mi...@ceti.pl>
>
>

Re: How can JSP use the .jar file out of Tomcat's Home ?

Posted by Mikolaj Rydzewski <mi...@ceti.pl>.
lrvberg@gmail.com wrote:
>    I have to make a JSP invoke a Class which is in a .jar file out of Tomcat
> Home,
>   
You need to create new instance of ClassLoader (e.g. URLClassLoader) and 
load 'external' jar using it.

You're on right way to shoot yourself in both feet ;-)

-- 
Mikolaj Rydzewski <mi...@ceti.pl>


RE: How can JSP use the .jar file out of Tomcat's Home ?

Posted by Peter Crowther <Pe...@melandra.com>.
> From: lrvberg@gmail.com [mailto:lrvberg@gmail.com]
> Sent: 12 March 2009 13:51
> To: 'Tomcat Users List'
> Subject: Re: How can JSP use the .jar file out of Tomcat's Home ?
>
> Thanks,
> For the jar is the core of another running application.
> I want to use API in the jar to put stream from the servlet
> to the core.

If you have written a client/server application with both the client and the server in the same jar, you have an architecture problem.  You "should" separate out the API into its own jar, and call that.

But changing code takes time.  If the server code is never called from the API, all you lose by putting a copy of the jar in your webapp's WEB-INF/lib is some storage space.

                - Peter

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


RE: How can JSP use the .jar file out of Tomcat's Home ?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: lrvberg@gmail.com [mailto:lrvberg@gmail.com] 
> Subject: Re: How can JSP use the .jar file out of Tomcat's Home ?
> 
> For the jar is the core of another running application.
> I want to use API in the jar to put stream from the servlet 
> to the core.

Webapps are intended to be self-contained - just copy it to WEB-INF/lib and be done with it.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


Re: How can JSP use the .jar file out of Tomcat's Home ?

Posted by 李睿 <lr...@gmail.com>.
Thanks for your reminding:)

On Thu, Mar 12, 2009 at 10:59 PM, David Smith <dn...@cornell.edu> wrote:

> The problem is your other running application is in a separate jvm
> instance. Even if you did get it to run inside tomcat, it wouldn't be
> able to bridge tomcat to the other running app by jar alone. The API
> would have to define some sort of communication and work in a
> client/server mode of some sort -- even if by unix sockets.
>
> --David
>
> lrvberg@gmail.com wrote:
> > Thanks,
> > For the jar is the core of another running application.
> > I want to use API in the jar to put stream from the servlet to the core.
> >
> > Can we keep the jar out of Tomcat's Home?
> > -----邮件原件-----
> > 发件人: Peter Crowther [mailto:Peter.Crowther@melandra.com]
> > 发送时间: 2009年3月12日 21:35
> > 收件人: 'Tomcat Users List'
> > 主题: RE: How can JSP use the .jar file out of Tomcat's Home ?
> >
> >
> >> From: lrvberg@gmail.com [mailto:lrvberg@gmail.com]
> >>    I have to make a JSP invoke a Class which is in a .jar
> >> file out of Tomcat
> >> Home,
> >>
> >> How can I deal with it?
> >>
> >
> > Add the jar to the WEB-INF/lib directory of the webapp with the JSP in.
> >
> >                 - Peter
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: How can JSP use the .jar file out of Tomcat's Home ?

Posted by David Smith <dn...@cornell.edu>.
The problem is your other running application is in a separate jvm
instance. Even if you did get it to run inside tomcat, it wouldn't be
able to bridge tomcat to the other running app by jar alone. The API
would have to define some sort of communication and work in a
client/server mode of some sort -- even if by unix sockets.

--David

lrvberg@gmail.com wrote:
> Thanks,
> For the jar is the core of another running application.
> I want to use API in the jar to put stream from the servlet to the core.
>
> Can we keep the jar out of Tomcat's Home?
> -----邮件原件-----
> 发件人: Peter Crowther [mailto:Peter.Crowther@melandra.com] 
> 发送时间: 2009年3月12日 21:35
> 收件人: 'Tomcat Users List'
> 主题: RE: How can JSP use the .jar file out of Tomcat's Home ?
>
>   
>> From: lrvberg@gmail.com [mailto:lrvberg@gmail.com]
>>    I have to make a JSP invoke a Class which is in a .jar
>> file out of Tomcat
>> Home,
>>
>> How can I deal with it?
>>     
>
> Add the jar to the WEB-INF/lib directory of the webapp with the JSP in.
>
>                 - Peter
>
>   


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


Re: How can JSP use the .jar file out of Tomcat's Home ?

Posted by lr...@gmail.com.
Thanks,
For the jar is the core of another running application.
I want to use API in the jar to put stream from the servlet to the core.

Can we keep the jar out of Tomcat's Home?
-----邮件原件-----
发件人: Peter Crowther [mailto:Peter.Crowther@melandra.com] 
发送时间: 2009年3月12日 21:35
收件人: 'Tomcat Users List'
主题: RE: How can JSP use the .jar file out of Tomcat's Home ?

> From: lrvberg@gmail.com [mailto:lrvberg@gmail.com]
>    I have to make a JSP invoke a Class which is in a .jar
> file out of Tomcat
> Home,
>
> How can I deal with it?

Add the jar to the WEB-INF/lib directory of the webapp with the JSP in.

                - Peter

---------------------------------------------------------------------
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


RE: How can JSP use the .jar file out of Tomcat's Home ?

Posted by Peter Crowther <Pe...@melandra.com>.
> From: lrvberg@gmail.com [mailto:lrvberg@gmail.com]
>    I have to make a JSP invoke a Class which is in a .jar
> file out of Tomcat
> Home,
>
> How can I deal with it?

Add the jar to the WEB-INF/lib directory of the webapp with the JSP in.

                - Peter

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


Re: How can JSP use the .jar file out of Tomcat's Home ?

Posted by David Smith <dn...@cornell.edu>.
lrvberg@gmail.com wrote:
> Hi, All,
>
>    I have to make a JSP invoke a Class which is in a .jar file out of Tomcat
> Home,
>
> How can I deal with it? I have try to add the path of .jar file to system
> CLASSPACH, but it seems useless..
>
>  
>
> Thanks!
>
>
>   
Place the jar in the applications WEB-INF/lib folder.  I can't think of
a good reason to store jars outside the proper folders.

--David

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