cancel
Showing results for 
Search instead for 
Did you mean: 

Custom adapter module for JMS

Former Member
0 Kudos

I've written a custom EJB for receiver JMS adapter. The intention is to remove a special character and hopefully LF at the end. I've run into an issue and I'm sorting big time help.

My code at this point is really simple, all it contains is an entry into audit log that the module was called. Its calling but is ending with an error. Here's the error

<b>Caused by: java.lang.NoClassDefFoundError: com/sap/aii/af/service/auditlog/AuditMessageKey

at com.gy.jms.RemoveCharactersBean.process(RemoveCharactersBean.java:75)</b>

And snippet of my code (RemoveCharactersBean) as follows -

// classes for audit log (I've used the jar from SP16 the one we are on in NWDS and I see that in my class path)

import com.sap.aii.af.service.auditlog.*;

public ModuleData process(

ModuleContext moduleContext,

ModuleData inputModuleData)

throws ModuleException {

Message msg = (Message) inputModuleData.getPrincipalData();

AuditMessageKey amk =

new AuditMessageKey(msg.getMessageId(), AuditDirection.OUTBOUND);

Audit.addAuditLogEntry(

amk,

AuditLogStatus.SUCCESS,

"RemoveCharacterBean: Module called");

return inputModuleData;

}

Any idea why I'm getting this message?

I appreciate all your help.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

This class AuditMessageKey is inside the jar file

<b>aii_af_svc.jar</b>.

I guess you must be having this file on your classpath when you compiled the your custom module. That is not the end but. You additionally need to specify references to your jar files in the application-j2ee-engine.xml file in the EAR project. For me , the audit logs work fine when I add the following application-j2ee-engine.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application-j2ee-engine SYSTEM "application-j2ee-engine.dtd">
<application-j2ee-engine>
	<reference 
		reference-type="weak">
		<reference-target 
			provider-name="sap.com" 
			target-type="library">com.sap.aii.af.lib</reference-target>
	</reference>
	<reference 
		reference-type="weak">
		<reference-target 
			provider-name="sap.com" 
			target-type="service">com.sap.aii.adapter.xi.svc</reference-target>
	</reference>
	<reference 
		reference-type="weak">
		<reference-target 
			provider-name="sap.com" 
			target-type="service">com.sap.aii.af.svc</reference-target>
	</reference>
	<reference 
		reference-type="hard">
		<reference-target 
			provider-name="sap.com" 
			target-type="service">com.sap.aii.af.cpa.svc</reference-target>
	</reference>
	<provider-name>sap.com</provider-name>
	<fail-over-enable 
		mode="disable"/>
</application-j2ee-engine>

Additionally, you also need a file with name <b>log-configuration.xml</b> <i><b>at the same level as that of application-j2ee-engine.xml</b></i> in the EAR project when you use audit logs. Copy the following contents in this file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log-configuration SYSTEM "log-configuration.dtd">
<log-configuration>
	<log-formatters>
		<!-- This formatter produces human readable messages. -->
		<log-formatter 
			name="trc" 
			pattern="%26d %150l [%t] %10s: %m" 
			type="TraceFormatter"/>
	</log-formatters>
	<log-destinations>
		<!-- Destination for Trace Information of this sample -->
		<log-destination 
			count="5" 
			effective-severity="DEBUG" 
			limit="2000000" 
			name="sample.trc" 
			pattern="./log/applications/sample/default.trc" 
			type="FileLog">
			<formatter-ref 
				name="trc"/>
		</log-destination>
	</log-destinations>
	<log-controllers>
		<!-- Trace Location sample -->
		<log-controller 
			effective-severity="DEBUG" 
			name="sample">
			<associated-destinations>
				<destination-ref 
					association-type="LOG" 
					name="sample.trc"/>
			</associated-destinations>
		</log-controller>
		<!-- Logging Category: none, use the default XILog  -->
	</log-controllers>
</log-configuration>

Regards,

Amol