content="The J2EE checklist helps you identify problems that might be occurring from your EJBs, dynamic web projects or your web services applications or tools." /> content="The J2EE checklist helps you identify problems that might be occurring from your EJBs, dynamic web projects or your web services applications or tools." />
EJB troubleshooting checklist
The EJB checklist presents various questions or tasks that you can go through to help determine or eliminate possible problems that are preventing you from successfully doing what you want to do within this product.
Some of the items in this checklist are merely things you should ask yourself during your troubleshooting process and some are tips or links to information you might find useful.
Jump to a section below that best describes what you were trying to do:
- I am working with an EJB project
- I am creating an session EJB
- I am creating a container-managed persistance (CMP) EJB
- I am creating a bean-managed persistance (BMP) EJB
- I am mapping my EJBs to my backend database
- I am creating a message-driven bean (MDB) EJB
- I am trying to deploy my EJBs
- I am having problems with the server
- I am ready to call support
Useful how-to information
For a step by step topic on developing EJBs within the help: Developing enterprise beans - overview
For a redbook on EJB strategies and development see: EJB 2.0 Development with WebSphere Studio Application Developer
For a help topic on how to test the logic of your EJB applications read: Creating tests for Enterprise javabeans
Problems with EJB Projects
Check how you have structured your application
- Look at your workspace and count how many EARs are there. How many enterprise applications do you have?
- How have you mapped your Enterprise Application modules (J2EE Application Client project, EJB project, or Web project) to your Enterprise Application project(s) (EAR project)?
Check to see if you have a classpath problem
- Are you using any java utilty projects or static JAR files? If you are using static JAR files where have you placed them?
- Place static JAR files in WEB-INF/lib if you are only using them in a web application or place them in the Enterprise Application (EAR) if you wish to share them between multiple Enterprise Application modules (Application Client, EJB, or WEB projects) or if being used by only your EJB application.
- Have all of your Project Utility JARs been mapped to the Enterprise Application module that they will be used in?
- Ensure that you have added your Java Project to the Project Utility JARs form on the Module page of the Enterprise Application deployment descriptor.
- Are you getting a java.lang.NoClassDefFoundError stack trace at runtime dealing with classes that are contained in the Java Utility project or static JAR file? Check your Java JAR Dependencies for your Enterprise Application module and ensure that all the required JAR files are checked off on this page (right click on the Project > Properties > Java JAR Dependencies).
- There are two different classpaths that you need to be concerned with when development and testing an Enterprise Application. The Java Build Path is the classpath that is used by the compiler to locate dependent classes for compilation purposes only. The Java JAR Dependencies (a front-end to the MANIFEST.MF file) is used by the runtime to locate dependent classes that are located in your Enterprise Application or in other Entperise Application modules contained within your Entperise Application. So in your workspace your application may compile properly and you might think that it is working but you need to ensure that the same JARs are visible at runtime by adding them on the Java JAR Dependencies page to avoid java.lang.NoClassDefFoundError errors from happening.
Always select the JAR files in Java JAR Dependencies first as it will automatically add the JAR files to your Java Build Path.
Check to see if your problem is a limitation with the specifications
- Are you developing EJB 1.1 or EJB 2.0? See the EJB specifications
- If you're developing EJB 2.0 are these local or remote interface EJBs?
- Are you developing J2EE 1.2 or 1.3 projects? See the J2EE specifications for 1.2 and 1.3
Problems with session beans
Is this a stateless or a stateful session bean?
Is your session bean using container managed or bean managed transactions?
Are all requires resource references defined correctly?
Problems with container managed beans
Are you trying to deploy your EJB to the server? Go to the related help topic
Does your application use EJB query langauge (QL)?
- Learn more about EJB QL in this help topic in WebSphere Application Server's information center.
- Does the error occur without the EJBQL? Check the EJB specification to see if what you are doing is possible
Problems with mapping your CMPs
Which database are you trying to map your EJBs to?Verify that your database metadata files are not currupted
Some EJB deploy code directly depends on the Database vendor type and Operating System that you choose.
For example, if you choose DB2 on Windows and generate the EJB deploy code, it is possible that it may fail if your intended runtime target is DB2 on z/OS. Make sure that your backend database defined for your EJB is your intented runtime database and Operating System so that when you generate the EJB deploy code it will be correct for that platform. The ideal situation is to have both development and production databases on the same platform; However, this may not be realistic so you can create multiple backends and switch between them in the EJB Deployment descriptor. Ensure that after you change your backend in the EJB Deployment descriptor that you generate the EJB deploy code again.
- Look in your EJB modules backend folder in your workspace. Can all the tables listed in the database and schema definition file be opened using their corresponding editors?
- If the answer is yes, then your metadata files are ok
- If the answer is no, then try to import the database information again by using the EJB to RDB Mapping wizard (right-click on your EJB project > EJB to RDB Mapping > Generate Map) and use your new backend information.
Verify that you have mapped your EJB to your database correctly: (The following are yes or no questions to jog your mind)
- Are all the ejb attributes and corresponding tables mapped?
- Are the defined ejb relationships correct given the actual relationships among the tables?
Are the CMRs properly mapped to the Foreign Key constraints?
Problems with message-driven beans
Are Queues/Topics and their connection factories properly configured?
Are the listener ports defined?
Are the JNDI names properly specified?
Is JAAS security id specified correctly and used if required by a connection factory?
EJB App Exceptions are not thrown by MDBs as they have no client to intercept them
Problems with bean managed persistance EJBs
BMP EJBs are an advanced programming model. The best resources for debugging your code or learning about how to write BMPs are books on the topic. See the useful how-to information at the top of this topic for links to books.
Problems with deploying your EJBs
Is the datasource JNDI name correctly associated with the ejb projects or individual cmp ejbs?
Is the correct backend ID specified in the WebSphere bindings section of the EJB Deployment Descriptor?
- An EJB project may have multiple backends and each one needs to have it's EJB deploy code generated
Are transactional attributes and access intents specified in the EJB Deployment descriptor and understood?
Does the generate code work correctly?
The best source for this information is in the WebSphere Application Server information center. See this listed in the Information Centers and Libraries site
- Have you tried to debug or step through the generated code to identify the bad code or queries being used? This is a difficult task and depends on your skill level.
When troubleshooting ejbdeploy problems, go through the tooling first before you debug your generated code.
Is this a server configuration issue?
The best source for server related information is in the WebSphere Application Server information center. See this listed in the Information Centers and Libraries site . Questions you might want to ask yourself are:
Which version of the server is indicated in your console?
Is this a datasource configuration issue?
Does the server start cleanly?
Is this a server runtime issue?
The best source for server related information is in the WebSphere Application Server information center. See this listed in the Information Centers and Libraries site . Questions you might want to ask yourself are:
Check the Websphere Troubleshooting tips
Is this a classloading issue?
Is this a DataSource configuration issue?
Does the server start cleanly?
Before you call support about your EJBs
- Save your configuration and restart the server
- Create a reproducable test case
- Write down any error messages you are getting
- About calling support
Parent topic: Configuration checklist
Related tasks
Introduction to troubleshooting
Contacting IBM Software Support