• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Frits Walraven
  • Himai Minh

Deploying Jar inside WebSphere5

Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suppose I have an enterprise application (say , MyApp.ear), deployed on the WebSphere5. It uses, JMS, DataSource configuration, done at the Server where it has been deployed.

Now, I want to make an java application which uses some of the piece of functionalities of the MyApp.ear. So, I make a jar of such utilities/methods (say, MyUtil.jar) and use it in my Stand alone java application. It compiles fine. Now, MyUtil.jar has got code for, say, dealing with datasource (hence, database ). As, the datasource (and also JMS ques n all...)is configured on the Server, I feel I need to deploy my java application on the Server. so that my "MyUtil.jar" can use the configuration seetings done over there.

When I went to the admin console of the WebSphere server , it suggests that it will allow one to deploy the application as either, EAR, WAR or JAR file. When I tried to deploy the JAR of my application , with mainfest file containing the Main class, it produced an error, suggesting that it has to be an EAR file to deploy.

I made an EAR project and then wrapped my application in a Application Client project (I am using WSAD), and then tried to deploy my application over the WebSphere server. It did deploy, but the status of the application became "UNKNOWN".

Has anybody ever required to deploy stand alone application over the App Server, and what happens if at all a non-web project is deployed over the App Server?

Can you suggest a better way, so that the common code sitting inside the MyApp.ear could be used and also, we can run the Standalone java app inside a JVM instead of using App Server?
Posts: 4278
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In J2EE, only EAR's can be deployed. WARs/JARs exist inside EARs so if anything lets you deploy them, then it might be automatically creating an EAR around them, but either way, there is always an EAR.

There's really no such thing as a stand alone app in J2EE. You either have to code services (EJB/Web/Messaging) using EARs + JARs/EJBs or you code Web applications using WARs inside of EARs.

If you need a true stand alone JVM, you don't use websphere, you just start it from command line.

I think what you're talking about is a utility library. Yes, you can create utility library jars and pass them inside multiple EARs. If you want them to share objects accross EARs you would have to add it to the server class loader (strongly not recommended). In the case you need helper methods, just drop the JAR into every EAR, else in the case of shared memory, create a service layer around the JAR and have the other applications go through there.
Arthur, where are your pants? Check under this tiny ad.
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic