• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Running ordinary Java projects on WAS

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic