I'm facing a NoClassDefFoundError for com.sap.aii.security.lib.exception.SecurityException in my EJB project, which is deployed on SAP NetWeaver. Here are the details:
Project Setup:
- IDE: NetWeaver Developer Studio (NWDS Eclipse)
- Application Server: SAP PO (Process Orchestration)
- Project Structure: EAR project containing an EJB module and a Dynamic Web Project (DWP)
Problem:
- When my EJB bean executes the following line, I encounter a NoClassDefFoundError:
SAPSecurityResources secRes = SAPSecurityResources.getInstance();
Here's the error stack trace:
javax.ejb.EJBException: nested exception is: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sap/aii/security/lib/exception/SecurityException ...Caused by: java.lang.ClassNotFoundException: com.sap.aii.security.lib.exception.SecurityException ...Loader Info: ClassLoader name: [sap.com/myclient2partyLdap-ear-jp-library-loader] ... /usr/sap/PO1/J00/j2ee/cluster/apps/sap.com/myclient2partyLdap-ear-jp/app_libraries_container/lib/com.sap.security_2.0.0.201214143317.jar
According to the com.sap.aii.af.service.resource > Class SAPSecurityResources Javadoc, only com.sap.aii.af.svc.facade jar file is needed to make an instance of SAPSecurityResources object if you want to access KeyStoreManager and manage certificates, but somehow my code doesn't run.
Any help or suggestions to resolve this issue would be greatly appreciated.
Thank you!
Steps I Have Taken:
- Added JARs to the EAR lib directory:Placed the required JAR files in the lib directory of the EAR project.
- Verified EAR Deployment Assembly:Ensured that the lib directory is included in the deployment assembly of the EAR project.
- Configured EJB and Web Projects:Added the same JAR files to the build path of both the EJB and DWP projects in Eclipse.
This is usually sufficient to add jar files in the buildpath or in Deployment Assembly and that is why I was not expecting this error at the least. I do not even access the mentioned class directly in the code. The code does not give any "unresolved reference" error.
P.S I have accessed keystore views in java mappings using the exact same API but in the setup mentioned above I get the NoClassDefFoundError.