MyEclipse Bling 9.1

WebSphere 6.1 & 7.0 Tips

Table of Contents

WebSphere Server Support

WebSphere 6.1 and JPA

JSON and JDK 1.5 (WebSphere 6.1)

Configuring WebSphere 6.1 for Web Services

Adding required libraries

Removing a library

WebSphere 7 and JPA

Configuring WebSphere 7 for JSF 2.0

Configure Class Loader

Create JSF 2.0 Shared Library

Configuring WebSphere 7 for Web Services

Removing conflicting libraries

Disabling the IBM JAX-WS Implementation

Configure Class Loader

MyEclipse Bling support forums can be found here:

WebSphere Server Support

The MyEclipse software component generation feature has been tested to work with the following versions of IBM WebSphere.

Server Version

Support

WebSphere 6.1

Supported only for Hibernate 3.2 (found in the Spring 2.5 libs list in our wizards).

WebSphere 7.0

Supported with OSGi Applications and Java Persistence API 2.0 Feature Pack Installed.

JSF 2.0-only applications supported with Shared Library and Parent Last classloader configuration.

WebSphere 8

Not Tested


WebSphere 6.1 and JPA

By default the scaffolding wizard will add Hibernate 3.5.5 libraries for Spring 3.0 projects, however JPA 2.0 used by Hibernate 3.5.5 is not supported on WebSphere 6.1.  Therefore you must rollback to Hibernate 3.2 which utilizes JPA 1.0.

Steps:

  1. uncheck the Hibernate 3.5.5 and Validation 1.0 library containers from the Spring 3.0 list during scaffolding (when using the Scaffolding Spring CRUD application... wizard)
  2. add the Hibernate 3.2 library container from the Spring 2.5 list using the Add Spring Runtime Dependencies wizard

Watch screencast

http://www.youtube.com/watch?v=iuNk1liRQBI

Note to DSL Users: You will need to uncheck the Hibernate 3.5.5 and Validation 1.0 library containers from the Enable Spring DSL wizard.

The complete maven entries are listed below.  The hibernate-validator entry in red is discussed immediately after the table.

Hibernate 3.5 / JPA 2.0

Hibernate 3.2 / JPA 1.0

<dependency>

            <groupId>org.hibernate</groupId>

            <artifactId>hibernate-core</artifactId>

            <version>3.5.5-Final</version>

    </dependency>

    <dependency>

            <groupId>org.hibernate</groupId>

            <artifactId>hibernate-entitymanager</artifactId>

            <version>3.5.5-Final</version>

            <exclusions>

                    <exclusion>

                            <artifactId>cglib</artifactId>

                            <groupId>cglib</groupId>

                    </exclusion>

                    <exclusion>

                            <artifactId>dom4j</artifactId>

                            <groupId>dom4j</groupId>

                    </exclusion>

            </exclusions>

    </dependency>

    <dependency>

            <groupId>org.hibernate.javax.persistence</groupId>

            <artifactId>hibernate-jpa-2.0-api</artifactId>

            <version>1.0.0.Final</version>

    </dependency>

    <dependency>

            <groupId>org.hibernate</groupId>

            <artifactId>hibernate-validator</artifactId>

            <version>4.1.0.Final</version>

            <exclusions>

                    <exclusion>

                            <artifactId>jaxb-api</artifactId>

                            <groupId>javax.xml.bind</groupId>

                    </exclusion>

                    <exclusion>

                            <artifactId>jaxb-impl</artifactId>

                            <groupId>com.sun.xml.bind</groupId>

                    </exclusion>

            </exclusions>

    </dependency>

