brokermq
brokermq

Reputation: 87

Is it possible to run automatically a Java application on WebSphere Application Server?

I'm developing a Java application that is running on WebSphere Application Server 6.1. By now, I've installed a .war file in the server and I'm calling the methods from a jsp file and they're working fine. The questions is: is there any way to develop an application that automatically starts when I press the "start" button of the application after installing it on WAS, avoinding to call the methods "manually" from a jsp? In simple words, a common J2SE application with a main() method exported as a .jar file installed on WAS should start and call the main() method automatically?

I've tried to install an exported Hello World J2SE application but it seems that the .jar is not well formed and apparently it must be a Java EE application.

I'm very new to WAS and Java EE. I really appreciate any help.

Upvotes: 0

Views: 1385

Answers (3)

brokermq
brokermq

Reputation: 87

Finally I did it through a Servlet. When the application starts up, the method init() is called and within this method I do all my stuff.

Upvotes: 0

Philippe Marschall
Philippe Marschall

Reputation: 4604

Yes this is possible but not directly. You'll have to pack you application as a resource adapter. Also you'll have to hook in the application server for things like creating threads. Check out the IronJacamar documentation.

Upvotes: 1

user647772
user647772

Reputation:

A Java EE server is not supposed to run Java SE programs that have a main() method.

Take a look at the Java EE 6 Tutorial, especially the overview of what a Java EE Containers does.

If you use NetBeans as your IDE, you can follow the good tutorials at their site.

Upvotes: 4

Related Questions