Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
|
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 3rd, 2007, 08:46 AM
Registered User
 
Join Date: Sep 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Log4J question: loading properties file in as

 Hi! I'm a newbee with Log4J.. Well.. I'm working
with Sun One Java System Application Server,
I have a properties file and the scipt in java
with an hashtable who loads the values..then I
can see this values loaded in JBuilder but it
doesn't seems to work with my A.S. !!!

I took care of configuration in the application
server with the jar library and properties file
in the right folder in the file system and with
the path (if it is correct I don't have idea,well
it is "/lib/log4j-1.2.14.jar" and
"/lib/log4j.properties") into the A.S. console in
the JVMSettings/PathSettings
I tried into the java code both with an absolute
or a relative path in my class but it doesn't work..
I tried to test it but I can't have information in
my log server about what is wrong even if I try to
debug the application.

Mine is a server-side application (with a .jar
within an .ear and this .jar in issue contains
other three .jar) who is in a remote communication
with the stand-alone/client-side of the application.

Is there something (or more) huge or tiny I forgot ?

Thanks in advance for help...

 
Old September 14th, 2007, 12:06 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Usually editors will take files which are in their class path and works fine, but when you try to deploy your app in any server then those problems will come up. Now as you said the you've a class which loads properties from a file. That is where the problem might be. Can you give more info how you've written that class.
You can try by placing the properties file in the app server's class path [for example Tomcat's class path folder is TOMCAT_HOME/shared/classes].
If you've a class which loads properties from class you can try by passing the class object to that class and try loading the file through it's getResourceAsStream() metod, if you try like this then the property file should be at the same directory as the class file.


- Rakesh
 
Old September 15th, 2007, 12:39 AM
Registered User
 
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Ant_Yan
Default


May be you should try another server if possible, to judge whether the problem is from server container or your programming code




 
Old September 17th, 2007, 12:19 PM
Authorized User
 
Join Date: Apr 2005
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I do not know if classes would be picked up from the lib directory where you have placed your class file. Lib directories are generally meant for placing your jar files and classes directories for placing the classes. One thing that you can try is to add it to the classes directory parallel to the lib directory and see if it works. Else, try what Rakesh has suggested, putting it to shared/classes directory and see if it works.

Cheers,
eNJay
 
Old December 4th, 2007, 11:05 PM
yulin11
Guest
 
Posts: n/a
Default

just use your heart ,then you can solve it www.codeuu.com






Similar Threads
Thread Thread Starter Forum Replies Last Post
File Down Loading kvingupta Beginning VB 6 0 March 8th, 2006 07:33 AM
Finding the properties of a file BrianWren Pro VB.NET 2002/2003 0 July 20th, 2005 11:38 AM
Accessing properties file outside jar file anand_indya J2EE 0 December 8th, 2004 06:34 AM
reading properties file babuchelat BOOK: Expert One-on-One J2EE Design and Development 0 May 22nd, 2004 07:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.