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.

有帮助吗?

解决方案 3

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.

其他提示

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.

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top