Invoking java methods
hi
i have used flash builder 4.
i can't plugin eclipse ide.
can i invoke java methods in flash builder 4 .
is it possible.
if it's possible pls give some ideas.
thanks in advance
regards
athi
If you want to invoke java methods that are remote though, you might want to use a Java Remoting technology like BlazeDS.
Using a <s:RemoteObject> tag, you could connect to the server and invoke java methods.
Here is a small sample app code that helps me execute a remote java method.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
creationComplete="ro.getProducts()">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.messaging.channels.AMFChannel;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
protected function ro_resultHandler(event:ResultEvent):void
Alert.show(event.result.toString())
protected function ro_faultHandler(event:FaultEvent):void
Alert.show(event.fault.faultString);
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:RemoteObject id="ro"
destination="productService"
endpoint="http://localhost:8400/samples"
fault="ro_faultHandler(event)"
result="ro_resultHandler(event)"/>
</fx:Declarations>
</s:Application>
Hope this helps,
Balakrishnan V
Similar Messages
-
Invoking java methods from C/C++ on the machine with different JREs
I implemented Windows NT Service instantiating JVM and invoking several java methods. Everything works but I have an issue with running the service on the machine where multiple different versions of JRE have been installed. The service is calling java methods that require JRE 1.3 or later so I wrote the code that is setting system PATH from within the service based on the configuration stored in the external file. The problem is that the service requires jvm.dll to be in the PATH prior lunching it since this library is instantiated through the implicit linking. When I put jvm.dll in the same path as the service binary I can lunch it but JNI_CreateJavaVM fails and returns -1. This happens even if JRE 1.3 is in the system PATH prior lunching the service.
Everything works if the system PATH contains references to JRE 1.3 and jvm.dll is removed from the service's directory.
I am looking for an advice on what is the proper way to deal with invoking java methods from the C/C++ executable in the environment with different versions of JRE.
Thanks, Kris.Here's a way I have done what you are asking about:
What you want to do is make all of your linking happen at runtime, rather than at compile time. This way, you can edit the PATH variable before the jvm.dll gets loaded.
Following is some code that I used to handle a dll of my own in this manner. You can decide if you want to write a "wrapper" dll, or if you find it simpler to approach the jvm.dll in this way.
// Define pointer type for DLL entry point.
typedef void JREPDLL_API (*EXECUTEREQUEST)(char*, Arguments&);
// Set up path, load dll, and pass everything off to it.
HINSTANCE javaServer = javaServer = LoadLibrary("jrepdll.dll");
if (javaServer != NULL) {
EXECUTEREQUEST executeRequest = (EXECUTEREQUEST)GetProcAddress(javaServer, "ExecuteRequest");
if (executeRequest != NULL) {
if (argc == 1)
// Execute the request.
executeRequest("-run", args);
else
// Execute the request.
executeRequest("-console", args);
Here's some code for how to edit the PATH:
// Edit the PATH environment variable so that we use our private java.
char *appendPt;
char *newPath;
char *path;
char tmp[_MAX_PATH];
// Get the current PATH variable setting.
path = getenv("PATH");
// Allocate space for an edited path setting.
if (path != NULL)
newPath = (char*)malloc((_MAX_PATH * 2) + strlen(path));
else
newPath = (char*)malloc((_MAX_PATH * 2));
// Get upper part of path to desired directories.
strcpy(tmp, filepath);
appendPt = strstr(tmp, "dbin\\jreplicator");
appendPt[0] = '\0';
sprintf(newPath, "PATH=%sjava\\jre1.2.2\\bin;%sjava\\jre1.2.2\\bin\\classic", tmp, tmp);
// Append the value of the existing PATH environment variable.
// If there is anything, append it.
if (path != NULL) {
strcat(newPath, ";");
strncat(newPath, path, (sizeof(newPath) - strlen(newPath) - 2));
// Set new PATH value.
_putenv(newPath);
free(newPath); -
Urgent please ! How to invoke java method with diffrent argument types?
Hi,
I am new to JNI.
I had gone through documentation but it is not of much help.
Can any one help me out how to invoke the below java method,
// Java class file
public class JavaClassFile
public int myJavaMethod(String[] strArray, MyClass[] myClassArray, long time, int[] ids)
// implementation of method
return 0;
// C++ file with Invokation API and invokes the myJavaMethod Java method
int main()
jclass cls_str = env->FindClass("java/lang/String");
jclass cls_MyClass = env->FindClass("MyClass");
long myLong = 2332323232;
int intArray[] = {232, 323, 32, 77 };
jclass cls_JavaClassFile = env->FindClass("JavaClassFile");
jmethodID mid_myJavaMethod = env->GetMethodID( cls_JavaClassFile, "myJavaMethod", "([Ljava/lang/String;[LMyClass;J[I)I");
// invoking the java method
//jint returnValue = env->CallIntMethod( cls_JavaClassFile, mid_myJavaMethod, stringArray, myClassArray, myLong, intArray ); --- (1)
//jint returnValue = env->CallIntMethodA( cls_JavaClassFile, mid_myJavaMethod, ...........); --- (2)
//jint returnValue = env->CallIntMethodV( cls_JavaClassFile, mid_myJavaMethod, ...........); --- (3)
Can any one tell me what is the correct way of invoking the above Java method of (1), (2) and (3) and how ?
The statement (1) is compilable but throws error at runtime, why ?
How can I use statements (2) and (3) over here ?
Thanks for any sort help.
warm and best regards.You are missing some steps.
When you invoke a java method from C++, the parameters have to be java parameters, no C++ parameters.
For example, your code appears to me as thogh it is trying to pass a (C++) array of ints into a java method. No can do.
You have to construct a java in array and fill it in with values.
Here's a code snippet:
jintArray intArray = env->NewIntArray(10); // Ten elments
There are also jni functions for getting and setting array "regions".
If you are going to really do this stuff, I suggest a resource:
essential JNI by Rob Gordon
There is a chapter devoted to arrays and strings. -
Invoke Java method from C++
hello, I hope you can help me.
In the moment I am trying to use Global Hotkeys.
I am able to register global Hotkeys from Java in C++. My problem: I can't invoke an other java method as result of pressing my hotkey.
void OnHotKey(void *)
printf("invoke my java method");
so I want to do a backcall to java in a c++ method. At Beginning Java registers my global Hotkeys in an c++ native method.(My JNI is rusty, and the tutorial is gone),
Something like (Pusdo code, see JNI Spec: Accessing Fields and Methods ):
JNIEnv * g_env, jobject g_obj;
void OnHotKey(void *)
// cut from the example posted above
jclass cls;
jmethodID mid;
cls = (*env)->FindClass(env,"my.Class");
if( cls == NULL ) {
return;
mid=(*env)->GetMethodID(env, cls, "onHotKey", "()V");
(*env)->CallVoidMethod( obj, mid );
CHotkeyHandler hk;
JNIEXPORT void JNICALL Java_gui_Gui_activateGlobalHotkeys
(JNIEnv * env, jobject obj) {
int err, id;
hk.RemoveHandler(id = 0);
hk.InsertHandler(MOD_CONTROL | MOD_ALT, 'A', OnHotKey, id);
// We need this in OnHotKey
g_env = env;
g_obj = obj;
err = hk.Start("calc.exe");
if (err != CHotkeyHandler::hkheOk)
printf("Error %d on Start()\n", err);
JNIEXPORT void JNICALL Java_gui_Gui_deactivateGlobalHotkeys
(JNIEnv * env, jobject obj) {
int err = hk.Stop();
} -
Invoking Java Methods from outside ODI
Is there a good blog on how to do this, I assume a procedure is the best way?
Bos that makes sense and seems to work, I put this into my text variable:
SELECT
CAST(COLLECT(to_char(trade_id)) AS oditmp.t_varchar_tab) AS trade_id
FROM oditmp.trade_ids
Validated and returned this when I checked the history :
Date Value Context
2011-07-01 08:33:01.0 oracle.sql.ARRAY@294d7bc DEVELOPMENT
I assume the values are loaded in here and I can modify my Java Code as below?
In SQL Developer the same query returns:
ODITMP.T_VARCHAR_TAB(1,2,3,4,5,6)
-- Change to Java:
// Declare variables
import jar_jcmf;
trade_ids String;
String [] str_arr;
jar_jcmf t = new jar_jcmf();
int n;
// Load string array of table values, NOT SURE ABOUT THIS STEP
trade_ids = #PRJCT.TRADE_IDS;
// Split String
str_arr = trade_ids.split(",");
// Loop over array and execute GetTrade method from JCMF Class
for (String rec : str_arr) {
n = Integer.parseInt(rec)
t.getTrade(n);
}; -
Invoking java methods with labVIEW
I have a program written in LabVIEW and I want to invoke functions of another program written in java. How can i do this (I know very little C)? I have tried to make a DLL but this is not obvious without C.
Thanks in advance,
BenyHello!
I have never done this myself (worked with Java together with LabVIEW that is), but I found some useful information that hopefully will help you some.
First there is a KB that discusses this and you can read it here:
http://digital.ni.com/public.nsf/websearch/BEE812007BA2A9B486256BC80068A49A?OpenDocument
There are also two discussion threads that discusses this and you can read these here:
http://forums.ni.com/ni/board/message?board.id=170&message.id=44181&requireLogin=False
http://forums.ni.com/ni/board/message?board.id=170&message.id=97663&requireLogin=False
Hope this helps!
Regards,
Jimmie A.
Applications Engineer, National Instruments
Regards,
Jimmie Adolph
Systems Engineer Manager, National Instruments Northern Region
Bring Me The Horizon - Sempiternal -
How to invoke Java method from C++
Hi
My requirement is In C++ we are having three different structures, like
struct one{
int accontno;
char * accountholdername;
long balance;
struct two{
int startdate;
int enddate;
struct three{
char* userid;
char* userpassword;
from c++ how to pass these structures, these structures I have to read in Java class, and in java how receive these structures.
And the sample methods will be like: getCarsData(Input, output, Error);
How do i call the method in JNI, if it is static int method we can call like
getStaticIntMethodID(), instead of int if i have to pass the above mentioned structures how do i do? Should i create an object array in JNI for accessing these three structures?
Suggestions/Samples welcome
Thanks,Why did you start another thread for this?
I was answering you in the [url http://forum.java.sun.com/thread.jspa?threadID=712137&messageID=4119725#4119725]old thread and you didn't even bother to answer back my (basic) questions.
I told you to use the code tags when pasting code. Got ignored. I also gave you a starting example on how to achieve your goal. Flushed.
Oh well, I'm getting used to it.
Again.
Before starting, allways keep near you the [url http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/jniTOC.html]JNI reference. All the JNI functions are documented in it.
First you need to create custom Java classes that will match the C++ stucts (remember?).
There is no magic wand in JNI that will transform the C++ structs into the custom Java classes and vice versa.
You'll have to code it by hand, one field at a time. It's a pain.
So for the one, two, three C++ structs (why not posting some real names instead of this crap?),
there will be JOne, JTwo and JThree Java classes.
There is also that other Java class already existing with getCarsData() static method that will fetch the data.
And finally the DLL function wich will call this Java static method, doing the bridge between the C++ structs and the custom Java classes, finally return the data.
Due to the lack of explanation from your posts, I will say that the getCarsData() static method receives a parameter of type JOne
and returns an array of JTwo objects.
So the get_cars_data() DLL function receives a parameter which is a struct one and
returns a pointer to an array of struct two elements.
// C++ structs
struct one {
int accontno;
char * accountholdername;
long balance;
struct two {
int startdate;
int enddate;
struct three {
char * userid;
char * userpassword;
// custom Java classes
class JOne {
int accontno;
String accountholdername;
int balance;
class JTwo {
int startdate;
int enddate;
class JThree {
String userid;
String userpassword;
// Java class with static method that gets the data
class DataFetcher {
static JTwo[] getCarsData(JOne one) {
// DLL function
// struct 'one' parameter is already filled with values.
// Returns an array of 'two' C++ struct obtained from a Java static method
two * get_cars_data(one o) {
JNIEnv * env;
/** not show here is the code to either
create the JVM or
attach it to the current thread **/
// get the data from 'one' C++ struct and put it in a new instance of JOne Java class
jclass oneCls = env->FindClass("JOne");
jmethodID oneCtorID = env->GetMethodID(oneCls, "<init>", "()V");
jfieldID accontnoID = env->GetFieldID(oneCls, "accontno", "I");
jfieldID accountholdernameID = env->GetFieldID(oneCls, "accountholdername", "Ljava/lang/String;");
jfieldID balanceID = env->GetFieldID(oneCls, "balance", "I");
jobject oneObj = env->NewObject(oneCls, oneCtorID);
env->SetIntField(oneObj, accontnoID, o.accontno);
env->SetObjectField(oneObj, accountholdernameID, env->NewStringUTF((const char *)o.accountholdername));
env->SetIntField(oneObj, balanceID, o.balanceo);
// call the Java static method
jclass dfCls = env->FindClass("DataFetcher");
jmethodID getCarsDataID = env->GetStaticMethodID(dfCls, "getCarsData", "(LJOne;)[LJTwo;");
jobjectarray twoArray = (jobjectarray)env->CallStaticObjectMethod(dfCls, getCarsDataID, oneObj);
// create the 'two' C++ struct array from the Java array of JTwo objects
jclass twoCls = env->FindClass("JTwo");
jfieldID startdateID = env->GetFieldID(twoCls, "startdate", "I");
jfieldID enddateID = env->GetFieldID(twoCls, "enddate", "I");
jint len = env->GetArrayLength(twoArray);
two * pt = new two[len];
for (int i = 0; i < len; i++) {
jobject twoObj = env->GetObjectArrayElement(twoArray, i);
pt.startdate = env->GetIntField(twoObj, startdateID);
pt[i].enddate = env->GetIntField(twoObj, enddateID);
// return the resulting 'two' C++ struct array
return pt;
Regards -
I have a complete Java Classes solution working perfectly and i would like to "re-use" it from my new main C# program. Actually, i don't know which process could authorize to invoke Java method from C# method.
Can anybody help me ?
Thanks in advance for your assistance.If you want a very heavy and inefficient solution you can try this:
- Make your java classes "web services" - it usually requires setting up a web container like Tomcat
- Call the web services in your C# program.
Sometimes my solution could work (for instance, if your Java classes can't be rewritten in C# in a short time, and if they are infrequently called, and if they do a lot of work inside, and if you already has a web container properly set up in your environment). -
Hi,
Our PI is getting data from WebSphere MQ and pushing to SAP. So our sender CC is JMS and receiver is Proxy. Our PI version is 7.31.
Our connectivity between the MQ is success but getting the following error while trying to read the payload.
Text: TxManagerFilter received an error:
[EXCEPTION]
java.lang.NullPointerException: while trying to invoke the method java.lang.String.length() of an object loaded from local variable 'payload'
at com.sap.aii.adapter.jms.core.channel.filter.ConvertJmsMessageToBinaryFilter.filter(ConvertJmsMessageToBinaryFilter.java:73)
at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:204)
at com.sap.aii.adapter.jms.core.channel.filter.InboundDuplicateCheckFilter.filter(InboundDuplicateCheckFilter.java:348)
at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:204)
I have searched SDN but couldn't fix it. Please provide your suggestion.
With Regards
Amarnath MHi Amarnath,
Where exactly you are getting this error?
If you are getting at JMS Sender communication channel, try to stop and start the JMS communication channel and see the status, also use XPI Inspector to get the exact error log.
for reference follow below blogs:
Michal's PI tips: ActiveMQ - JMS - topics with SAP PI 7.3
Michal's PI tips: XPI inspector - help OSS and yourself
XPI Inspector -
Hi everyone,
I just installed SP09 and i was testing the solution. And I found a problem with the approvals tasks.
I configured a simple ROLE approval task for validate add event. And when the runtime executes the task, the dispatcher log shows a error:
ERROR: Evaluation of approvalid failed with Exception: while trying to invoke the method java.lang.String.length() of an object loaded from local variable 'aValue'
And the notifications configured on approval task does not start either.
The approval goes to the ToDO tab of the approver, but when approved, also the ROLE stays in "Pending" State.
I downgraded the Runtime components to SP08 to test, and the approvals tasks works correctly.
Has anyone passed trough this situation in SP09?
I think there is an issue with the runtime components delivered with this initial package of SP09.
Suggestions?Hi Kelvin,2016081
The issue is caused by a program error in the Dispatcher component. A fix will be provided in Identity Management SP9 Patch 2 for the Runtime component. I expect the patch will be delivered within a week or two.
For more info about the issue and the patch please refer to SAPNote 2016081.
@Michael Penn - I might be able to assist if you provide the ticket number
Cheers,
Kristiyan
IdM Development -
Obiee 11.1.1.6 Actions- Invoke a Java Method screen is empty
Hi All,
I have created and deployed an EJB for obiee11g by using the example provided in the below link
http://www.rittmanmead.com/2010/09/oracle-bi-ee-11g-action-framework-java-ejbs-and-pdf-watermarks/
I have mapped oracle.bi.actions also
But I am not able to see the java method in the obiee11g Actions- Invoke a Java Method screen .The screen is empty
I have configured the ActionFrameworkConfig.xml as follows
<?xml version="1.0" encoding="UTF-8"?>
<obi-action-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="afconfig.xsd">
<aliases/>
<registries>
<registry>
<id>reg05</id>
<name>WaterMark EJBS</name>
<content-type>java</content-type>
<provider-class>oracle.bi.action.registry.java.EJBRegistry</provider-class>
<description>WaterMark BIEE</description>
<location>
<path/>
</location>
<custom-config>
<ejb-targets>
<appserver>
<context-factory>weblogic.jndi.WLInitialContextFactory</context-factory>
<jndi-url>t3://localhost:9704</jndi-url>
<server-name>localhost</server-name>
<account>WLSJNDI</account>
<ejb-exclude>mgmt</ejb-exclude>
<ejb-exclude>PopulationServiceBean</ejb-exclude>
</appserver>
<ejb-app>
<server>localhost</server>
<app-context>watermark</app-context>
</ejb-app>
</ejb-targets>
</custom-config>
</registry>
</registries>
<content-types>
<content-type>
<typename>webservices</typename>
<displayname>Web Services and BPEL Processes</displayname>
<actionType>WebServiceActionType</actionType>
</content-type>
<content-type>
<typename>misc</typename>
<displayname>Mixed Services</displayname>
<actionType>URLActionType</actionType>
</content-type>
<content-type>
<typename>java</typename>
<displayname>Java Services</displayname>
<actionType>JavaActionType</actionType>
</content-type>
</content-types>
<accounts>
<account>
<name>WLSJNDI</name>
<description>Account used to access WLS JNDI.</description>
<adminonly>false</adminonly>
<credentialkey>JNDIUser</credentialkey>
<credentialmap>oracle.bi.actions</credentialmap>
</account>
</accounts>
</obi-action-config>
Please help me to resolve this issue
Regards
Deepz1. check your t3 port no, in my case it's 7001.
so i changed "<jndi-url>t3://localhost:9704</jndi-url>" to "<jndi-url>t3://localhost:7001</jndi-url>"
2. if you run obiee 11.1.1.6.0 above, you don't need below.
<credentialmap>oracle.bi.actions</credentialmap>
so please drop this line.
3. restart your server and check there's no error log when loading ActionFrameworkConfig.xml.
Good Luck !!! -
Hello,
I hope someone can help me with this.
I have a stateless session bean, which is returning a
org.w3c.dom.Document object. The whole object is getting created
but at the client side I am getting the following exception:
java.rmi.RemoteException: ; nested exception is:
weblogic.rmi.ServerError: A RemoteException occurred in the server method
- with nested exception:
[java.lang.StackOverflowError:
Start server side stack trace:
java.lang.StackOverflowError
at java.lang.Exception.<init>(Compiled Code)
at java.lang.reflect.InvocationTargetException.<init>(InvocationTargetEx
ception.java:58)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at java.io.ObjectOutputStream.invokeObjectWriter(Compiled Code)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at java.io.ObjectOutputStream.outputClassFields(Compiled Code)
at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
Then multiple occurences of the last few lines followed by
at org.apache.xerces.dom.ParentNode.writeObject(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at java.io.ObjectOutputStream.invokeObjectWriter(Compiled Code)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at java.io.ObjectOutputStream.outputClassFields(Compiled Code)
at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
at org.apache.xerces.dom.ParentNode.writeObject(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at java.io.ObjectOutputStream.invokeObjectWriter(Compiled Code)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObject(Compiled
Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeSpecial(Compiled
Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObject(Compiled
Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObjectWL(Compiled
Code)
at weblogic.rmi.extensions.AbstractOutputStream2.writeObject(Compiled
Code)
at com.ssmb.teams.model.CMSInterestDataEJBEOImpl_WLSkel.invoke(Compiled
Code)
at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(Compiled Code
at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(Compiled
Code)
at weblogic.rmi.internal.BasicExecuteRequest.execute(Compiled Code)
at weblogic.kernel.ExecuteThread.run(Compiled Code)
End server side stack trace
at weblogic.rmi.extensions.AbstractRequest.sendReceive(AbstractRequest.j
ava:76)
at com.ssmb.teams.model.CMSInterestDataEJBEOImpl_WLStub.getRegionAnalyst
Data(CMSInterestDataEJBEOImpl_WLStub.java:558)
at com.ssmb.teams.model.CMSInterestDataEJBEOImpl_ServiceStub.getRegionAn
alystData(CMSInterestDataEJBEOImpl_ServiceStub.java, Compiled Code)
at CMSJavaScript.main(CMSJavaScript.java:87)
The structure of the XML document is
<Maillist>
<Region>
<RegionCode>7</RegionCode>
<RegionName>Asia Pacific</RegionName>
<Analyst>
<Id>11111</Id>
<Name>AAAAAAAAAAAAAAAAA</Name>
</Analyst>
<Analyst>
<Id>22222</Id>
<Name>BBBBBBBBBBBBBBBBBB</Name>
</Analyst>
</Region>
</Maillist>
If the no. of Anlayst elements are 219, I am getting this error ( the same thing
is working for less no. of analyst).
Surprisingly when I access this ejb, by deploying it on my local server instance
on Win-NT, it works fine. I am getting this
exception, when the server is running on Sun Solaris.
The weblogic version is 5.1.
It will be really helpful if someone can reply to mee ASAP
Thanks.
Suren.Thanks a lot guys for all that information.
Rajesh Mirchandani <[email protected]> wrote:
Suren,
More info at
http://edocs.bea.com/wls/docs60/faq/java.html#251197
Rob Woollen wrote:
The quick fix is probably to use the -Xss argument on the Solaris JVMto increase the
thread stack size.
-- Rob
Suren wrote:
Thanks for your quick response.
But how do we overcome with this?
I tried to look for some help with this, but if you have any idea,
can you suggest
something ?
Thanks
Suren.
Rob Woollen <[email protected]> wrote:
It looks like the stack is overflowing when your DOM Tree is being
serialized.
Perhaps the Solaris JVM has a lower stack size by default.
-- Rob
Suren wrote:
Hello,
I hope someone can help me with this.
I have a stateless session bean, which is returning a
org.w3c.dom.Document object. The whole object is getting created
but at the client side I am getting the following exception:
java.rmi.RemoteException: ; nested exception is:
weblogic.rmi.ServerError: A RemoteException occurred in
the
server method
- with nested exception:
[java.lang.StackOverflowError:
Start server side stack trace:
java.lang.StackOverflowError
at java.lang.Exception.<init>(Compiled Code)
at java.lang.reflect.InvocationTargetException.<init>(InvocationTargetEx
ception.java:58)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at java.io.ObjectOutputStream.invokeObjectWriter(Compiled
Code)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at java.io.ObjectOutputStream.outputClassFields(CompiledCode)
at java.io.ObjectOutputStream.defaultWriteObject(CompiledCode)
Then multiple occurences of the last few lines followed by
at org.apache.xerces.dom.ParentNode.writeObject(CompiledCode)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at java.io.ObjectOutputStream.invokeObjectWriter(CompiledCode)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at java.io.ObjectOutputStream.outputClassFields(CompiledCode)
at java.io.ObjectOutputStream.defaultWriteObject(CompiledCode)
at org.apache.xerces.dom.ParentNode.writeObject(CompiledCode)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at java.io.ObjectOutputStream.invokeObjectWriter(CompiledCode)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObject(Compiled
Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeSpecial(Compiled
Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObject(Compiled
Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObjectWL(Compiled
Code)
at weblogic.rmi.extensions.AbstractOutputStream2.writeObject(Compiled
Code)
at com.ssmb.teams.model.CMSInterestDataEJBEOImpl_WLSkel.invoke(Compiled
Code)
at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(CompiledCode
at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(Compiled
Code)
at weblogic.rmi.internal.BasicExecuteRequest.execute(CompiledCode)
at weblogic.kernel.ExecuteThread.run(Compiled Code)
End server side stack trace
at weblogic.rmi.extensions.AbstractRequest.sendReceive(AbstractRequest.j
ava:76)
at com.ssmb.teams.model.CMSInterestDataEJBEOImpl_WLStub.getRegionAnalyst
Data(CMSInterestDataEJBEOImpl_WLStub.java:558)
at com.ssmb.teams.model.CMSInterestDataEJBEOImpl_ServiceStub.getRegionAn
alystData(CMSInterestDataEJBEOImpl_ServiceStub.java, Compiled
Code)
at CMSJavaScript.main(CMSJavaScript.java:87)
The structure of the XML document is
<Maillist>
<Region>
<RegionCode>7</RegionCode>
<RegionName>Asia Pacific</RegionName>
<Analyst>
<Id>11111</Id>
<Name>AAAAAAAAAAAAAAAAA</Name>
</Analyst>
<Analyst>
<Id>22222</Id>
<Name>BBBBBBBBBBBBBBBBBB</Name>
</Analyst>
</Region>
</Maillist>
If the no. of Anlayst elements are 219, I am getting this error( the
same thing
is working for less no. of analyst).
Surprisingly when I access this ejb, by deploying it on my local
server
instance
on Win-NT, it works fine. I am getting this
exception, when the server is running on Sun Solaris.
The weblogic version is 5.1.
It will be really helpful if someone can reply to mee ASAP
Thanks.
Suren. -
How to Invoke two java methods parallaly
Hi,
I need to invoke two Java methods parallaly ,for example if i am having two methods in a class
public class Test {
public Test() {
public static void main(String[] args)
Test test = new Test();
String returnString1 = test.test1();
String returnString2 = test.test2();
public String test1(){
String newString1 = "";
return newString1;
public String test2(){
String newString2 = "";
return newString2;
}if i run the above class two methods will be invoked one by one(Sequentially).is there any possibility to invoke these two methods parallaly (ie) both methods need to be invoked at the same time.import java.lang.reflect.Method;
class Paralell implements Runnable{
private Object srcObject;
private String methodName;
private Class parameterTypes[];
private Object parameterArgs[];
private Object returnObject;
public Paralell(Object srcObject, String methodName, Class parameterTypes[], Object parameterArgs[]){
this.srcObject = srcObject;
this.methodName = methodName;
this.parameterTypes = parameterTypes;
this.parameterArgs = parameterArgs;
public Object getReturnObject(){
return this.returnObject;
public void run(){
Method method = null;
try{
method = srcObject.getClass().getDeclaredMethod(this.methodName,this.parameterTypes);
this.returnObject =method.invoke(this.srcObject,this.parameterArgs);
}catch(Exception exp){
exp.printStackTrace();
}finally{
method = null;
} -
FATAL ERROR in native method: Wrong method ID used to invoke a Java method
When calling the same method second time , I get message ::
<FATAL ERROR in native method: Wrong method ID used to invoke a Java method>
void myFunction(int myVal)
JNIEnv *env = NULL;
jclass odbcconnls;
jint res;
printf("\nInitilaizing class ");
res = (jvm)->AttachCurrentThread((void **)&env,NULL);
if (res < 0) {
fprintf(stderr, "Can't get Env \n");
(jvm)->DestroyJavaVM();
return SQL_ERROR;
if(res == JNI_OK)
printf("\nThe env is initialized ");
if(*(&env) == NULL)
printf(" the env is NULL ");
printf("\nenv :::::: %s ", env);
// the jobject (dbc->actualConn) is a global reference
odbcconnls = (env)->GetObjectClass(dbc->actualConn);
if (odbcconnls == NULL) {
goto destroy;
switch(myVal){
case 1:
jmethodID methodId ;
jboolean jbool;
SQLINTEGER Val = (SQLINTEGER )Value;
SQLINTEGER val1 = *Val;
methodId = (env)->GetMethodID( odbcconnls,"myFun1","(Z)V");
if(methodId == NULL){
goto destroy;
if(val1 == SQL_FALSE )
jbool = 0;
else
jbool =1;
env->CallVoidMethod(dbc->actualConn,methodId,jbool);
env->DeleteLocalRef((jobject)res);
env->DeleteLocalRef((jobject)odbcconnls);
env->DeleteLocalRef((jobject)methodId);
jvm->DetachCurrentThread();
return ;
case 2 :
jmethodID methodId1 ;
SQLUINTEGER* Level;
methodId1 = (env)->GetMethodID( odbcconnls,"myFun2","(I)V");
if(methodId1 == NULL){
goto destroy;
Level = (SQLUINTEGER *)Value;
env->CallVoidMethod(dbc->actualConn,methodId1,(int)*Level);
dbc->txn_isolation = (SQLUINTEGER)Value;
env->DeleteLocalRef((jobject)res);
env->DeleteLocalRef((jobject)odbcconnls);
env->DeleteLocalRef((jobject)methodId1);
jvm->DetachCurrentThread();
return ;
case 3 :
SQLCHAR* Cate;
jmethodID methodId2 ;
jstring jStrCat;
methodId2 = (env)->GetMethodID(odbcconnls,"myFun3","(Ljava/lang/String;)V");
if(methodId2 == NULL){
goto destroy;
Cate = new SQLCHAR[20];
strcpy((char *)CCatalog,(char *)Value);
jStrCat = env->NewStringUTF((char *) Cate);
printf("\n got jSTring ");
env->CallVoidMethod(dbc->actualConn,methodId2,jStrCat);
printf("\n after called method ");
int len = strlen((char *)Cate);
dbc->Cate = new SQLCHAR[len+1];
strcpy((char *)dbc->Cate,(char *)Cate);
printf("\n copied result ");
env->DeleteLocalRef((jobject)res);
env->DeleteLocalRef((jobject)odbcconnls);
env->DeleteLocalRef((jobject)methodId2);
jvm->DetachCurrentThread();
return ;
destroy:
if ((env)->ExceptionOccurred()) {
(env)->ExceptionDescribe();
jvm->DetachCurrentThread();
(jvm)->DestroyJavaVM();
return SQL_ERROR;
When case 1 is called second time this error is thrown..
plz help me..
Thanx
MittalSunita.When calling the same method second time , I get
message ::
<FATAL ERROR in native method: Wrong method ID used
d to invoke a Java method>
void myFunction(int myVal)
JNIEnv *env = NULL;
jclass odbcconnls;
jint res;
printf("\nInitilaizing class ");
res = (jvm)->AttachCurrentThread((void **)&env,NULL);
if (res < 0) {
fprintf(stderr, "Can't get Env \n");
(jvm)->DestroyJavaVM();
return SQL_ERROR;
if(res == JNI_OK)
printf("\nThe env is initialized ");
if(*(&env) == NULL)
printf(" the env is NULL ");
printf("\nenv :::::: %s ", env);
// the jobject (dbc->actualConn) is a global
reference
odbcconnls = (env)->GetObjectClass(dbc->actualConn);
if (odbcconnls == NULL) {
goto destroy;
switch(myVal){
case 1:
jmethodID methodId ;
jboolean jbool;
SQLINTEGER Val = (SQLINTEGER )Value;
SQLINTEGER val1 = *Val;
methodId = (env)->GetMethodID(
( odbcconnls,"myFun1","(Z)V");
if(methodId == NULL){
goto destroy;
if(val1 == SQL_FALSE )
jbool = 0;
else
jbool =1;
env->CallVoidMethod(dbc->actualConn,methodId,jbool);
env->DeleteLocalRef((jobject)res);
env->DeleteLocalRef((jobject)odbcconnls);
env->DeleteLocalRef((jobject)methodId);
jvm->DetachCurrentThread();
return ;Why do you delete a local reference???
Did you ever call the get local reference?
case 2 :
jmethodID methodId1 ;
SQLUINTEGER* Level;
methodId1 = (env)->GetMethodID(
( odbcconnls,"myFun2","(I)V");
if(methodId1 == NULL){
goto destroy;
Level = (SQLUINTEGER *)Value;
env->CallVoidMethod(dbc->actualConn,methodId1,(int)*Le
el);
dbc->txn_isolation = (SQLUINTEGER)Value;
env->DeleteLocalRef((jobject)res);
env->DeleteLocalRef((jobject)odbcconnls);
env->DeleteLocalRef((jobject)methodId1);
jvm->DetachCurrentThread();
return ;
case 3 :
SQLCHAR* Cate;
jmethodID methodId2 ;
jstring jStrCat;
methodId2 =
(env)->GetMethodID(odbcconnls,"myFun3","(Ljava/lang/St
ing;)V");
if(methodId2 == NULL){
goto destroy;
Cate = new SQLCHAR[20];
strcpy((char *)CCatalog,(char *)Value);
jStrCat = env->NewStringUTF((char *) Cate);
printf("\n got jSTring ");
env->CallVoidMethod(dbc->actualConn,methodId2,jStrCat)
printf("\n after called method ");
int len = strlen((char *)Cate);
dbc->Cate = new SQLCHAR[len+1];
strcpy((char *)dbc->Cate,(char *)Cate);
printf("\n copied result ");
env->DeleteLocalRef((jobject)res);
env->DeleteLocalRef((jobject)odbcconnls);
env->DeleteLocalRef((jobject)methodId2);
jvm->DetachCurrentThread();
return ;
destroy:
if ((env)->ExceptionOccurred()) {
(env)->ExceptionDescribe();
jvm->DetachCurrentThread();
(jvm)->DestroyJavaVM();
return SQL_ERROR;
When case 1 is called second time this error is
thrown..
plz help me..
Thanx
MittalSunita. -
Oracle BI EE 11g – Action Framework - Invoke a Java Method from Action links
Hello All,
I have a requirement to save OBIEE 11g report into shared drive. I have created a EJB by using the below link and successfully deployed the application in server(bi_server1) .
http://www.rittmanmead.com/2010/09/oracle-bi-ee-11g-action-framework-java-ejbs-and-pdf-watermarks/
When Im trying to call Invoke a Java method, it is showing "No Content" . Can anybody please share with me the sample "ActionFrameworkConfig.xml" file used for Invoke a Java method.
My OBIEE version is : 11.1.1.7.131017
Thanks.1. check your t3 port no, in my case it's 7001.
so i changed "<jndi-url>t3://localhost:9704</jndi-url>" to "<jndi-url>t3://localhost:7001</jndi-url>"
2. if you run obiee 11.1.1.6.0 above, you don't need below.
<credentialmap>oracle.bi.actions</credentialmap>
so please drop this line.
3. restart your server and check there's no error log when loading ActionFrameworkConfig.xml.
Good Luck !!!
Maybe you are looking for
-
Creating a new FXML File (Eclipse IDE) cannot finish
Following steps on: http://docs.oracle.com/javafx/scenebuilder/1/use_java_ides/sb-with-eclipse.htm#BABBFEBD 5. In the FXML File dialog box, complete the creation of the new FXML document using the following steps:... I get the panel to fill in but no
-
Quicktime removed re-added itunes 7, error signature
Quicktime was removed from computer. itunes wouldn't start. re-installed updated itune 7. now itunes won't open. error report states- error signature. help! tried to restore, didn't work. either need to extract library or figure out my signature prob
-
I have gone through the step by step of uninstalling itunes so that I can reinstall it and cannot get it to install. Help
-
HOWTO -- Install BC4J in OC4J 9.0.3
I have JDdev 903 and OC4J 903. I want to install BC4J in OC4J 903. I can find NO documentation on doing this for OC4J 903, only 902. I assume it is because OC4J 903 is still preview, but come on! The scripts to do this under JDev 902 do not exist in
-
can some one please help me i am trying to do my courswork on windows i need to use the drawing window but everytime i try to compile my code through command promt i get a message saying D:\>javac DrawLine.java DrawLine.java:1: package element does n