on 09-27-2007 1:06 PM
Here is my Module Code:
public ModuleData process(ModuleContext moduleContext,
ModuleData inputModuleData)
throws ModuleException {
try {
java.io.FileOutputStream fos =
new java.io.FileOutputStream("/ModuleData_process.txt");
fos.write(("Parameter debug.n").getBytes());
if (moduleContext == null) {
fos.write(("Module Context is NULL!n").getBytes());
}
if (moduleContext.getContextData("parameterName") == null) {
fos.write(("parameter is NULL.n").getBytes());
}
String parameter = moduleContext.getContextData("parameterName");
fos.write(("parameterName value: " + parameter + "n").getBytes());
java.util.Enumeration enumKeys = moduleContext.getContextDataKeys();
while (enumKeys.hasMoreElements()) {
Object obj = enumKeys.nextElement();
fos.write(("obj to String is: " + obj.toString()).getBytes());
fos.write(("Value: " +
moduleContext.getContextData(obj.toString())).getBytes());
}
} catch (Exception e){
// Do nothing
}
....
The configuration scrennshot can not be uploaded here becuase the forum does not support it but I will gladly email it to anyone that is interested. Basically I have configured an adaptor module with a module key and the module key is used to define paramter name and values.
This module throws and internal server error and the contents of the file "/ModuleData_process.txt" are only:
"
Parameter debug.
"
Therefore I can only conclude that the idea of:
String parameter = moduleContext.getContextData("parameterName");
is a good one but does not work at all.
Am I right? Have I made a mistake? Is the another way to parameterise an EJB?
Thanks,
Doug
Hi Douglas,
Use
String parameter = (String) moduleContext.getContextData("parameterName");
instead of
String parameter = moduleContext.getContextData("parameterName");
Because method getContextData will not return a string.
Regards,
Ibrahim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the help Ibrahim,
I tried to cast the getContextData return to a string but the result is exactly the same.
I looked at the api and the return type is a String
public java.lang.String getContextData(java.lang.String name);
Therefore casting a String to a String is not likely to fix this and it did not.
However it was worth a try.
Thanks again,
Doug
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.