You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Slobodanka Dimitrijevic <sd...@dirkzwager.com> on 2008/06/02 11:23:56 UTC

How to run own java application within Tomcat

Hi,

I have an Java application that I want to run standalone but also from
Tomcat.

This java application has a java class that make use of axis2 to expose
methods of this class as web service methods.

What I want is the following:

Scenario 1:

If I run my Java application as standalone application axis web service
methods are not available.

Scenario 2: 

If I run my Java application from Tomcat axis web service methods are
available.

 

 

Can you please help me?  

Thanks in advance.

 

Slobodanka Dimitrijevic

"The Maritime Information & Service Provider"


This e-mail is confidential and may also be privileged. It is intended for use by the addressee only.
If you are not the intended addressee, we request that you notify us immediately and delete this e-mail,
and any attachment(s), without copying, forwarding, disclosing or using it in any other way. Royal
Dirkzwager will not be liable for damage relating to the communication by e-mail of data or documents.

Re: How to run own java application within Tomcat

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message ----- 
From: "Johnny Kewl" <jo...@kewlstuff.co.za>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Wednesday, June 04, 2008 4:43 PM
Subject: Re: How to run own java application within Tomcat


>
> ----- Original Message ----- 
> From: "Slobodanka Dimitrijevic" <sd...@dirkzwager.com>
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Sent: Tuesday, June 03, 2008 10:18 PM
> Subject: RE: How to run own java application within Tomcat
>
>
>>Hi Johnny,
>
>>Thanks for the answer but I think I didn't explain my problem correctly.
>
>>I need the following situation:
>>1. a java application has to run continiously outside tomcat (when tomcat 
>>crashes the application must be still running). This application runs in 
>>its own virtual >machine (VM1).
>
>    when tomcat crashes... you have no faith ha ha... its tomcat, nothing 
> fishy about it ;)
>
>>2. I have also Axis2 webservices that have to have access to the objects 
>>in VM1. These webservices run inside Tomcat. However Tomcat runs in its 
>>own virtual >machine (VM2). So I have a problem.
>
>    Yes you do ;)
>
>>Question:
>>How to be able to run the java appplication (outside tomcat), and the 
>>Axis2 webservices (inside tomcat), in the same virtual machine
>
>
> As soon as you have applicatios in different VMs, you into interprocess 
> communications, RMI or the like.
> Even if that is not true, and its TC and an external app in the same VM, 
> you have "ring fenced" class loader problems.
> TC keeps itself away from the rest of the machine, which is actually a 
> good thing, else we'd all go insane.
>
> Using traditional Java technology its going to be something like RMI, or 
> another cross process technique like sockets (your own rmi).
> So soap call comes into TC, TC chats to external application thru a 
> socket, (or like the other poster suggested) an embedded TC app that also 
> has soap (a lot of work I think).
>
> So thats what you got to do...
>
> The POJO Application Server approach to this you may find interesting, but 
> its probably not want you want
>
> TC(Application inside TC) ----------- Application used from Network or 
> Internet (looks like the original app to the user)
> --------------------------------------- TC(Soap Application Using 
> Application inside another TC, or the same TC)
>
> Thats how it would be done in a PAS.... but its inside TC and well, you 
> think TC is going to "crash"... we used to be friends ;)
> Have fun....

Slobodanka, I just had another thought that you may want to read up on...
Java has an Extension class loader mechanism... but now we talking TC in the 
same JRE at least.
Theres a folder in the typical JRE that one can drop classes into, and then 
these are added to the JRE class path, so in theory TC should be able to 
find the application.
There is also a way to add a class or application to the Extension Class 
loader through the command line, I forget the details, but it will probably 
be too late because if TC is a service its going to want it ewhen the 
machine starts... so theres another maybe.

Just dont get this crazy idea... dont put the tomcat libs in the machines 
classpath... thats beeeeeeeg trouble... no no ;)

Shouldnt even be talking to you... "tomcats going to crash" ;)

---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------






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


Re: How to run own java application within Tomcat

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message ----- 
From: "Slobodanka Dimitrijevic" <sd...@dirkzwager.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, June 03, 2008 10:18 PM
Subject: RE: How to run own java application within Tomcat


>Hi Johnny,

>Thanks for the answer but I think I didn't explain my problem correctly.

>I need the following situation:
>1. a java application has to run continiously outside tomcat (when tomcat 
>crashes the application must be still running). This application runs in 
>its own virtual >machine (VM1).

    when tomcat crashes... you have no faith ha ha... its tomcat, nothing 
fishy about it ;)

>2. I have also Axis2 webservices that have to have access to the objects in 
>VM1. These webservices run inside Tomcat. However Tomcat runs in its own 
>virtual >machine (VM2). So I have a problem.

    Yes you do ;)

>Question:
>How to be able to run the java appplication (outside tomcat), and the Axis2 
>webservices (inside tomcat), in the same virtual machine


As soon as you have applicatios in different VMs, you into interprocess 
communications, RMI or the like.
Even if that is not true, and its TC and an external app in the same VM, you 
have "ring fenced" class loader problems.
TC keeps itself away from the rest of the machine, which is actually a good 
thing, else we'd all go insane.

Using traditional Java technology its going to be something like RMI, or 
another cross process technique like sockets (your own rmi).
So soap call comes into TC, TC chats to external application thru a socket, 
(or like the other poster suggested) an embedded TC app that also has soap 
(a lot of work I think).

So thats what you got to do...

The POJO Application Server approach to this you may find interesting, but 
its probably not want you want

TC(Application inside TC) ----------- Application used from Network or 
Internet (looks like the original app to the user)
--------------------------------------- TC(Soap Application Using 
Application inside another TC, or the same TC)

Thats how it would be done in a PAS.... but its inside TC and well, you 
think TC is going to "crash"... we used to be friends ;)
Have fun.... 


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


Re: How to run own java application within Tomcat

Posted by Martin <mg...@hotmail.com>.
Slobodanka-

if you want to dynamically create and access TC entities (engines,connectors 
etc) from outside TC environment
you would need to implement TC embedded server
http://www.vsj.co.uk/articles/display.asp?id=319

HTH
Martin
----- Original Message ----- 
From: "Slobodanka Dimitrijevic" <sd...@dirkzwager.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, June 03, 2008 4:18 PM
Subject: RE: How to run own java application within Tomcat


Hi Johnny,

Thanks for the answer but I think I didn't explain my problem correctly.

I need the following situation:
1. a java application has to run continiously outside tomcat (when tomcat 
crashes the application must be still running). This application runs in its 
own virtual machine (VM1).

2. I have also Axis2 webservices that have to have access to the objects in 
VM1. These webservices run inside Tomcat. However Tomcat runs in its own 
virtual machine (VM2). So I have a problem.

Question:
How to be able to run the java appplication (outside tomcat), and the Axis2 
webservices (inside tomcat), in the same virtual machine


thanks in advance
Slobodanka

________________________________

Van: Johnny Kewl [mailto:john@kewlstuff.co.za]
Verzonden: di 3-6-2008 15:57
Aan: Tomcat Users List
Onderwerp: Re: How to run own java application within Tomcat




----- Original Message -----
From: "Slobodanka Dimitrijevic" <sd...@dirkzwager.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, June 03, 2008 11:34 AM
Subject: RE: How to run own java application within Tomcat



Hi Johnny,
Thanks for your mail. Can you please tell me :

1. where should I stop Java executable inside Tomcat directory
structure?

2. which configuration file and what should I configure inside Tomecat
if I want to run executable java application during sturtup of Tomcat?

Thanks in advance,
Slobodanka Dimitrijevic


=============

Slobodanka just try this and you'll get the idea

I use NB but could be done with any IDE...

1) Make a Java application... normal Java application with some classes in
it.
Compile it and (if its NB its an executable) double click on the JAR file
(in the DIST folder)
It will run.

2) Now make a web project based on TC, in the libraries "select the
application" that you made before.
Make a little web page that uses one of the classes in the application
Compile it.... it will give you a WAR file and inside that war file... will
be your application.

