WebLogic Server Java code review rules

Under the Java Code Review set of rules, the WebLogic to WebSphere code migration category contains multiple rules. To learn how to get more information about a rule, see Displaying detailed help.

Rule Name Rule Description Automated Fix
Do not use BEA Beehive @common annotations

This rule detects @common Javadoc tags that are found in the migrated BEA Beehive files.

No
Do not use BEA Beehive @jpf:action annotations

This rule detects and migrates @jpf:action Javadoc tags that are found in the migrated BEA Beehive files.

No
Do not use BEA Beehive @jpf:controller annotations

This rule detects and migrates @jpf:controller Javadoc tags that are found in the migrated BEA Beehive files.

No
Do not use BEA Beehive @jpf:exception-handler annotations

This rule detects and migrates @jpf:exception-handler Javadoc tags that are found in the migrated BEA Beehive files.

No
Do not use BEA NetUI packages

This rule detects and migrates BEA com.bea.wlw.netui packages.

No
Detect Apache Beehive packages

This rule detects the use of Apache Beehive packages, which begin with org.apache.beehive.

No
Do not put EJB classes in default Java packages This rule detects Java classes that define EJBs that are in default Java packages. WebSphere Application Server does not allow EJBs in default Java packages. No
Do not use Apache XMLBeans packages

This rule detects references to the Apache XMLBeans package org.apache.xmlbeans.

No
Do not use Commons Logging system level property

This rule detects setting the commons logging implementation class using the system property.

The quick fix removes the entry.

No
Do not use JNDI name lookup to reference the runtime MBean server

This rule detects the string literal "java:comp/env/jmx/runtime" which WebLogic Server provides as the JNDI name for the runtime MBean server. This lookup does not work on WebSphere Application Server.

No
Do not use non-mapping weblogic.apache packages

This rule detects import and code references to classes where the class package starts with weblogic.apache and the class does not map to an open source Apache class.

You must modify the code to use different classes. See the rule help for more information.

No
Do not use subclass of EntityManager or EntityManagerFactory for injected JPA elements

This rule detects injected JPA PersistenceContext or PeristenceUnit where the injectable type is a subclass of EntityManager or EntityManagerFactory.

The quick fix changes the class to use the standard JPA object.

No
Do not use the WebLogic ApplicationLifecycleListener interface

This rule detects classes that implement the WebLogic weblogic.application.ApplicationLifecycleListener interface. A recommended migration alternative is to use the javax.servlet.ServletContextListener interface.

No
Do not use the WebLogic domain for JMX object names

This rule detects a string literal that starts with "com.bea" in Java code. This string can be used to reference the WebLogic Server JMX domain and cannot be used as such in WebSphere Application Server.

No
Do not use the WebLogic MessageProducer API

This rule detects the use of the weblogic.jms.extensions.WLMessageProducer API.

No
Do not use the WebLogic ServletAuthentication invalidateAll method

This rule detects the use of the weblogic.servlet.security.ServletAuthentication invalidateAll method.

No
Do not use the WebLogic TransactionHelper getUserTransaction method

This rule detects the use of the weblogic.transaction.TransactionHelper getUserTransaction method.

No
Do not use UserTransaction interface from CMT beans

This rule detects references to ctx.lookup('javax.transaction. UserTransaction') within container managed transaction enterprise beans. References to the UserTransaction object are not allowed from CMT beans.

These references are flagged so that you can remove this Java EE violation.

No
Do not use weblogic.apache packages

This rule detects import and code references to classes where the class package starts with weblogic.apache and the class maps directly to an org.apache class.

The quick fix changes the code to org.apache. Download the appropriate Apache open source .jar file, and include it with your application.

No
Do not use WebLogic EJBGEN annotations

This rule detects EJBGEN annotations from the weblogic.ejbgen package. These annotations must be removed from your application before you deploy it on WebSphere Application Server.

No
Do not use WebLogic log4j logging objects

This rule detects the proprietary WebLogic Server log4j classes and flags them for manual migration.

No
Do not use WebLogic LoggingHelper object to get Logger instance

This rule detects the LoggingHelper object usage.

The quick fix converts the class instance to Java Logger.

No
Do not use WebLogic logging objects

This rule detects WebLogic Server logging objects.

The quick fix changes the code to use the Java objects.

No
Do not use WebLogic NonCatalogLogger object

This rule detects the NonCatalogLogger usage.

The quick fix converts these objects to Java Logger object. In addition, it converts all the logging method calls to valid logging calls. The level is controlled by the user using rule properties.

No
Do not use WebLogic RMI API calls

This rule detects the use of references to the proprietary weblogic.rmi packages.

The quick fix changes weblogic.rmi to java.rmi to use the Java-provided classes.

No
Do not use WebLogic RollbackException object

This rule detects the use of the weblogic.transaction.RollbackException object and flags it for manual migration.

No
Do not use WebLogic servlet attributes for XML parsing

This rule detects the use of setAttribute and getAttribute methods used with specific attributes to parse XML.

The quick fix removes the entries.

No
Do not use WebLogic ServletAuthentication class

This rule detects the class weblogic.servlet.security.ServletAuthentication which cannot be used in WebSphere.

No
Do not use WebLogic-specific JDBC properties or extensions

This rule detects the use of several WebLogic Server JDBC properties and extensions that must be manually migrated.

No
Do not use WebLogic-specific JNDI environment properties for initial context

This rule detects the use of the weblogic.jndi.Environment class to set context properties.

The quick fix migrates the objects used in the Environment references to a hash table used to initialize the InitialContext object.

