8

I'm trying to convert a "classic" JAVA EE project, using IBM websphere 8.0.0.5, into a maven multi module project and facing issues with the IBM dependecies.

We use IBM classes from the following packages:

  • com.ibm.websphere.asynchbeans
  • com.ibm.websphere.scheduler
  • com.ibm.websphere.ce.cm
  • com.ibm.ws.asynchbeans
  • com.ibm.ws.util.ThreadPool

To get my local project to be compiled I downloaded the was.installer-8.0.0.pm from IBM and installed it to my maven using

mvn install -f "was.installer-8.0.0.pom" -D serverInstallationFolder="C:\Program Files (x86)\IBM\WebSphere\AppServer"

This step was successfull according to command line output.

I then added the following dependencies to my project as described from IBM:

In parent:

<dependency>
 <groupId>com.ibm.tools.target</groupId>
 <artifactId>was</artifactId>
 <version>8.0.0</version>
 <type>pom</type>
 <scope>provided</scope>
</dependency>

In module:

 <dependency>
   <groupId>com.ibm.tools.target</groupId>
   <artifactId>was</artifactId>
 </dependency>      

But I still can't compile my project as the IBM packages are not found.

Can anyone help me to find and correct a mistake I made?

Edit

After following BevynQ tip from the comments I copied the "was_public.jar" to "was_public-8.0.0.jar" (described at IBM here) and added it to my repository:

mvn install:install-file -Dfile="C:\Program Files (x86)\IBM\WebSphere\AppServer\dev\was_public-8.0.0.jar" -DpomFile="C:\Program Files (x86)\IBM\WebSphere\AppServer\dev\was_public-8.0.0.pom"

I then changed the dependencies to:

<dependency>
 <groupId>com.ibm.websphere.appserver</groupId>
 <artifactId>was_public</artifactId>
 <version>8.0.0</version>
 <scope>provided</scope>
</dependency>

 <dependency>
   <groupId>com.ibm.websphere.appserver</groupId>
   <artifactId>was</artifactId>
 </dependency>    

This helped to get the compiling errors for the imports to com.ibm.websphere done.

What I now have still open is the packages com.ibm.ws.* package. Anyone have an idea?

Edit 2 I added the following dependency and then I was rid of the com.ibm.ws.* import errors.

<dependency>
  <groupId>com.ibm.websphere.ws</groupId>
  <artifactId>com.ibm.ws.runtime</artifactId>
  <version>1.0.0</version>
</dependency> 

But it still does not compile as now indirectly references can not be found (in my case commonj.work.WorkManager). It seems I need to add further .jars for every single thing. Isn't there an easier way to provide all websphere jars at once as descirbe in the above linked tutorial with the com.ibm.toolsdependency (which do not work)?

bish
  • 3,381
  • 9
  • 48
  • 69
  • I don't think that will work. You want to install the required libraries to your local store. https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html. The POM is not enough – BevynQ Apr 12 '16 at 05:20
  • I've edited my question after trying your advise and I could get the `com.ibm.websphere` packages to be compiled, but still missing several of the `com.ibm.ws` ones. Anyone knows how to get them? – bish Apr 12 '16 at 05:55

3 Answers3

3

In general, com.ibm.websphere are public API for use by applications (this is true of the packages you listed above) which is consistent with these being in was_public.jar

However, com.ibm.ws package is generally product internals. May I ask what interface methods you are using from the com.ibm.ws.asynchbeans package? Maybe there is a public API alternative.

Regarding commonj.work, the only place I can find this in the WebSphere Application Server product image is WAS/plugins/com.ibm.ws.prereq.commonj-twm.jar so it looks like you will need to use that to compile against.

bish
  • 3,381
  • 9
  • 48
  • 69
njr
  • 3,399
  • 9
  • 7
  • 2
    Users should not access the content of WAS_HOME/plugins/ directly, so this should probably be considered a product issue. APARs have been taken for other APIs that were not available in WAS_HOME/dev/ (e.g., http://www-01.ibm.com/support/docview.wss?uid=swg1PM85738). – Brett Kail Apr 13 '16 at 19:53
  • For example we use the `WorkManagerImpl` from the `com.ibm.ws.asynchbeans` package. I'm not sure if I'm "allowed" to change the libraries as it is an productive module and the migration for maven and CI is (at current stage) a first step to gather experience with maven and to be able to do CI in the future. Thank you for the hint in which jar the `commonj` files are. Yesterday I got notice of a company wide nexus where the ibm files are in so that's a way I try now. But I will keep your answer in mind and will respont to it later again. – bish Apr 14 '16 at 06:29
1

Here's the solution so I solved my dependency problems:

  1. I configured the company repository manager (nexus) as a mirror. In this nexus all ibm packages are present. As you can think that solved the main problem.
  2. I then added the following dependencies according to common maven style:

Dependencies in pom.xml (version numbers extracted to properties):

<dependency>
  <groupId>com.ibm.websphere.ws</groupId>
  <artifactId>com.ibm.ws.runtime</artifactId>
  <version>${ibm.ws.runtime.version}</version>
</dependency>


<dependency>
  <groupId>com.ibm.ws.prereq</groupId>
  <artifactId>commonj-twm</artifactId>
  <version>${ibm.ws.prereq.commonj-twm.version}</version>
</dependency>

Sorry I can't provide a "nice" solution that's useable by all people but the answer from njr and the comment from BevynQ helped at lot to get clearer with the problem and helped to solve the problem in a "more manual" way by copying the needed jars by hand.

bish
  • 3,381
  • 9
  • 48
  • 69
  • How is Nexus resolving the IBM packages? Were they added there manually (e.g. third party repository)? – trebor Sep 15 '18 at 15:03
1

I was facing this issue as I tried to build a project using Maven version 3.3.9, running on Java version 1.8.0_101, as depicted in the screenshot:

enter image description here

This is how I resolved it: Step 1. Download the commonj.jar from here. Step 2. Determine which JDK your Maven is using by typing mvn -version in the command prompt. enter image description here

Step 3. Go to that directory and place the commonj.jar file there in the jre/lib/ext directory, as shown below. Now your project should build in maven without any issues.

enter image description here

Ebony Maw
  • 514
  • 7
  • 23