Now you got one war file with the application in it... and the application
can run on its own as well, which is what I think you asking?

So if a user unzips the war file... they can run the application.
So now you have 2 in one.

You'll get the idea by just seeing where you application is used in the war.
So outside its a normal application, but inside the War its being used like
a library.

The web app has extra stuff, like web.xml and yada yada... but it doesnt
care, to it.... the application JAR is just a lib.

Then you play from there.... decide what classes you want to put where.

Its a design thing... not some web xml that you set.

Jars are zip files... they can be applications or libs... or a mix.

You cant just drop an application into tomcat and expect it to appear in a
web page... but you can share stuff.

The trick... make a application JAR.... the use that as a lib in TC.... NB
will pack it for you... no thinking required ;)

---------

The POJO Application Server is a completely different animal, and you'll
have to ask specific questions in their mailing list for that.
But that does literally allow you to drop the application into it, and the
UI side of that application (not a web service) literally jumps out of the
browser.
But the applications have to be designed for that.

Either way... there is some design to do.

Hope that helps....


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



"The Maritime Information & Service Provider"


This e-mail is confidential and may also be privileged. It is intended for 
use by the addressee only.
If you are not the intended addressee, we request that you notify us 
immediately and delete this e-mail,
and any attachment(s), without copying, forwarding, disclosing or using it 
in any other way. Royal
Dirkzwager will not be liable for damage relating to the communication by 
e-mail of data or documents.




--------------------------------------------------------------------------------


> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org 


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


RE: How to run own java application within Tomcat

Posted by Slobodanka Dimitrijevic <sd...@dirkzwager.com>.
Hi Johnny,
 
Thanks for the answer but I think I didn't explain my problem correctly.
 
I need the following situation:
1. a java application has to run continiously outside tomcat (when tomcat crashes the application must be still running). This application runs in its own virtual machine (VM1).
 
2. I have also Axis2 webservices that have to have access to the objects in VM1. These webservices run inside Tomcat. However Tomcat runs in its own virtual machine (VM2). So I have a problem. 
 
Question:
How to be able to run the java appplication (outside tomcat), and the Axis2 webservices (inside tomcat), in the same virtual machine
 
 
thanks in advance
Slobodanka

________________________________

Van: Johnny Kewl [mailto:john@kewlstuff.co.za]
Verzonden: di 3-6-2008 15:57
Aan: Tomcat Users List
Onderwerp: Re: How to run own java application within Tomcat




----- Original Message -----
From: "Slobodanka Dimitrijevic" <sd...@dirkzwager.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, June 03, 2008 11:34 AM
Subject: RE: How to run own java application within Tomcat



Hi Johnny,
Thanks for your mail. Can you please tell me :

1. where should I stop Java executable inside Tomcat directory
structure?

2. which configuration file and what should I configure inside Tomecat
if I want to run executable java application during sturtup of Tomcat?

Thanks in advance,
Slobodanka Dimitrijevic


=============

Slobodanka just try this and you'll get the idea

I use NB but could be done with any IDE...

1) Make a Java application... normal Java application with some classes in
it.
Compile it and (if its NB its an executable) double click on the JAR file
(in the DIST folder)
It will run.

2) Now make a web project based on TC, in the libraries "select the
application" that you made before.
Make a little web page that uses one of the classes in the application
Compile it.... it will give you a WAR file and inside that war file... will
be your application.

Now you got one war file with the application in it... and the application
can run on its own as well, which is what I think you asking?

So if a user unzips the war file... they can run the application.
So now you have 2 in one.

You'll get the idea by just seeing where you application is used in the war.
So outside its a normal application, but inside the War its being used like
a library.

The web app has extra stuff, like web.xml and yada yada... but it doesnt
care, to it.... the application JAR is just a lib.

Then you play from there.... decide what classes you want to put where.

Its a design thing... not some web xml that you set.

Jars are zip files... they can be applications or libs... or a mix.

You cant just drop an application into tomcat and expect it to appear in a
web page... but you can share stuff.

The trick... make a application JAR.... the use that as a lib in TC.... NB
will pack it for you... no thinking required ;)