<dependency>

            <groupId>org.hibernate</groupId>

            <artifactId>hibernate-entitymanager</artifactId>

            <version>3.3.2.GA</version>

            <exclusions>

                    <exclusion>

                            <artifactId>asm-attrs</artifactId>

                            <groupId>asm</groupId>

                    </exclusion>

                    <exclusion>

                            <artifactId>asm</artifactId>

                            <groupId>asm</groupId>

                    </exclusion>

            </exclusions>

    </dependency>

    <dependency>

            <groupId>org.hibernate</groupId>

            <artifactId>hibernate</artifactId>

            <version>3.2.7.ga</version>

            <exclusions>

                    <exclusion>

                            <artifactId>cglib</artifactId>

                            <groupId>cglib</groupId>

                    </exclusion>

            </exclusions>

    </dependency>

    <dependency>

            <groupId>org.hibernate</groupId>

            <artifactId>hibernate-validator</artifactId>

            <version>3.0.0.ga</version>

    </dependency>

    <dependency>

            <groupId>javassist</groupId>

            <artifactId>javassist</artifactId>

            <version>3.4.GA</version>

    </dependency>

* If you must have the Validation-1.0.0 api jar on your classpath (necessary for GWT), the hibernate-validator listed in red on the right side of the table above, should be changed to depend on a minimum of <version>4.0.1.GA</version> or if you prefer, the newest <version>4.1.0.Final</version>.  This is because hibernate-validator 3.0.0 is not a JSR303 provider.  http://www.hibernate.org/subprojects/validator.html

JSON and JDK 1.5 (WebSphere 6.1)

In order to use a server (WebSphere, Tomcat, etc) started with JDK 1.5, all classes must have been compiled with JDK 1.5 compatibility.  The JSON libraries bundled by MyEclipse for Spring was not compiled with JDK 1.5 compatibility so UnsupportedClassVersionError’s will result.  To work around the problem, use an older version of JSON. This problem typically manifests as GWT 2.1+ applications failing to run and a series (possibly infinite) of error message popups from the GWT application.  To isolate the error message, do not use the internal browser to run the GWT application, otherwise the series of modal popups may prevent you from seeing the server console.

In a Maven project, use this entry in the POM:

    <dependency>

            <groupId>org.json</groupId>

            <artifactId>json</artifactId>

            <version>20080701</version>

    </dependency>

For a non-maven projects, find the jar in the central maven repository at repo1.maven.org/maven2 or search.maven.org.

Configuring WebSphere 6.1 for Web Services

There are a couple of steps necessary to make Websphere work with web services.  The following link explains the process pretty well, but first, you will need to add some libraries to your project.

http://cxf.apache.org/docs/application-server-specific-configuration-guide.html#ApplicationServerSpecificConfigurationGuide-Websphere

Adding required libraries

The following libraries will need to be added to your project before deploying the project to WebSphere:

These jars can be downloaded from the following links:

http://www.jarvana.com/jarvana/archive-details/org/apache/geronimo/modules/geronimo-jaxws/2.1/geronimo-jaxws-2.1.jar

http://www.jarvana.com/jarvana/archive-details/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar

http://www.jarvana.com/jarvana/archive-details/com/sun/xml/parsers/jaxp-ri/1.4.2/jaxp-ri-1.4.2.jar

You can just add them to your {WebRoot}/web-inf/lib directory.

Removing a library

The link above requires that you copy the wsdl4j-1.6.1.jar (but actually, it is the wsdl4j-1.6.2.jar) into the $WEBSPHERE_HOME/java/jre/lib/endorsed folder (create the endorsed folder if it does not exist).  If you initialized your project with classpath containers, you will not be able to remove individual jars.  You can access the Add Spring Runtime Dependencies… wizard.  On the Runtime Dependencies page, uncheck the Use Eclipse classpath containers instead of copying libraries into the project checkbox.   Click on the Deselect All button.  And the select the following library:

Click on the Finish button.  This will cause some problems to show up in the problems view.  To fix these problems, go into your build path properties and remove the classpath container with the name above.  You can then copy the wsdl4j-1.6.2 jar into the $WEBSPHERE_HOME/java/jre/lib/endorsed folder and then remove it from your classpath.

WebSphere 7 and JPA

In order for a project with Spring scaffolding from MyEclipse for Spring to run on Websphere 7, either the workarounds to roll back to JPA 1.0 need to be employed, or the Websphere server needs to be updated to work with JPA 2.0.  See JPA 2.0 Feature Pack for Websphere 7.0.

