Friday 27 March 2020

Some Exceptions in Websphere Application Server

Hi Friends , today we will discuss about some errors and exceptions in WAS.

 Application profiling exceptions :

The following exceptions are thrown in response to various illegal actions related to application profiling. 
com.ibm.ws.exception.RuntimeWarning : This exception is thrown when the application is started, if the application is configured incorrectly. The startup is consequently terminated. Some examples of bad configurations include: v A task configured on two different application profiles. v A method configured with two different task run-as policies . 

com.ibm.websphere.appprofile.IllegalTaskNameException : This exception is raised if an application attempts to programmatically set a task when that task has not been configured as a task name reference.


Error: java.lang.NoClassDefFoundError:

Explaination: This exception is thrown when Java code cannot load the specified class.
Possible Cause: Invalid or non-existent class v Class path problem v Manifest problem
Recommndation: 
 Check to determine if the specified class exists in a Java Archive (JAR) file within your Enterprise  Archive (EAR) file. If it does, make sure the path for the class is correct. 

For example, if you get the exception: java.lang.NoClassDefFoundError: WebSphereSamples.HelloEJB.HelloHome verify that the HelloHome class exists in one of the JAR files in your EAR file. If it exists, verify that the path for the class is WebSphereSamples.HelloEJB

If both the class and path are correct, then it is a class path issue. Most likely, you do not have the failing class JAR file specified in the client JAR file manifest. To verify this situation, perform the following steps:

1. Open your EAR file with an assembly tool, and select the Application Client. 
2. Add the names of the other JAR files in the EAR file to the Classpath field. This exception is generally caused by a missing Enterprise Java Beans (EJB) module name from the Classpath field.

 If you have multiple JAR files to enter in the Classpath field, be sure to separate the JAR names with spaces.

com.ibm.websphere.ce.cm.StaleConnectionException: [IBM][CLI Driver] SQL1013N The database alias name or database name “NULL” could not be found:

com.ibm.websphere.ce.cm.StaleConnectionException: [IBM][CLI Driver] SQL1013N The database alias name or database name “NULL” could not be found. SQLSTATE=42705. This error occurs when a data source is defined but the databaseName attribute and the corresponding value are not added to the custom properties panel.

To add the databaseName property: 
1. Click Resources > Manage JDBC Providers in the administrative console. 
2. Select the JDBC_provider that supports the problem data source. 
3. Select Data Sources and then select the problem data source. 
4. Under Additional properties, click Custom Properties. 
5. Select the databaseName property, or add one if it does not exist, and enter the actual database       
    name as the value. 
6. Click Apply or OK, and then click Save from the action bar.
7. Access the data source again

Transaction recovery failure (for XA data sources) Problem :

When WebSphere Application Server attempts to recover Oracle database transactions, the transaction service issues the following exception:

WTRN0037W: The transaction service encountered an error on an xa_recover operation. The resource was com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl@1114a62. The error code was XAER_RMERR. The exception stack trace follows: javax.transaction.xa.XAException at oracle.jdbc.xa.OracleXAResource.recover(OracleXAResource.java:726) at com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.recover(WSRdbXaResourceImpl.java:954) at com.ibm.ws.Transaction.JTA.XARminst.recover(XARminst.java:137) at com.ibm.ws.Transaction.JTA.XARecoveryData.recover(XARecoveryData.java:609) at com.ibm.ws.Transaction.JTA.PartnerLogTable.recover(PartnerLogTable.java:511) at com.ibm.ws.Transaction.JTA.RecoveryManager.resync(RecoveryManager.java:1784) at com.ibm.ws.Transaction.JTA.RecoveryManager.run(RecoveryManager.java:2241)


Cause:
Oracle requires services such as the WebSphere Application Server transaction service to have special permissions for performing transaction recoveries.

Solution :

As user SYS, run the following commands on your Oracle server:

grant select on pending_trans$ to public;
grant select on dba_2pc_pending to public; grant select on dba_pending_transactions to public;
grant execute on dbms_system to ;

 User is a user ID in the application server that is authorized to perform transaction recovery for the XA data source. If you have not authorized any user IDs to perform transaction recovery, the application server uses the login alias for the data source as the user ID.