Module in Java?
I need an answer for this question, pls
A module in Java is called a
A.) method
B.) procedure
C.) function
D.) Sub procedure
E.) None of these above
thank you
Hmm, try this URL http://java.sun.com/reference/glossary/index.html#M
To save you the time, since you don't seem to like reading posts
A software unit that consists of one or more J2EE components of the same container type and one deployment descriptor of that type. There are three types of modules: EJB, web, and application client. Modules can be deployed as stand-alone units or assembled into an application.
Similar Messages
-
Problem calling two perl modules from java in seperate threads(JVM CRASHES)
Dear Friends,
I have one severe problem regarding calling perl modules from java
I had to call two perl modules simultaneously (i.e.) from two threads,,, but jvm crashes when one of the perl calls is exiting earlier
I am unable to spot out why ....
For calling perl from java ...., We are first calling C code from java using JNI and then Perl code from C
All works fine if we call only one perl call at a time.... If we call them in a synchronized manner the JVM is not crashing .... But we don't want blocking..
The following is the code snippet
<JAVA FILE>
class Sample
static {
System.loadLibrary("xyz"); // Here xyz is the library file generated by compiling c code
public native void call_PrintList();
public native void call_PrintListNew();
Sample()
new Thread1(this).start();
public static void main(String args[])
System.out.println("In the main Method");
new Sample().call_PrintList();
class Thread1 extends Thread
Sample sample;
Thread1(Sample sam)
sample=sam;
public void run()
sample.call_PrintListNew();
}<C FILE>
#include <EXTERN.h>
#include <perl.h>
static PerlInterpreter *my_perl;
static char * words[] = {"alpha", "beta", "gamma", "delta", NULL } ;
static void
call_PrintList(){
printf("\nIn the Call method of string.c\n");
char *wor[] = {"hello", "sudha", NULL } ;
char *my_argv[] = { "", "string.pl" };
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
PL_perl_destruct_level = 1; //// We have mentioned this also and tried removing destruct call
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);
dSP ;
perl_call_argv("PrintList", G_DISCARD, wor) ;
PL_perl_destruct_level = 1;
// perl_destruct(my_perl);
// perl_free(my_perl);
// PERL_SYS_TERM();
static void
call_PrintListNew(){
printf("In the new call method\n");
char *wor[] = {"Hiiiiiiiiiiiiiii", "Satyam123333", NULL } ;
char *my_argv[] = { "", "string.pl" };
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
PL_perl_destruct_level = 1;
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);
dSP ;
perl_call_argv("PrintListNew", G_DISCARD, wor) ;
PL_perl_destruct_level = 1;
// perl_destruct(my_perl);
// perl_free(my_perl);
// PERL_SYS_TERM();
void callNew()
call_PrintListNew();
void call ( )
call_PrintList();
//char *wor[] = {"hello","sudha",NULL};
/* char *my_argv[] = { "", "string.pl" };
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);*/
// call_PrintList(); /*** Compute 3 ** 4 ***/
/* perl_destruct(my_perl);
perl_free(my_perl);
PERL_SYS_TERM();*/
}And Finally the perl code
sub PrintList
my(@list) = @_ ;
foreach (@list) { print "$_\n" }
sub PrintListNew
my(@list) = @_ ;
foreach (@list) { print "$_\n" }
}Please help me in this regardDear Friends,
I have one severe problem regarding calling perl modules from java
I had to call two perl modules simultaneously (i.e.) from two threads,,, but jvm crashes when one of the perl calls is exiting earlier
I am unable to spot out why ....
For calling perl from java ...., We are first calling C code from java using JNI and then Perl code from C
All works fine if we call only one perl call at a time.... If we call them in a synchronized manner the JVM is not crashing .... But we don't want blocking..
The following is the code snippet
<JAVA FILE>
class Sample
static {
System.loadLibrary("xyz"); // Here xyz is the library file generated by compiling c code
public native void call_PrintList();
public native void call_PrintListNew();
Sample()
new Thread1(this).start();
public static void main(String args[])
System.out.println("In the main Method");
new Sample().call_PrintList();
class Thread1 extends Thread
Sample sample;
Thread1(Sample sam)
sample=sam;
public void run()
sample.call_PrintListNew();
}<C FILE>
#include <EXTERN.h>
#include <perl.h>
static PerlInterpreter *my_perl;
static char * words[] = {"alpha", "beta", "gamma", "delta", NULL } ;
static void
call_PrintList(){
printf("\nIn the Call method of string.c\n");
char *wor[] = {"hello", "sudha", NULL } ;
char *my_argv[] = { "", "string.pl" };
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
PL_perl_destruct_level = 1; //// We have mentioned this also and tried removing destruct call
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);
dSP ;
perl_call_argv("PrintList", G_DISCARD, wor) ;
PL_perl_destruct_level = 1;
// perl_destruct(my_perl);
// perl_free(my_perl);
// PERL_SYS_TERM();
static void
call_PrintListNew(){
printf("In the new call method\n");
char *wor[] = {"Hiiiiiiiiiiiiiii", "Satyam123333", NULL } ;
char *my_argv[] = { "", "string.pl" };
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
PL_perl_destruct_level = 1;
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);
dSP ;
perl_call_argv("PrintListNew", G_DISCARD, wor) ;
PL_perl_destruct_level = 1;
// perl_destruct(my_perl);
// perl_free(my_perl);
// PERL_SYS_TERM();
void callNew()
call_PrintListNew();
void call ( )
call_PrintList();
//char *wor[] = {"hello","sudha",NULL};
/* char *my_argv[] = { "", "string.pl" };
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
perl_construct( my_perl );
perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);*/
// call_PrintList(); /*** Compute 3 ** 4 ***/
/* perl_destruct(my_perl);
perl_free(my_perl);
PERL_SYS_TERM();*/
}And Finally the perl code
sub PrintList
my(@list) = @_ ;
foreach (@list) { print "$_\n" }
sub PrintListNew
my(@list) = @_ ;
foreach (@list) { print "$_\n" }
}Please help me in this regard -
Hi All,
When i am running a scenario i am getting the below error in the 'error log ' file....Please let me know any pointers on the same.. its urgent:-
=========================================================
[oraodi@apo13100098 error]$ cat SIL_TIMEDIMENSION_CALCONFIG.30402.log
12/15/11 10:26 AM :
Session No-> 30402
Package Name-> SIL_TIMEDIMENSION_CALCONFIG
Step Name-> SIL_TimeDimension_CalConfig.MCAL_CONFIG_G
Error Details->
org.apache.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 2, in ?
ImportError: no module named java
at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlC.treatTaskTrt(SnpSessTaskSqlC.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandScenario.treatCommand(DwgCommandScenario.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.e.y(e.java)
at com.sunopsis.dwg.DwgJv.treatCmd(DwgJv.java)
at com.sunopsis.dwg.DwgJv.main(DwgJv.java)
at oracle.odi.Agent.main(Agent.java)
===========================================================================================
Cheers
ManojHi Venkat,
The error got resolved after adding '/usr/kerberos/bin:/usr/local/bin' to my PATH variable.
cheers
Manoj -
ImportError: no module named java
One of our customers is using Windows XP SP 3 and they are running into below error when packages are run.
It is happening at a specific step in IKM where Jython techonology is used. But this kind of issue never occured in dev/qa environments.
Any hint is greatly appreciated.
One more thing is customer is on 10.1.3.4, while delivered code was on 10.1.3.4.4 . Could that cause any issues?
==================================================================
org.apache.bsf.BSFException: exception from Jython: Traceback (innermost last):
File "<string>", line 1, in ?
ImportError: no module named java
at org.apache.bsf.engines.jython.JythonEngine.exec(Unknown Source)
at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.g.y(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Thread.java:619)
==================================================================Hi,
has anyone idea how to resolve this problem? I've error when I try to start Journal:
org.apache.bsf.BSFException: exception from Jython: Traceback (innermost last):
File "<string>", line 1, in ?
ImportError: no module named java
at org.apache.bsf.engines.jython.JythonEngine.exec(Unknown Source)
at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlC.treatTaskTrt(SnpSessTaskSqlC.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.g.y(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Unknown Source)
Any idea what should I do ? JKM which I use is: JKM HSQL.
Thanks for help.
===========================================
EDIT:
Solution for my problem was running Designer as Administrator. (Win 7). -
Revision: 758
Author: [email protected]
Date: 2008-03-07 10:47:56 -0800 (Fri, 07 Mar 2008)
Log Message:
Updating all modules to Java 1.5.0 and Ant 1.7.0
* Updated setup.sh to reflect this.
* Added an Eclipse project called flex-asc; it's required to run the other compiler projects now (now you can build and debug the entire compiler, including asc, all in Eclipse; I've removed the reference to asc.jar).
* The other Eclipse projects now specify Java 1.5.
* Revving asc.jar for compatibility with Java 1.5; it's taken from the 3.0.x branch temporarily while mainline asc is fixed up.
* Fixed some assertions in mainline ASC (commenting them out with comments means fixing them, in this case)
* Fixed some in-your-face warnings in the modules when compiling.
* This will probably break the build, so hold tight. Preemptively, I'm on it...
Modified Paths:
flex/sdk/trunk/README.txt
flex/sdk/trunk/development/eclipse/java/flex-compiler/.classpath
flex/sdk/trunk/development/eclipse/java/flex-compiler/.settings/org.eclipse.jdt.core.pref s
flex/sdk/trunk/development/eclipse/java/flex-compiler/.settings/org.eclipse.jdt.ui.prefs
flex/sdk/trunk/development/eclipse/java/flex-debugger/.classpath
flex/sdk/trunk/development/eclipse/java/flex-debugger/.settings/org.eclipse.jdt.core.pref s
flex/sdk/trunk/development/eclipse/java/flex-debugger/.settings/org.eclipse.jdt.ui.prefs
flex/sdk/trunk/development/eclipse/java/flex-jars/.classpath
flex/sdk/trunk/development/eclipse/java/flex-swfutils/.classpath
flex/sdk/trunk/development/eclipse/java/flex-swfutils/.settings/org.eclipse.jdt.core.pref s
flex/sdk/trunk/development/eclipse/java/flex-swfutils/.settings/org.eclipse.jdt.ui.prefs
flex/sdk/trunk/lib/asc.jar
flex/sdk/trunk/modules/antTasks/build.xml
flex/sdk/trunk/modules/asc/README.txt
flex/sdk/trunk/modules/asc/build/java/build.xml
flex/sdk/trunk/modules/asc/src/java/macromedia/asc/embedding/LintEvaluator.java
flex/sdk/trunk/modules/asc/src/java/macromedia/asc/parser/MetaDataEvaluator.java
flex/sdk/trunk/modules/asc/src/java/macromedia/asc/util/Context.java
flex/sdk/trunk/modules/compiler/build.xml
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/API.java
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/config/ConfigurationBuffer.java
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/swc/zip/ZipEntry.java
flex/sdk/trunk/modules/compiler/src/java/flex2/tools/ToolsConfiguration.java
flex/sdk/trunk/modules/compiler/src/java/flex2/tools/oem/Library.java
flex/sdk/trunk/modules/debugger/build.xml
flex/sdk/trunk/modules/swfutils/build.xml
flex/sdk/trunk/modules/swfutils/src/java/flash/util/ExceptionUtil.java
flex/sdk/trunk/setup.sh
Added Paths:
flex/sdk/trunk/development/eclipse/java/flex-asc/
flex/sdk/trunk/development/eclipse/java/flex-asc/.classpath
flex/sdk/trunk/development/eclipse/java/flex-asc/.project
flex/sdk/trunk/development/eclipse/java/flex-asc/.settings/
flex/sdk/trunk/development/eclipse/java/flex-asc/.settings/org.eclipse.jdt.core.prefs
flex/sdk/trunk/development/eclipse/java/flex-asc/.settings/org.eclipse.jdt.ui.prefs
flex/sdk/trunk/development/eclipse/java/flex-jars/.settings/
flex/sdk/trunk/development/eclipse/java/flex-jars/.settings/org.eclipse.jdt.core.prefs
Property Changed:
flex/sdk/trunk/development/eclipse/java/flex-compiler/
flex/sdk/trunk/development/eclipse/java/flex-debugger/
flex/sdk/trunk/development/eclipse/java/flex-jars/
flex/sdk/trunk/development/eclipse/java/flex-swfutils/I'm expieriencing the very same problem, i.e. code compilation with a 1.5.0_06 compiler and execution on a 1.5.0_06 jre works fine, but the code parser will display an red line under a code line like the following:
Vector<String> sv = new Vector<String>();
I did what was hinted to in the reply. I connected to archive rt.jar in the jre-director of the jdk-1.5 and connected the javadoc for 1.5, but I still have the red lines.
I have also added the argument -source 1.5 to the compiler, but nothing seems to help.
Any hints very much appreciated. Many thanks.
Pasqualino -
I am wondering if it is possible to create a PAM module in java, as opposed to C/C++.
If yes, how would I get started?java integrates already the PAM concept (which seems comes from sun laboratories and integrated firstly in solaris, i'm right?) in java through the JAAS api.
JAAS is already integrated in java since java 1.4.
so, the PAM concept (pluggable authenticable module) is mapped to the javax.security.auth.spi.LoginModule interface.
so, to add a PAM to your java application, you should provide a LoginModule implementation.
hope it helps,
Charles(jGuard team). -
Independent modules in java?
Hello,
How do you program independent modules in Java?
With that I mean a module that can be loaded during run-time which extends the functionality of the program.
What I want to do is a small "desktop-friend" which is animated and new animations/functionality can be added to it without recompiling the code.
thanx in advance
FreeriderHi,
How do you program independent modules in Java?
With that I mean a module that can be loaded during
run-time which extends the functionality of the
program. If I understood correctly what you could probably do is to write an interface which describes the basic set of services or functionality what you implementing classes (modules) have. Then you can have some abstract class which implements this interface (or interfaces even) and has some basic common methods and basic implementation for all your upcoming classes (modules).
In the interface you could have a separate method or methods that return the services available to this specific class (module). Then you need to use the reflection api to dynamically instantiate the classes and invoke the services.
Of course you need to have a store (db, file system etc.) from which you build the list of available modules and maintain it.
Well, there are a lot of things to consider and this is just something to begin with... And of course, there are always many different ways to do the task...
Good luck!
Greets, Janne -
CNTL_ERROR while calling a function module from Java webdynpro
I am calling a RFC function module from javawebdynpro app
which inturn calls a function module performing BDC on CAPP transaction. When I run this from SE37 of the same system or a different system everything works fine. But when called from Java webdynpro app, it raises a CNTL_ERROR exception and creates a short dump.
Any help on this is highly appreciatedGood catch, BI Learner. This was exactly it: when assigning the values from SOURCEFIELDS directly to the import/export parameters, you have to make sure that the types are EXACTLY the same, otherwise it will not work (the routine stops with an error when calling the FM, but there is no dump).
Therefore, to solve my problem, I created the declarations precisely as expected by the FM and assigned the values to these fields:
DATA:
SOURCEVAL TYPE /BIC/OIINVQTY,
SOURCEUOM TYPE /BIC/OIUSUOM,
USITM TYPE /BIC/OIUSITM,
TARGETUOM TYPE /BIC/OIUSUOM,
CONVERTED_COST TYPE /BIC/OIINVQTY.
DATA PRODUCTION_UOM TYPE /BIC/OIUSUOM.
" get the Production UOM
SELECT SINGLE I~/BIC/USPRDUOM
FROM /BIC/PUSITM AS I
INTO PRODUCTION_UOM
WHERE I~/BIC/USITM = SOURCE_FIELDS-/BIC/USITM AND I~OBJVERS = 'A'.
IF ( SY-SUBRC = 4 ). " no records found
"RAISE PARTNO_NOT_FOUND.
RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD.
ENDIF.
" load the parameters
SOURCEVAL = SOURCE_FIELDS-/BIC/USFRZMFC.
SOURCEUOM = SOURCE_FIELDS-BASE_UOM.
USITM = SOURCE_FIELDS-/BIC/USITM.
" then you can call the FM
CALL FUNCTION 'Z_CA_CONVERT_US_COST'
EXPORTING
PSOURCEVAL = SOURCEVAL
PSOURCEUOM = SOURCEUOM
PUSITM = USITM
PTARGETUOM = PRODUCTION_UOM
IMPORTING
PTARGETVAL = CONVERTED_COST
EXCEPTIONS
CONVERSION_NOT_MAINTAINED = 1
PARTNO_NOT_FOUND = 2
OTHERS = 3.
" ... [do the rest]
Thanks for your help,
Dennis -
How to load linux driver module in java
Hi
I am currently trying to load a Linux driver module dynamically from java to enable some kind of wireless communication using the System.load() method. But unfortunately, the module is a .ko file rather than a dynamic loadable library .so file in Linux, So that when I try to load this module, I get an error:
Can't load IA 32-bit .so on a IA 32-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1647)
at java.lang.Runtime.load0(Runtime.java:769)
at java.lang.System.load(System.java:968)
at test.main(test.java:10)
I wonder if this error is caused purely by the type of file or there might be some other reasons? It seems that all the linux drivers are .ko files, can any one help me to figure out a way of loading such linux drivers?
Thank you
SongCan any one give me some hint?
I am thinking about one possible solution: write a c program to load this module, then compile the c program to be a shared object library, and use jni to load this shared object library.
Does this work?
Thank you -
Problem while calling RFC function module in java
Hi all
com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed
Connect_PM GWHOST=<system.ab.ydydy.yyyd.com>, GWSERV=sapgw00, ASHOST=<system.ab.ydydy.yyyd.com>, SYSNR=00
LOCATION CPIC (TCP/IP) on local host
ERROR hostname '<system.ab.ydydy.yyyd.com>' unknown
TIME Mon Jun 06 14:50:25 2005
RELEASE 640
COMPONENT NI (network interface)
VERSION 37
RC -2
MODULE ninti.c
LINE 332
DETAIL NiPGetHostByName2: hostname '<system.ab.ydydy.yyyd.com>' not found
SYSTEM CALL gethostbyname_r
COUNTER 1
at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeConnect(Native Method)
at com.sap.mw.jco.rfc.MiddlewareRFC$Client.connect(MiddlewareRFC.java:1098)
at com.sap.mw.jco.JCO$Client.connect(JCO.java:2983)
at MyProject.Bapi2.<init>(Bapi2.java:43)
at MyProject.Bapi2.main(Bapi2.java:231)
Pl help me
pradeepHi
This is my code....
Created on Jun 2, 2005
To change the template for this generated file go to
Window>Preferences>Java>Code Generation>Code and Comments
package MyProject;
@author pradeep
To change the template for this generated type comment go to
Window>Preferences>Java>Code Generation>Code and Comments
import com.sap.mw.jco.*;
public class Bapi2 extends Object {
JCO.Client mConnection;
JCO.Repository mRepository;
public Bapi2() {
try {
// Change the logon information to your own system/user
mConnection =
JCO.createClient("122", // SAP client
"<pradeep>", // userid
"*****", // password
"EN", // language
"<abc11.aa.abc23.company.com>", // application server host name
"<00>");//system no
mConnection.connect();
mRepository = new JCO.Repository("HLL", mConnection);
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
JCO.Function function = null;
JCO.Table codes = null;
try {
function = this.createFunction("BAPI_COMPANYCODE_GETLIST");
if (function == null) {
System.out.println("BAPI_COMPANYCODE_GETLIST" +
" not found in SAP.");
System.exit(1);
mConnection.execute(function);
JCO.Structure returnStructure =
function.getExportParameterList().getStructure("RETURN");
if (! (returnStructure.getString("TYPE").equals("") ||
returnStructure.getString("TYPE").equals("S")) ) {
System.out.println(returnStructure.getString("MESSAGE"));
System.exit(1);
codes =
function.getTableParameterList().getTable("COMPANYCODE_LIST");
codes.setRow(2);
codes.deleteRow();
codes.deleteRow(5);
codes.appendRow();
codes.setValue("XXXX", "COMP_CODE");
codes.setValue("Does not exist", "COMP_NAME");
codes.appendRows(2);
codes.setValue("YYYY", "COMP_CODE");
codes.setValue("Does not exist either", "COMP_NAME");
codes.nextRow();
codes.setValue("ZZZZ", "COMP_CODE");
codes.setValue("Nor does this", "COMP_NAME");
for (int i = 0; i < codes.getNumRows(); i++) {
codes.setRow(i);
System.out.println(codes.getString("COMP_CODE") + '\t' +
codes.getString("COMP_NAME"));
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
try {
codes.firstRow();
for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {
function = this.createFunction("BAPI_COMPANYCODE_GETDETAIL");
if (function == null) {
System.out.println("BAPI_COMPANYCODE_GETDETAIL" +
" not found in SAP.");
System.exit(1);
function.getImportParameterList().
setValue(codes.getString("COMP_CODE"), "COMPANYCODEID");
mConnection.execute(function);
JCO.Structure returnStructure =
function.getExportParameterList().getStructure("RETURN");
if (! (returnStructure.getString("TYPE").equals("") ||
returnStructure.getString("TYPE").equals("S") ||
returnStructure.getString("TYPE").equals("W")) ) {
System.out.println(returnStructure.getString("MESSAGE"));
JCO.Structure detail =
function.getExportParameterList().
getStructure("COMPANYCODE_DETAIL");
System.out.println(detail.getString("COMP_CODE") + '\t' +
detail.getString("COUNTRY") + '\t' +
detail.getString("CITY"));
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
mConnection.disconnect();
public JCO.Function createFunction(String name) throws Exception {
try {
IFunctionTemplate ft =
mRepository.getFunctionTemplate(name.toUpperCase());
if (ft == null)
return null;
return ft.getFunction();
catch (Exception ex) {
throw new Exception("Problem retrieving JCO.Function object.");
public static void main (String args[]) {
Bapi2 app = new Bapi2();
This is the error i'm getting...
com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed
Connect_PM GWHOST=<abc11.aa.abc23.company.com>, GWSERV=sapgw00, ASHOST=<abc11.aa.abc23.company.com>, SYSNR=00
LOCATION CPIC (TCP/IP) on local host
ERROR hostname '<abc11.aa.abc23.company.com>' unknown
TIME Mon Jun 06 17:15:12 2005
RELEASE 640
COMPONENT NI (network interface)
VERSION 37
RC -2
MODULE ninti.c
LINE 332
DETAIL NiPGetHostByName2: hostname
'<abc11.aa.abc23.company.com>' not
at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeConnect(Native Method)
at com.sap.mw.jco.rfc.MiddlewareRFC$Client.connect(MiddlewareRFC.java:1098)
at com.sap.mw.jco.JCO$Client.connect(JCO.java:2983)
at MyProject.Bapi2.<init>(Bapi2.java:45)
at MyProject.Bapi2.main(Bapi2.java:233)
Thx
PRadeep -
Calling New Function Module from JAVA ISA b2b
I need to call a new function module which accepts some parameters as input and
returns some result parameters back as output.
These returned value needs to be displayed on the JSP pages of ISA B2B applications.
Can someone please guide me and provide code snippet on how to do this?
Thanks in advance.
Points will be awarded for all relevant and helpful answers.Stride,
I did this on CRM ISA 4.0... I used the dev and extension guide as a basis - I think the ISA 5.0 guide has the examples and tutorials in a separate document that can also be downloaded from service.sap.com.
Heres some info on how to do it although I can't guarantee this is the full solution or that it will work the same for ISA 5.0, and I will probably forget a lot of stuff as its been a few years since I did it! I also cant guarantee it is the correct way to do it but it worked! Basically, we built a link into the order overview page to display urls to order tracking websites using an RFC on the backend CRM system. Hope it helps anyway.
1. Create RFC enabled function module in backend.
2. Edit file backendobject-config.xml in folder project_root\b2b_z\WEB-INF\xcm\customer\modification:-
[code] <backendobject
xmlns:isa="com.sapmarkets.isa.core.config"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xml="http://www.w3.org/XML/1998/namespace">
<configs>
<!-- customer changes in backendobject-config should be done here by extending/overwriting the base configuration-->
<xi:include
href="$
Template for backend object in customer projects
Concrete implementation of a backend object
This implemenation demonstrates how a backend object
is used to communicate with the CRM system
@see com.ao.isa.backend.boi.Z_AOFuncBackend#getOrderDeliveryTrackingData(java.lang.String)
Interface used to communicate with a backend object
The purpose of this interface is to hide backend implementation details
from the business objects
Returns a vector of Z_OrderDeliverTracking objects containing data to link
to external delivery tracking websites
@param orderNo The sales order document number
@return A vector of order tracking objects
@return
@return
@return
@return
@return
@param string
@param string
@param string
@param string
@param string
/modification/backendobject-config.xml#xpointer(backendobject/configs/*)"/>
<!-- This is an example customer extension. A new Backend Object is registered in the framework using XCM extension mechanism. -->
<!-- If you write customer extensions you should register your backend objects in the same way. -->
<!-- Please make sure that you use the correct base configuration (e.g. crmdefault for CRM or r3default, r3pidefault for R/3) -->
<config
isa:extends="../config[@id='crmdefault']">
<businessObject
type="Z_AO_Custom"
name="Z_AO_Custom"
className="com.ao.isa.backend.crm.Z_AOFuncCRM"
connectionFactoryName="JCO"
defaultConnectionName="ISAStateless"/>
</config>
</configs>
</backendobject>
[/code]
File com.ao.isa.backend.crm.Z_AOFuncCRM.java looks like this :-
[code] package com.ao.isa.backend.crm;
//jco imports
import java.util.Vector;
import com.ao.isa.backend.boi.Z_AOFuncBackend;
import com.ao.isa.businessobject.order.Z_OrderDeliveryTrackingItem;
import com.sap.mw.jco.JCO;
import com.sap.mw.jco.JCO.ParameterList;
import com.sapmarkets.isa.core.eai.BackendException;
import com.sapmarkets.isa.core.eai.sp.jco.BackendBusinessObjectBaseSAP;
import com.sapmarkets.isa.core.logging.IsaLocation;
public class Z_AOFuncCRM
extends BackendBusinessObjectBaseSAP
implements Z_AOFuncBackend
// initialize logging
private static IsaLocation log =
IsaLocation.getInstance(Z_AOFuncCRM.class.getName());
/* (non-Javadoc)
public Vector getOrderDeliveryTrackingData(String orderNo)
Vector urlData = new Vector();
try
// get Java representation of function module
JCO.Function func =
getDefaultJCoConnection().getJCoFunction(
"Z_BAPI_CRM_ORDER_TRACKING_URLS");
// provide export parameters
ParameterList params = func.getImportParameterList();
params.setValue(orderNo, "ORDER_NO");
func.setExportParameterList(params);
// execute function
getDefaultJCoConnection().execute(func);
// get result table
JCO.Table table =
func.getTableParameterList().getTable("TRACKING_DATA");
int numRows = table.getNumRows();
for (int i = 0; i < numRows; i++)
// get row
table.setRow(i);
// create a new Z_orderdeliverytracking object
Z_OrderDeliveryTrackingItem trackItem =
new Z_OrderDeliveryTrackingItem(
table.getString(0),
table.getString(1),
table.getString(2),
table.getString(3),
table.getString(4));
urlData.addElement(trackItem);
trackItem = new Z_OrderDeliveryTrackingItem();
return urlData;
catch (BackendException bex)
// The following key has to be added to WEB-INF/classes/ISAResources.properties
// in order to see the exception correctly
log.config("ao.b2b.order.error.getOrderTrackingURLs", bex);
return null;
[/code]
And file com.ao.isa.backend.boi.Z_AOFuncBackend.java looks like this:-
[code] package com.ao.isa.backend.boi;
//package java.ao.com.ao.isa.backend.boi;
import java.util.Vector;
import com.sapmarkets.isa.core.eai.sp.jco.JCoConnectionEventListener;
public interface Z_AOFuncBackend
public Vector getOrderDeliveryTrackingData(String orderNo);
[/code]
Whilst file com.ao.isa.businessobject.order.Z_OrderDeliveryTrackingItem.java looks like this:-
[code]
package com.ao.isa.businessobject.order;
// Referenced classes of package com.sapmarkets.isa.businessobject.order:
// PaymentType
public class Z_OrderDeliveryTrackingItem // extends SalesDocument implements OrderData
private String deliveryDocNo;
private String goodsIssuedDate;
private String consignmentNo;
private String status;
private String url;
public Z_OrderDeliveryTrackingItem()
public Z_OrderDeliveryTrackingItem(
String delDocNo,
String GIDate,
String consNo,
String status,
String url)
this.setDeliveryDocNo(delDocNo);
this.setGoodsIssuedDate(GIDate);
this.setConsignmentNo(consNo);
this.setStatus(status);
this.setUrl(url);
public String getConsignmentNo()
return consignmentNo;
public String getDeliveryDocNo()
return deliveryDocNo;
public String getGoodsIssuedDate()
return goodsIssuedDate;
public String getStatus()
return status;
public String getUrl()
return url;
public void setConsignmentNo(String string)
consignmentNo = string;
public void setDeliveryDocNo(String string)
deliveryDocNo = string;
public void setGoodsIssuedDate(String string)
goodsIssuedDate = string;
public void setStatus(String string)
status = string;
public void setUrl(String string)
url = string;
[/code]
3. Edit file bom-config.xml in folder project_root\b2b_z\WEB-INF\xcm\customer\modification :-
[code] <BusinessObjectManagers
xmlns:isa="com.sapmarkets.isa.core.config"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xml="http://www.w3.org/XML/1998/namespace">
<!-- customer changes in bom-config should be done here by extending/overwriting the base configuration-->
<xi:include
href="$/modification/bom-config.xml#xpointer(BusinessObjectManagers/*)"/>
<!-- This is an example Business Object Manager. It can act as template for customer written Business Object Managers -->
<BusinessObjectManager
name="Z_AO-BOM"
className="com.ao.isa.businessobject.Z_AOBusinessObjectManager"
/>
</BusinessObjectManagers>
[/code]
File com.ao.isa.businessobject.Z_AOBusinessObjectManager.java looks like this:-
[code] package com.ao.isa.businessobject;
// Internet Sales imports
import com.sapmarkets.isa.core.businessobject.management.BOManager;
import com.sapmarkets.isa.core.businessobject.management.DefaultBusinessObjectManager;
import com.sapmarkets.isa.core.businessobject.BackendAware;
Template for a custom BusinessObjectManager in customer projects
public class Z_AOBusinessObjectManager
extends DefaultBusinessObjectManager
implements BOManager, BackendAware {
// key used for the backend object in customer version of backendobject-config.xml
public static final String CUSTOM_BOM = "Z_AO-BOM";
// reference to backend object
private Z_AOFunc mCustomBasket;
constructor
public Z_AOBusinessObjectManager() {
Method is called by the framework before the session is invalidated.
The implemenation of this method should free any allocated resources
public void release() {
Returns custom business object
public Z_AOFunc getCustomBasket() {
if (mCustomBasket == null) {
mCustomBasket = new Z_AOFunc();
assignBackendObjectManager(mCustomBasket);
return mCustomBasket;
[/code]
And uses file com.ao.isa.businessobject.Z_AOFunc.java which looks like this:-
[code]
package com.ao.isa.businessobject;
// Internet Sales imports
import com.sapmarkets.isa.core.businessobject.BOBase;
import com.sapmarkets.isa.core.businessobject.BackendAware;
import com.sapmarkets.isa.core.eai.BackendObjectManager;
import com.sapmarkets.isa.core.eai.BackendException;
import com.sapmarkets.isa.core.logging.IsaLocation;
// custom imports
import com.ao.isa.backend.boi.Z_AOFuncBackend;
import java.util.Vector;
Template for business object in customer projects
public class Z_AOFunc extends BOBase implements BackendAware
// initialize logging
private static IsaLocation log =
IsaLocation.getInstance(Z_AOFunc.class.getName());
private BackendObjectManager bem;
private Z_AOFuncBackend backendAOBasket;
Returns a reference to the backend object. The backend object
is instantiated by the framework.
@return a reference to the backend object
private Z_AOFuncBackend getCustomBasketBackend()
if (backendAOBasket == null)
//create new backend object
try
backendAOBasket =
(Z_AOFuncBackend) bem.createBackendBusinessObject(
"Z_AO_Custom");
// the backend object is registered in customer version
// of backendobject-config.xml using the 'Z_AO_Custom' type
catch (BackendException bex)
// The following key has to be added to WEB-INF/classes/ISAResources.properties
// in order to see the exception correctly
log.config("ao.b2b.order.error.getOrderTrackingURLs", bex);
return backendAOBasket;
This method is needed when a business object has a corresponding
backend object.
public void setBackendObjectManager(BackendObjectManager bem)
this.bem = bem;
Returns a vector of url links for tracking
@return vector of urls
public Vector getOrderDeliveryTrackingData(String orderNo)
// the call is delegated to the CRM aware backend object
return getCustomBasketBackend().getOrderDeliveryTrackingData(orderNo);
[/code]
4. Edit file config.xml in folder project_root\b2b_z\WEB-INF to add custom actions (the section below is just the custom stuff added at the end of the file the Z_orderTracking is the relevant one) :-
[code] <!-- Begin of custom AO action definitions -->
<action path="/b2b/Z_orderTracking" type="com.ao.isa.order.actions.Z_OrderTrackingAction">
<forward name="success" path="/b2b/order/Z_orderTracking.jsp"/>
</action>
<action path="/catalog/Z_displaySVGPage" type="com.ao.isa.catalog.actions.Z_SVGPageAction">
<forward name="success" path="/catalog/Z_SVG_fs.jsp"/>
</action> [/code]
Which points at Java file com.ao.isa.order.actions.Z_OrderTrackingAction.java which looks like this :-
[code] package com.ao.isa.order.actions;
// internet sales imports
import com.sapmarkets.isa.core.BaseAction;
import com.sapmarkets.isa.core.UserSessionData;
// struts imports
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
// servlet imports
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
// Internet Sales imports
import com.ao.isa.businessobject.Z_AOBusinessObjectManager;
import java.util.Vector;
This action acts as a template for customer extensions
public class Z_OrderTrackingAction extends BaseAction
This method is called by the ISA Framework when the
action is executed
public ActionForward doPerform(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
// get user session data object
UserSessionData userSessionData =
UserSessionData.getUserSessionData(request.getSession());
// gettting custom BOM
Z_AOBusinessObjectManager myBOM =
(Z_AOBusinessObjectManager) userSessionData.getBOM(
Z_AOBusinessObjectManager.CUSTOM_BOM);
// get the order number being processed
String orderDocNumber = request.getParameter("orderNo");
// pass the order number back to the page
request.setAttribute("orderNo", orderDocNumber);
if (orderDocNumber != null)
// Get a vector of delivery tracking objects from lower layers (Business Object layer =>
// Business Logic Service Layer)
Vector trackingTable =
myBOM.getCustomBasket().getOrderDeliveryTrackingData(
orderDocNumber);
String error = "";
if (trackingTable != null)
if (trackingTable.size() == 0)
error = "true";
else
error = "false";
else
error = "true";
request.setAttribute("errorMessage", error);
request.setAttribute("trackingTable", trackingTable);
return mapping.findForward("success");
[/code]
5. I added the call to the function module for page orderstatusdetail.jsp in folder project_root\b2b_z\b2b\order to display a custom page Z_orderTracking.jsp in the same folder. To do this I added a link into the HTML to call a JavaScript function that passed the current order number to the /b2b/Z_orderTracking.do actionhandler mapped in the config.xml file.
So, in summary! Create an RFC; define business managers for it in the XML files; create a new Strut action and supporting Java class; create all the Java class for the managers.
I hope this makes some sense!
Gareth. -
Calling RFC Function module from JAVA
Hi All,
We have created a RFC Function Module for Billing Plan tab in Sales order (BDC). The function Module contains BDC. When we are running the same function module in SAP it is working fine. But when the FM is called in Java , it is allowing only maximum of 5 entries , when we trying to insert at 6th position in billing plan tab, we are getting an error.
Can any one help on this.
Points will be rewarded for helpful answers.
Thanks & Regards,
Kiran II think the problem is because of the number of lines displayed on the screen in the BDC session in the Billing Plan.
You might have to add the page down logic to your BDC program. -
XI AF API call failed. Module exception: Java Mapping
Hi Experts,
I have faced a typical error for one of my interface. The Scenario is SOAP to SOAP and we are performing SOAP Lookup before sending the data to Target web service. We are using one Java Mapping 'FileIns_lookupLoad.java --- com/fi/' and performing the SOAP Lookup from within the code. In the Lookup Communication channel we are using 'Axis' as message protocol and passing couple of values through Module Key parameters. We have same ESR and ID objects in Development, Quality and Production (as per Version ID and History).
Now the problem is Lookup is failing only in Development but Quality and Production is working fine. I have replaced Quality CC URL with the development WSDL URL, but that worked fine. That means Development Web Service is good. We are getting the below error in Dev:
<SAP:Stack>StreamTransformationException triggered by application mapping program com/fi/FileIns_lookupLoad; Look Up Failed</SAP:Stack>
Trace : *
<Trace level="1"
type="T"> Some Thing Wrong in LookUpError when calling an adapter by using the communication channel CC_IN_SOAP_GEInsuranceLoadLookup1 (Party: , Service: BusService_GE, Object ID: 4214805c52893ef9b0b3f0ef0902fe9e) XI AF API call failed. Module exception: 'while trying to invoke the method org.apache.axis.types.URI.toString() of an object returned from com.sap.xi.XI.Message._30.QualifiedName.getNamespace()'. Cause Exception: 'while trying to invoke the method org.apache.axis.types.URI.toString() of an object returned from com.sap.xi.XI.Message._30.QualifiedName.getNamespace()'. </Trace>
<Trace level="1" type="T">*** END APPLICATION TRACE ***</Trace>
<Trace level="1" type="T">Java mapping com/fi/FileIns_lookupLoad has thrown a StreamTransformationException. Thrown: com.sap.aii.mapping.api.StreamTransformationException: Look Up Failed at com.fi.FileIns_lookupLoad.execute(FileIns_lookupLoad.java:282) at com.fi.FileIns_lookupLoad.transform(FileIns_lookupLoad.java:74) at com.sap.aii.ib.server.mapping.execution.JavaMapping.executeStep(JavaMapping.java:92) at com.sap.aii.ib.server.mapping.execution.Mapping.execute(Mapping.java:60) at com.sap.aii.ib.server.mapping.execution.SequenceMapping.executeStep.................................................
................................................................................<Trace level="1" type="T">Application mapping program com/fi/FileIns_lookupLoad throws a stream transformation exception: Look Up Failed Thrown: com.sap.aii.ib.core.mapping.execution.ApplicationException: Application mapping program com/fi/FileIns_lookupLoad throws a stream transformation exception: Look Up Failed at com.sap.aii.ib.server.mapping.execution.JavaMapping.executeStep(JavaMapping.java:95) at com.sap.aii.ib.server.mapping.execution.Mapping.execute(Mapping.java:60) at com.sap.aii.ib.server.mapping.execution.SequenceMapping.executeStep(SequenceMapping.java:40) at com.sap.aii.ib.server.mapping.execution.Mapping.execute
I have already checked with Basis and as per them JDK and Java versions are identical in Dev, QAS and Prod. It seems something is wrong with 'XI AF API' which we are calling from the channel. If we totally ignore Lookup process and send direct data, it is working fine. Target CC is also using Axis.
Sequence in CC: afreq ->xireq ->wssec2 ->xires ->afres
For any more information please let me know.
Thanks,
Nabendu.Hi Anupam,
The Java Mapping code is same in Dev , QAS and Prod. Also the versions of the JAR is same.
Please find the code below.
package com.fi;
import java.util.HashMap;
import com.sap.aii.mapping.api.AbstractTrace;
import com.sap.aii.mapping.api.AbstractTransformation;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.MappingTrace;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.api.DynamicConfiguration;
import com.sap.aii.mapping.api.DynamicConfigurationKey;
import com.sap.aii.mapping.api.TransformationInput;
import com.sap.aii.mapping.api.TransformationOutput;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.*;
import org.w3c.dom.views.AbstractView;
import org.xml.sax.SAXException;
import java.io.ByteArrayInputStream;
import com.sap.aii.mapping.lookup.*;
/*import com.sap.aii.utilxi.hmis.server.HmisEnvironment.Accessor;
//import com.sap.aii.utilxi.lock.api.LockServiceException;
//import com.pmintl.pppimes.RFCLookup.javamapping.*;
//import java.io.FileInputStream;
//import java.io.FileOutputStream;*/
import java.text.DateFormat;
import java.text.SimpleDateFormat;
//import java.text.ParseException;
import java.util.Date;
import java.io.*;
public class FileIns_lookupLoad extends AbstractTransformation{
private Map param = null;
private AbstractTrace trace = getTrace();
String senderService = null;
String inParamChannel = null;
String inParamBusService = null;
//3. Each JAVA Mapping using program 7.1 API must implement the method
// transform(TransformationInput in, TransformationOutput out)
// as oppose to execute Method in earlier version.
public void transform(TransformationInput arg0, TransformationOutput arg1) throws StreamTransformationException {
// TODO Auto-generated method stub
//4. An info message is added to trace. An instance of trace of object is obtained by calling
// the getTrace method of class AbstractTransformation
inParamChannel = arg0.getInputParameters().getString("COMM_CHANNEL");
inParamBusService = arg0.getInputParameters().getString("BUS_SERVICE");
getTrace().addInfo("Input Parameter: " + inParamChannel);
getTrace().addInfo("Input Parameter: " + inParamBusService);
this.execute(arg0.getInputPayload().getInputStream(),
arg1.getOutputPayload().getOutputStream());
//5. Input payload is obtained by using arg0.getInputPayload().getInputStream()
* @param args
public static void main(String[] args) {
// TODO Auto-generated method stub
public void execute(InputStream in, OutputStream out)
throws StreamTransformationException {
// TODO Auto-generated method stub
try
//Get The Trace
// trace = (AbstractTrace)param.get(StreamTransformationConstants.MAPPING_TRACE );
trace = getTrace();
getTrace().addInfo("Java Mapping Started");
DocumentBuilderFactory ifactory = DocumentBuilderFactory.newInstance();
DocumentBuilder ibuilder = ifactory.newDocumentBuilder();
Document IDoc = ibuilder.parse(in);
Document TDoc = ibuilder.newDocument();
String mrnVal = "";
trace.addInfo("Preparing Target Doc");
Element message = TDoc.createElementNS("urn:Medtronic.com:CATS_Patient_Transactions","n1:Mt_Insurance");
Node tRoot = TDoc.appendChild(message);
//trace.addInfo(tRoot.getNodeName());
Element sRoot = (Element)IDoc.getFirstChild();
//trace.addInfo(sRoot.getNodeName());
NodeList nl = sRoot.getChildNodes();
// trace.addInfo("Len"+nl.getLength());
//// for(int i=0;i<nl.getLength();i++)
// Node n1 = TDoc.importNode(nl.item(i), true);
// trace.addInfo("Adding Child Nodes");
// trace.addInfo(nl.item(i).getNodeName());
// tRoot.appendChild(n1);
NodeList lmrn = sRoot.getElementsByTagName("Mrn");
if(lmrn != null)
Node n1 = TDoc.importNode(lmrn.item(0), true);
Element e1 = (Element)lmrn.item(0);
//trace.addInfo(e1.getNodeName());
mrnVal = e1.getTextContent();
tRoot.appendChild(n1);
NodeList lfsc = sRoot.getElementsByTagName("Fsc");
if(lfsc != null)
for(int i=0;i<lfsc.getLength();i++){
Element n1=TDoc.createElement(lfsc.item(i).getNodeName());
tRoot.appendChild(n1);
Node fieldch = TDoc.createElement("Fields");
n1.appendChild(fieldch);
NodeList chl = lfsc.item(i).getChildNodes();
trace.addInfo("len11"+chl.getLength());
for(int j=0;j<chl.getLength();j++){
if(!chl.item(j).getNodeName().equals("FscNumber")&&!chl.item(j).getNodeName().equals("Priority")){
if(chl.item(j).hasChildNodes()){
trace.addInfo(chl.item(j).getNodeName());
Element fscfield = TDoc.createElement("FSCField");
fieldch.appendChild(fscfield);
NodeList FUQl = chl.item(j).getChildNodes();
for(int p =0;p<FUQl.getLength();p++){
//trace.addInfo(" i: "+i+" J: "+j+" P: "+p);
if(FUQl.item(p).getNodeName().equals("FUQNumber")){
//Node tFUQ = TDoc.createElement("FUQNumber");
//tFUQ.setTextContent(FUQl.item(p).getTextContent());
fscfield.setAttribute("FUQNumber", FUQl.item(p).getTextContent());
if(FUQl.item(p).getNodeName().equals("Value")){
Node tVal = TDoc.createElement("Value");
tVal.setTextContent(FUQl.item(p).getTextContent());
fscfield.appendChild(tVal);
//Node tName = TDoc.createElement("Field");
//tName.setTextContent(chl.item(j).getNodeName());
fscfield.setAttribute("Field", chl.item(j).getNodeName());
// Node fuqch = chl.item(j).getFirstChild();
// Node valch = fuqch.getNextSibling();
// if(fuqch!=null){
// Node tFUQ = TDoc.createElement("FUQNumber");
// tFUQ.setTextContent(fuqch.getTextContent());
// fscfield.appendChild(tFUQ);
// if(valch!=null){
// Node tVal = TDoc.createElement("Value");
// tVal.setTextContent(valch.getTextContent());
// fscfield.appendChild(tVal);
// Node tName = TDoc.createElement("Filed");
// tName.setTextContent(chl.item(j).getNodeName());
// fscfield.appendChild(tName);
else{
//Node numch =TDoc.importNode(chl.item(j), true);
//Element e1 =(Element)n1;
if(chl.item(j).getNodeName().equals("FscNumber")){
n1.setAttribute("Number", chl.item(j).getTextContent());
if(chl.item(j).getNodeName().equals("Priority")){
n1.setAttribute("Priority", chl.item(j).getTextContent());
//tRoot.appendChild(lfsc.item(0));
// Element e1 = (Element)lfsc.item(0);
// trace.addInfo(e1.getNodeName());
// mrnVal = e1.getNodeValue();
/////Start of Look Up Code////
//Preparing Input String
String lookUpRequest = "<LoadPatientFullInsuranceDetail><Mrn>"+mrnVal+"</Mrn></LoadPatientFullInsuranceDetail>";
trace.addInfo("Request");
trace.addInfo(lookUpRequest);
SystemAccessor acc;
Channel channel;
Payload lookupResult;
try
channel = LookupService.getChannel(inParamBusService, inParamChannel);
trace.addInfo("Got the channel");
acc = LookupService.getSystemAccessor(channel);
trace.addInfo("Got The Channel and Accessor");
InputStream ist = new ByteArrayInputStream(lookUpRequest.getBytes());
XmlPayload payload = LookupService.getXmlPayload(ist);
if(acc != null){
trace.addInfo("Got The Channel and Accessor");
trace.addInfo("Executing The Webservice");
lookupResult = acc.call(payload);
trace.addInfo("End of Executing The Webservice");
trace.addInfo(lookupResult.toString());
if(lookUpRequest!=null){
trace.addInfo("Responce is not null");
InputStream rist = lookupResult.getContent();
Document lresDoc = ibuilder.parse(rist);
Node n1 = lresDoc.getFirstChild();
trace.addInfo(n1.getNodeName());
if(n1.getNodeName().endsWith("LoadPatientFullInsuranceDetailResponse"))
Node ch1 = n1.getFirstChild();
trace.addInfo(ch1.getNodeName());
NodeList lookupnl = ch1.getChildNodes();
//trace.add
for(int i=0;i<lookupnl.getLength();i++)
Node n2 = TDoc.importNode(lookupnl.item(i), true);
trace.addInfo("Adding Child Nodes");
trace.addInfo(lookupnl.item(i).getNodeName());
tRoot.appendChild(n2);
else{
throw new StreamTransformationException("Error in Look Up"+n1.getTextContent());
//while(ch1.hasChildNodes() && !ch1.getNodeName().equals("FSCS")){
else{
trace.addWarning("Responce is null");
throw new LookupException();
catch(LookupException le)
trace.addWarning("Some Thing Wrong in LookUp"+le.getMessage());
throw new StreamTransformationException("Look Up Failed");
Transformer transformer = TransformerFactory.newInstance().newTransformer();
// StreamResult reqResult = new StreamResult(new StringWriter());
DOMSource source = new DOMSource(TDoc);
Result result = new StreamResult(out);
transformer.transform(source,result);
catch(StreamTransformationException ste)
throw new StreamTransformationException(ste.getMessage());
catch(Exception e){
trace.addInfo(e.getMessage());
finally{ -
Weblogic server 8.1 JNI module deployment java.lang.UnsatisfiedLinkError
This is on the weblogic 8.1 Solaris platform.
We have a module in our application which uses the native shared library and makes JNI called from the J2EE application. We have added the .so files to the LD_LIBRARY_PATH environment variable in our managed server startup scripts. When we start our servers the module works fine. But when we redeploy the J2EE application, the java code is changed but we start getting java.lang.UnsatisfiedLinkError exception when the module is invoked. We are using the staged mode for deployment. We have to shut down the managed servers and restart them every time for this module to start working after the redeployment of the J2EE application.
Is this a known problem with the JNI based application. Is there any setting that we are missing? Has this problem been fixed in any of the service packs?Have you checked to see if your file descriptor setting is set high enough? Disabling native IO is not a very good solution as it will drastically reduce performance.
--Raheem -
GetUserPrincipalName() in application module or Java class?
Hi,
in my application I have a web service as Java class (POJO) which invoke the business logic in an application module.
The web service is secured with basic HTTP authentication with JAZN in 10.1.2 which works without any problems.
This means that all configurations with JAZNUserManager and web.xml (user-role-mappings) are correct.
But what is the right API to get the user informations of the web service consumer with JAZN? I mean a method like getUserPrincipalName()?
One way I tried is getUserPrincipalName() in the application module.
- The steps in http://www.oracle.com/technology/products/jdev/howtos/bc4j/bc4jvpdjaas.html#authentication for BC4J must be configured.
- Then the application module can be tested with the Component Browser http://www.oracle.com/technology/products/jdev/howtos/bc4j/bc4jvpdjaas.html#running
But my web service client delivers this exception:
JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-33021: Failed authenticate user null at
This is equivalent to Application Module Security but there is no answer.
What´s the problem?
Is there a way to get the getUserPrincipalName() in the web service (Java class (POJO)) directly?
Best regards,
TobiasHello,
You are a standard way to do that by retrieving the ServletEndpointContext that is available from the the Service context
To get this you have to:
1- Implement the[i]javax.xml.rpc.server.ServiceLifecycle; (usually your implementation class)
2- Implement the init(object context) method
public void init(Object context) {
_servletEndpointContext = (ServletEndpointContext)context;
3. Then when needed you can call the getUserPrincipal
if (_servletEndpointContext.getUserPrincipal() != null) {
java.security.Principal userPrincipal = _servletEndpointContext.getUserPrincipal();
System.out.println( userPrincipal.getName() );
I have tested this code with WS-Security username token authentication, should be available also using basic auth. Let me know if you have any issue.
Regards
Tugdual Grall
Maybe you are looking for
-
(newbie) Null Time Pointer exception while creating connection Pool
I am trying to create an Oracle connection pool using the admin console in Weblogic 7.0. Attached is the text of the error message I get when I attempt to deploy this to the target server. I specify the following properties in the configuration tab:
-
Hi everyone, Does anyone know how to use JSOM / REST APIs to retrieve the users that are following a specific document in SharePoint 2013? Thanks in advance, Nam
-
Constructions Industry - Use of SO BOM
Hi, We are using ECC 6 and my client is a constuction company. The company is using SAP material no - material type DIEN and this is entered during SO creation. We dont keep any inventory as the nature of the business is construction/service. For exa
-
Photo Stream and non-primary accounts
My wife is not the primary account holder on me.com our family pack is there anyway to get photo stream to work on her phone through iCloud? If not what are our options.
-
Issues with updating apps on ONE iMac - please help!
Hello everyone I use an iMac at home and at work. At work, firewalls or similar have been stopping my apps being updated and also accessing the itunes store I brought the iMac home at the weekend so I could bring everything up to date. However, the