Author |
Message
|
javaforvivek |
Posted: Wed Jan 26, 2005 9:22 pm Post subject: Calling Java Method using CSD4 |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
I am on WBIMB5 CSD4 level on Win2K machine.
I am trying to call a static java method where I have to write the message contents to a file.
Well, it's immaterial what the jav method does, but this method has some
statements in it.
My question is which PrintStream object does the
retrieve?
For e.g,
Code: |
public static int writeFile(String filePath)
{
System.out.println("Hello World");
} |
If I call this method through WBIMB, where will I get "Hello World" printed out? Which is the standard output stream for WBIMB? _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
kirani |
Posted: Wed Jan 26, 2005 11:34 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
I think it will work similar to the System.out.println statement in java plug-in node. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
javaforvivek |
Posted: Wed Jan 26, 2005 11:36 pm Post subject: |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
Kiran,
Can you explain it a bit more..
How does it work in Java Plugin Node?
Is there any material available on internet for this? _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 27, 2005 5:13 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
System.out will always receive the standard output stream of the shell that the JVM is running in.
If you run this code on a broker, then the shell that is running the JVM is spawned by the bipbroker service, and consequently the standard output stream is running in a non-printable background environment.
I am not personally aware of any particular means of redirecting that standard output stream. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JLRowe |
Posted: Fri Jan 28, 2005 12:26 pm Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jan 28, 2005 2:11 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
timna wrote: |
The PrintStream System.out probably goes to some file in the broker directory |
Why do you think that?
Most of the broker processes are invoked using javaw, not java. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mgk |
Posted: Fri Jan 28, 2005 3:35 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi,
System.Out when used in a Java plugin node or from a Java method called from ESQL goes to the console. However, there is no console by default as (on windows) the broker runs as a service. For debugging only you can change the broker service to logon as LocalSystem account and check the Interact With Desktop button in the services snapin. This will then show you the console the next time you restart the broker and you will see the System.out output. However, this is not advisable for a production system, and should really only be used during development of new code.
Cheers, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jan 28, 2005 4:10 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Also, it may be possible to use the plug-in API functions that allow you to use the standard broker logging functions. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
shra_k |
Posted: Wed Feb 02, 2005 11:08 pm Post subject: |
|
|
Apprentice
Joined: 30 Dec 2002 Posts: 37
|
For Unix brokers use the env variable "MQSI_RUN_ATTACHED" (= 'y') to get System.out.print* . It will log the msgs into the same window where you have launched the broker with mqsistart command. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Feb 03, 2005 6:15 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
This is a bad idea though.
It may be somewhat convenient for development, but it should not be allowed in production for a WHOLE lot of reasons.
Therefore, it should be strongly discouraged in development.
Among other things, it's a lot easier to use the java remote debugger to connect to the JVM and step through - and you get much better information about what's going on. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kirani |
Posted: Fri Feb 04, 2005 12:41 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
or write debug messages to some text file on your local drive. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
shra_k |
Posted: Fri Feb 04, 2005 3:19 am Post subject: |
|
|
Apprentice
Joined: 30 Dec 2002 Posts: 37
|
The issue was how to print the stream. I have said the same.
I do agree that its not sensible to put such stream statements in production, for that it applies to any java/c application to be put on production. So developers are aware of the fact and they do disable as part of good coding practise.
The above env. variable should be used in a test/dev environement only for a quick look if some problem is being faced. |
|
Back to top |
|
 |
|