ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Calling Java Method using CSD4

Post new topic  Reply to topic
 Calling Java Method using CSD4 « View previous topic :: View next topic » 
Author Message
javaforvivek
PostPosted: Wed Jan 26, 2005 9:22 pm    Post subject: Calling Java Method using CSD4 Reply with quote

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
Code:
System.out.println
statements in it.
My question is which PrintStream object does the
Code:
System.out
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
View user's profile Send private message Visit poster's website MSN Messenger
kirani
PostPosted: Wed Jan 26, 2005 11:34 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
javaforvivek
PostPosted: Wed Jan 26, 2005 11:36 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
jefflowrey
PostPosted: Thu Jan 27, 2005 5:13 am    Post subject: Reply with quote

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
View user's profile Send private message
JLRowe
PostPosted: Fri Jan 28, 2005 12:26 pm    Post subject: Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

The PrintStream System.out probably goes to some file in the broker directory, you should be able to find it with some detective work. The out stream can be reassigned with the System.setOut static method.

See:

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Fri Jan 28, 2005 2:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
mgk
PostPosted: Fri Jan 28, 2005 3:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Fri Jan 28, 2005 4:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
shra_k
PostPosted: Wed Feb 02, 2005 11:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Thu Feb 03, 2005 6:15 am    Post subject: Reply with quote

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
View user's profile Send private message
kirani
PostPosted: Fri Feb 04, 2005 12:41 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
shra_k
PostPosted: Fri Feb 04, 2005 3:19 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Calling Java Method using CSD4
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.