Configuring WebSphere 7 for JSF 2.0

There are two steps necessary to make WebSphere work with JSF 2.0. First, a “parent last” classloading scheme must be configured, then a shared library referencing the the JSF 2.0 jars must be created and associated with the application or the entire server.  If you associate the shared library with the entire server you may encounter problems in non-JSF applications so unless all applications on the server will be JSF applications it is recommended to associate the shared library with your application only.

Configure Class Loader

This section describes how to configure your server to use a “parent last” classloading scheme.  The “parent last” classloader option causes the application’s classloader to load classes before the parent application server’s classloader.  This class loading scheme is necessary to use the shared library that you’ll need to support JSF 2.0.  

This IBM document describes the classloading options: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.iseries.doc/info/iseriesexp/ae/ucws_rsharedlib.html

For detailed description on the classloader options follow this link: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.zseries.doc/info/zseries/ae/trun_classload_server.html

Create JSF 2.0 Shared Library

The IBM Documentation regarding creating shared libraries can be found here:

http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.zseries.doc/info/zseries/ae/tejb_jpadefaultpp.html

Essentially, you need to use the Websphere console to create a Shared Library that contains paths to the following jars:

Configuring WebSphere 7 for Web Services

There are a couple of steps necessary to make Websphere work with web services.  First, you will need to remove some conflicting libraries from your project.  Next, you will need to change the class loader order policy at the web module level to “Classes loaded with local class loader first (parent last)”.  Finally you will need to disable the IBM JAX-WS Implementation.  

The following link contains a pretty good article on how to accomplish this, if you would like further information.  A good portion of the following descriptions are taken directly from this article.  http://www.ibm.com/developerworks/websphere/library/techarticles/1001_thaker/1001_thaker.html

Removing conflicting libraries

The following libraries will need to be removed from your project before deploying the project to websphere:

  1. saaj-api.jar
  2. saaj-impl.jar
  3. xalan.jar
  4. xercesImpl.jar
  5. xml-apis.jar
  6. jaxb-api.jar
  7. jaxb-impl.jar
  8. geronimo-activation_1.1_spec-1.0.2.jar
  9. geronimo-stax-api_1.0_spec-1.0.1.jar

If you initialized your project with classpath containers, you will not be able to remove individual jars.  You can access the Add Spring Runtime Dependencies… menu.  On the Runtime Dependencies page, uncheck the Use Eclipse classpath containers instead of copying libraries into the project checkbox.   Click on the Deselect All button.  And the select the following two libraries:

Click on the Finish button.  This will cause some problems to show up in the problems view.  To fix these problems, go into your build path properties and remove the classpath containers with the names above.  Then remove the individual libraries mentioned above.

Disabling the IBM JAX-WS Implementation

You need to disable the IBM JAX-WS implementation to ensure that Websphere doesn’t scan for JAX-WS annotations and perform validations.  You can turn off annotation scanning in one of two ways:

  1. To turn off annotation scanning for just the deployed module, modify the module’s WebContent/META-INF/MANIFEST.MF and add the following line: DisableIBMJAXWSEngine:true
  2. To turn off annotation scanning for the entire server, use the administrative console to navigate to the Java Virtual Machine (Application Servers -> your server -> Process Definition -> Java Virtual Machine.  In the Generic JVM arguments field, add the following property: -Dcom.ibm.websphere.webservices.DisableIBMJAXWSEngine=true.

The following section describes how to configure your server to use a “parent last” classloading scheme.  The “parent last” classloader option causes the application’s classloader to load classes before the parent application server’s classloader.  This class loading scheme is necessary to use the shared library that you’ll need to support JSF 2.0.  

Configure Class Loader

In order to use an external JAX-WS runtime, you’ll need to change the class loader Order policy at the web application module level.  The policy needs to be set to “Classes loaded with local class loader first (parent last)”.

This IBM document describes the classloading options: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.iseries.doc/info/iseriesexp/ae/ucws_rsharedlib.html