---------

The POJO Application Server is a completely different animal, and you'll
have to ask specific questions in their mailing list for that.
But that does literally allow you to drop the application into it, and the
UI side of that application (not a web service) literally jumps out of the
browser.
But the applications have to be designed for that.

Either way... there is some design to do.

Hope that helps....


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



"The Maritime Information & Service Provider"


This e-mail is confidential and may also be privileged. It is intended for use by the addressee only.
If you are not the intended addressee, we request that you notify us immediately and delete this e-mail,
and any attachment(s), without copying, forwarding, disclosing or using it in any other way. Royal
Dirkzwager will not be liable for damage relating to the communication by e-mail of data or documents.


Re: How to run own java application within Tomcat

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message ----- 
From: "Slobodanka Dimitrijevic" <sd...@dirkzwager.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, June 03, 2008 11:34 AM
Subject: RE: How to run own java application within Tomcat



Hi Johnny,
Thanks for your mail. Can you please tell me :

1. where should I stop Java executable inside Tomcat directory
structure?

2. which configuration file and what should I configure inside Tomecat
if I want to run executable java application during sturtup of Tomcat?

Thanks in advance,
Slobodanka Dimitrijevic


=============

Slobodanka just try this and you'll get the idea

I use NB but could be done with any IDE...

1) Make a Java application... normal Java application with some classes in 
it.
Compile it and (if its NB its an executable) double click on the JAR file 
(in the DIST folder)
It will run.

2) Now make a web project based on TC, in the libraries "select the 
application" that you made before.
Make a little web page that uses one of the classes in the application
Compile it.... it will give you a WAR file and inside that war file... will 
be your application.

Now you got one war file with the application in it... and the application 
can run on its own as well, which is what I think you asking?

So if a user unzips the war file... they can run the application.
So now you have 2 in one.

You'll get the idea by just seeing where you application is used in the war.
So outside its a normal application, but inside the War its being used like 
a library.

The web app has extra stuff, like web.xml and yada yada... but it doesnt 
care, to it.... the application JAR is just a lib.

Then you play from there.... decide what classes you want to put where.

Its a design thing... not some web xml that you set.

Jars are zip files... they can be applications or libs... or a mix.

You cant just drop an application into tomcat and expect it to appear in a 
web page... but you can share stuff.

The trick... make a application JAR.... the use that as a lib in TC.... NB 
will pack it for you... no thinking required ;)

---------

The POJO Application Server is a completely different animal, and you'll 
have to ask specific questions in their mailing list for that.
But that does literally allow you to drop the application into it, and the 
UI side of that application (not a web service) literally jumps out of the 
browser.
But the applications have to be designed for that.

Either way... there is some design to do.

Hope that helps.... 


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


RE: How to run own java application within Tomcat

Posted by Slobodanka Dimitrijevic <sd...@dirkzwager.com>.
Hi Johnny,
Thanks for your mail. Can you please tell me :

1. where should I stop Java executable inside Tomcat directory
structure?

2. which configuration file and what should I configure inside Tomecat
if I want to run executable java application during sturtup of Tomcat?

Thanks in advance,
Slobodanka Dimitrijevic


-----Oorspronkelijk bericht-----
Van: Johnny Kewl [mailto:john@kewlstuff.co.za] 
Verzonden: maandag 2 juni 2008 19:23
Aan: Tomcat Users List
Onderwerp: Re: How to run own java application within Tomcat


----- Original Message ----- 
From: "Slobodanka Dimitrijevic" <sd...@dirkzwager.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Monday, June 02, 2008 11:26 AM
Subject: How to run own java application within Tomcat




-----Oorspronkelijk bericht-----
Van: Slobodanka Dimitrijevic [mailto:sdimitrijevic@dirkzwager.com]
Verzonden: maandag 2 juni 2008 11:24
Aan: users@tomcat.apache.org
Onderwerp: How to run own java application within Tomcat

Hi,

I have an Java application that I want to run standalone but also from
Tomcat.

This java application has a java class that make use of axis2 to expose
methods of this class as web service methods.

What I want is the following:

Scenario 1:

If I run my Java application as standalone application axis web service
methods are not available.

Scenario 2:

If I run my Java application from Tomcat axis web service methods are
available.

=================

Slobodanka, its really just design architecture...

Your application is (Lib + Java Executable) and in TC its (Lib + Java 
Executable + Jax or Axis)

Sun have been trying to make this easier in Java6 see this artcle for 
example
http://java.sun.com/developer/technicalArticles/J2SE/jax_ws_2/

But Axis will work, the app will just have to carry the extra Axis
classes 
so it compiles, and can run outside.

Then we having a little fun with a new thing called a POJO Application 
Server
And you could actually combine all three.
A PAS takes a full application and pops just the UI side out of browsers
Its a Tomcat tool.

So now you can really blow your customers away ;)
Web service.
Runs stand alone.
Or the app just jumps out of the browser.

------------------------------------------------------------------------
---
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
------------------------------------------------------------------------
---






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

"The Maritime Information & Service Provider"


This e-mail is confidential and may also be privileged. It is intended for use by the addressee only.
If you are not the intended addressee, we request that you notify us immediately and delete this e-mail,
and any attachment(s), without copying, forwarding, disclosing or using it in any other way. Royal
Dirkzwager will not be liable for damage relating to the communication by e-mail of data or documents.

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


Re: How to run own java application within Tomcat

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message ----- 
From: "Slobodanka Dimitrijevic" <sd...@dirkzwager.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Monday, June 02, 2008 11:26 AM
Subject: How to run own java application within Tomcat




-----Oorspronkelijk bericht-----
Van: Slobodanka Dimitrijevic [mailto:sdimitrijevic@dirkzwager.com]
Verzonden: maandag 2 juni 2008 11:24
Aan: users@tomcat.apache.org
Onderwerp: How to run own java application within Tomcat

Hi,

I have an Java application that I want to run standalone but also from
Tomcat.

This java application has a java class that make use of axis2 to expose
methods of this class as web service methods.

What I want is the following:

Scenario 1:

If I run my Java application as standalone application axis web service
methods are not available.

Scenario 2:

If I run my Java application from Tomcat axis web service methods are
available.

=================

Slobodanka, its really just design architecture...

Your application is (Lib + Java Executable) and in TC its (Lib + Java 
Executable + Jax or Axis)

Sun have been trying to make this easier in Java6 see this artcle for 
example
http://java.sun.com/developer/technicalArticles/J2SE/jax_ws_2/

But Axis will work, the app will just have to carry the extra Axis classes 
so it compiles, and can run outside.

Then we having a little fun with a new thing called a POJO Application 
Server
And you could actually combine all three.
A PAS takes a full application and pops just the UI side out of browsers
Its a Tomcat tool.

So now you can really blow your customers away ;)
Web service.
Runs stand alone.
Or the app just jumps out of the browser.

---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------






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


How to run own java application within Tomcat

Posted by Slobodanka Dimitrijevic <sd...@dirkzwager.com>.

-----Oorspronkelijk bericht-----
Van: Slobodanka Dimitrijevic [mailto:sdimitrijevic@dirkzwager.com] 
Verzonden: maandag 2 juni 2008 11:24
Aan: users@tomcat.apache.org
Onderwerp: How to run own java application within Tomcat

Hi,

I have an Java application that I want to run standalone but also from
Tomcat.

This java application has a java class that make use of axis2 to expose
methods of this class as web service methods.

What I want is the following:

Scenario 1:

If I run my Java application as standalone application axis web service
methods are not available.

Scenario 2: 

If I run my Java application from Tomcat axis web service methods are
available.

 

 

Can you please help me?  

Thanks in advance.

 

Slobodanka Dimitrijevic

"The Maritime Information & Service Provider"


This e-mail is confidential and may also be privileged. It is intended for use by the addressee only.
If you are not the intended addressee, we request that you notify us immediately and delete this e-mail,
and any attachment(s), without copying, forwarding, disclosing or using it in any other way. Royal
Dirkzwager will not be liable for damage relating to the communication by e-mail of data or documents.

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