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 » java file path problem

Post new topic  Reply to topic
 java file path problem « View previous topic :: View next topic » 
Author Message
duhbaci
PostPosted: Tue Oct 30, 2007 1:01 am    Post subject: java file path problem Reply with quote

Newbie

Joined: 31 May 2007
Posts: 7

Hello,

I am having a problem when I call a java component from ESQL. What I understood is, java component needs to read some files from the application directory and when I call it from message flow; my program does not work properly, because it could not access those files.

Let me explain in detail. This is how I call the java in ESQL;

Code:
CREATE PROCEDURE GetResponse (IN Param1 CHAR, IN Param2 CHAR, IN Param3)
   RETURNS CHAR
   LANGUAGE JAVA
   EXTERNAL NAME "com.aaaaa.bbbbbb.cccccc.dddddd.getResponse";


I tried both ways to deploy .jar files (copying them to shared-classes folder and adding them to BAR file)

In order to deploy configuration files that I need, I manually added them to BAR file, but it did not work. Then I copied them to shared-classes folder, it also did not work. Then I tried all possible directories for message broker. They are

    C:\Documents and Settings\All Users\Application Data\IBM\MQSI

    C:\Documents and Settings\All Users\Application Data\IBM\MQSI\components\WBRK6_DEFAULT_BROKER\3f1099eb-1501-0000-0080-f9e17b949fd7\config\JAR

    C:\Program Files\IBM\MQSI\6.0\jre\bin


Unfortunately, copying files to those folders also did not work.

The jar file that I want to deploy requires those 4 configuration file to be in the same directory, but I could not find a way to do this.

If you know the solution, it is highly appreciated.



Koray
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Oct 30, 2007 1:13 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You have to restart broker after putting Jar files in shared-classes.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
duhbaci
PostPosted: Tue Oct 30, 2007 1:56 am    Post subject: Reply with quote

Newbie

Joined: 31 May 2007
Posts: 7

I also restarted the broker. The problem is not the JAR files.

My main problem is configuration files which are in the same directory (in our case this folder is shared-classes) can not be found.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Oct 30, 2007 3:01 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

So the problem is that the path that the Java classes are using to get at the files is not the same as the actual path to the files?

Try putting the configuration files in the JAR file itself.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
duhbaci
PostPosted: Tue Oct 30, 2007 3:58 am    Post subject: Reply with quote

Newbie

Joined: 31 May 2007
Posts: 7

I don't have the source code, that is the main problem. But I asket for it, I hope to get it soon.

Even though I got the source code, thse files has to be edited for different environments. If I put them in a jar file, it will not be convenient for test and maintenance.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Oct 30, 2007 4:14 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Well, even without the source code you should be able to get them to tell you what path they are trying to use to find the file.

It's basically either a file path problem, or a permissions problem.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Oct 30, 2007 6:36 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

I'd think more of a permissions problem. The right permissions may have to be added to the java.policy file loaded by the broker's jvm.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
duhbaci
PostPosted: Tue Oct 30, 2007 6:56 am    Post subject: Reply with quote

Newbie

Joined: 31 May 2007
Posts: 7

This is where my application fails when it is called by Messsage Broker.

Code:
try {
         Properties logProperties = new Properties();
         logProperties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("log4j.properties"));
         PropertyConfigurator.configure(logProperties);
      } catch (Throwable e) {
         throw new InfraStructureException("Error loading log4j.properties - " + e.getMessage());
      }


Where should I place log4j.properties file then it will work properly?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Oct 30, 2007 7:05 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

This is going to be quite complicated. You seem to be looking for a relative path. Now we have no idea which class your thread is in when you execute the snippet above.

However the path I would expect to find the log4j.properties on is the access path to the class that the current thread is in when it executes this snippet.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Tue Oct 30, 2007 7:10 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

duhbaci wrote:
Where should I place log4j.properties file then it will work properly?


In the JAR file...
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
JLRowe
PostPosted: Tue Oct 30, 2007 7:55 am    Post subject: Reply with quote

Yatiri

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

log4j is probably trying to load log4j.properties from the current working directory, I don't know what this will be, but you could try the message broker install directory (or children of this).

It is possible to write a java node to dump the system properties and find out.

It may also try to get from the classpath, but ""C:\Documents and Settings\All Users\Application Data\IBM\MQSI\components\WBRK6_DEFAULT_BROKER\3f1099eb-1501-0000-0080-f9e17b949fd7\config\JAR"" is part of the classpath, so it should have worked in this case.
Back to top
View user's profile Send private message Send e-mail
duhbaci
PostPosted: Tue Oct 30, 2007 7:56 am    Post subject: Reply with quote

Newbie

Joined: 31 May 2007
Posts: 7

adding file to JAR also did not help.

I will ask to developer of the source code (i don't have the full code) to give the full exception message returning from the code.

Then I can understand it is a file path or permission problem.
Back to top
View user's profile Send private message
JLRowe
PostPosted: Tue Oct 30, 2007 7:59 am    Post subject: Reply with quote

Yatiri

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

You can always decompile the code

http://www.kpdus.com/jad.html
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » java file path problem
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.