aspose file tools*
The moose likes Websphere and the fly likes Running ordinary Java projects on WAS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Running ordinary Java projects on WAS" Watch "Running ordinary Java projects on WAS" New topic
Author

Running ordinary Java projects on WAS

Joe Cheung
Ranch Hand

Joined: Oct 18, 2002
Posts: 104
Here is my situation:

I have 3 Java (non-J2EE) projects developed in WSAD, namely Director, Handler_A and Handler_B, each of which has its own config. files and dependent JAR files, says log4J.
Now, I want to export them as individual JAR file, says Director.jar, Handler_A.jar and Handler_B.jar and I am going to deploy them on IBM WAS. So, my questions are the followings:

1. Is it feasible to deploy the JAR files to WAS (in fact, I tried to export all of them to one EAR file but failed as the projects are not enterprise projects. Let me know if there is any way to do so)?

2. The Director needs to run for 24 hours a day as it keeps polling any incoming file and then notify Handler_A and Handler_B for different mapping logic. What should I do to make Director start running upon depolying it on WAS?

3. How can Director notify (or contact) Handler_A and Handler_B to do something as they are separate JAR Project (in WSAD, I can include Handler_A and Handler_B projects in Director project such that it can make a method call to them)?

Thanks,
Joe


Joe
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by Joe Cheung:

1. Is it feasible to deploy the JAR files to WAS (in fact, I tried to export all of them to one EAR file but failed as the projects are not enterprise projects. Let me know if there is any way to do so)?

Yes, it's feasable. However, in order to run anything in a J2EE container such as WAS, you need to create at least one J2EE object. I'd suggest creating a stateless EJB Session bean that does nothing more than call a method on one of your other objects to start whatever process needs to be started. Then open the EAR file Deployment descriptor and have it point to the other 3 Java projects as "Utility Jars". Then specify the other 3 jar files as "J2EE Module Dependencies" in the EJB project.
Originally posted by Joe Cheung:

2. The Director needs to run for 24 hours a day as it keeps polling any incoming file and then notify Handler_A and Handler_B for different mapping logic. What should I do to make Director start running upon depolying it on WAS?

You can either make your session bean implement the javax.ejb.TimedObject interface and use the EJB Timer service, or you can use the WAS Scheduler service, assuming you are using WAS 6.0 or above. To get more details, consult the WAS InfoCenter
Originally posted by Joe Cheung:

3. How can Director notify (or contact) Handler_A and Handler_B to do something as they are separate JAR Project (in WSAD, I can include Handler_A and Handler_B projects in Director project such that it can make a method call to them)?

If you've set things up properly, all three jar files plus the new EJB jar file will be in the classpath, so any class can instantiate and call methods on any other class and it will be found in the classpath.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Running ordinary Java projects on WAS