No
Do not use WebLogic-specific JNDI property values or the t3 protocol

This rule detects the use of the following proprietary JNDI name values:

  • java.naming.factory.initial = weblogic.jndi. WLInitialContextFactory
  • java.naming.provider.url = t3://localhost:7001

If found, users are given the option to change the JNDI names to default portable JNDI name values:

  • java.naming.factory.initial = com.ibm.websphere.naming. WsnInitialContextFactory
  • java.naming.provider.url = corbaloc:iiop:localhost:2809
Restriction: The JNDI name values must be in the same Java source file where the context is initialized with the javax.naming. InitialContext(Hashtable) constructor.
No
Do not use WebLogic-specific packages This rule detects imported classes that begin with weblogic but not including the weblogic.apache classes. The flagged server-specific APIs must be migrated. No
Do not use WebLogic-specific SSL protocols This rule detects instances of the string literal "com.certicom.net.ssl" and "weblogic.net" in Java files. No
Do not use WebLogic startup or shutdown classes

This rule detects classes that implement the WebLogic Server startup and shutdown interfaces.

The quick fix converts these classes to use the javax.servlet.ServletContextListener interface and registers it in the web.xml file of the application.

No
Do not use WebLogic StAX objects

This rule detects the use of WebLogic Server proprietary XML Streaming (StAX) objects that must be migrated manually.

No
Do not use WebLogic TransactionManager object

This rule detects the use of the TransactionManager object and flags it for manual migration.

No
Do not use WebLogic Transaction object

This rule detects the use of the Transaction object and flags it for manual migration.

No
Do not use WebLogic TransactionSynchronizationRegistry object

This rule detects the use of the TransactionSynchronizationRegistry object and flags it for manual migration.

No
Do not use WebLogic WLLevel object

This rule detects WLLevel object usage in a setLevel() method.

The quick fix converts the WLLevel to IBM WsLevel. The level is controlled by the user using rule properties.

No
Do not use WebLogic XPath objects

This rule detects the use of WebLogic Server proprietary, XML XPath objects and flags them for manual migration.

No
Migrate MBeans specific to other application servers

This rule detects all invocations of the javax.management.ObjectName constructor that might be application-server specific and would need to be migrated for the application to run on WebSphere Application Server.

No
Use compliant UserTransaction lookup name

This rule detects references to ctx.lookup("javax.transaction. UserTransaction").

Within bean managed transaction (BMT) beans, the quick fix converts the flagged line to ctx.getUserTransaction().

Within servlets, Web applications and client code, the flagged line is converted to the JNDI lookup: ctx.lookup("java:comp/UserTransaction")

No
Use matching throws clause in EJB bean class

This rule detects mismatches between the enterprise bean implementation and the method definitions in the home and remote interfaces.

The quick fix adds any missing exceptions and removes any additional exceptions. The interfaces are not changed.

No
Use portable JNDI names This rule detects the use of the constructor, javax.naming.InitialContext(Hashtable), specifying not to put any proprietary WebLogic Server JNDI name values into the hash table. No
Use unitName attribute for Injected JPA Elements

This rule detects injected JPA PersistenceContext or PersistenceUnit elements without unitName or name attributes.

The quick fix adds the missing values to offer similar behavior to WebLogic Server automated deployment.

No
Validate the result of concatenation with getRealPath("") In WebSphere traditional, getRealPath("") returns a String that ends in a trailing slash. Check that concatenation with this method does not add an extra slash. No
Validate the result of concatenation with getRealPath("*/") In Liberty and WebSphere traditional, getRealPath("*/") returns a String that ends in a trailing slash. Check that concatenation with this method does not add an extra slash. No
WebLogic packages and classes are not supported in WebSphere

This rule detects the use of WebLogic string literals in Java code and property files. All string literals that include "weblogic" are flagged. Use packages, classes, and properties provided by Java EE or WebSphere Application Server instead.

No

WebLogic used Kodo for its JPA 1.0 provider implementation. Similarly, OpenJPA was the WebSphere default JPA provider for JPA 1.0 and 2.0. The following rules handle WebLogic Server migration to JPA 2.0 or earlier:

Rule Name Rule Description Automated Fix
Do not use Kodo APIs that have no OpenJPA equivalent

This rule detects the use of specific kodo import statements that do not have equivalent openJPA imports.

These references are flagged so you can evaluate their usage and migrate manually.

No
Do not use Kodo properties that have no openJPA equivalent

This rule detects JPA properties that start with kodo.* in java files but have no equivalent openJPA values.

No
Use OpenJPA equivalent APIs instead of Kodo APIs

This rule detects WebLogic Server kodo import statements that have an OpenJPA equivalent.

The quick fix replaces them with openJPA equivalent import statements.

No
Use OpenJPA equivalent property names instead of Kodo-specific property names

This rule detects the presence of known JPA properties with a name starting with kodo.* in Java files.

The quick fix renames these properties to openjpa.*.

No
Use OpenJPA property values instead of Kodo-specific property values

This rule detects the JPA properties with kodo specific values in Java files.

The quick fix changes these values to valid openJPA values.

No

Starting with JPA 2.1, WebSphere switched to EclipseLink as its default JPA provider. The following rules handle WebLogic Server migration to JPA 2.1 or later:

Rule Name Rule Description Automated Fix
Do not use Kodo API calls

This rule detect Kodo APIs that need to be migrated to EclipseLink.

These references are flagged so you can evaluate their usage and migrate manually.

No
Do not use Kodo properties

This rule detects Kodo properties that need to be migrated to EclipseLink.

No