• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Logger class problem

 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am new to WAS 6.0. I am using Log4j for the logging purpose. I make a new applicaiton and set classpath for the log4j file and the application works fine.

But if i use it in my existing applciaiton (Using RAD, JDK.14, DB2) i get an error saying the NoClassDefFoundError /Logger...
I have set the classpath as the one i had in the earlier applicaiton.There are no seperate /log4j set anywhere else in the app.

1) Why is it not getting integrated in the application. WHat are the additional parameters that i need to put.

2) If in RAD, i am setting the classpath for one applicaiton, will it be used by that applicaiton only or will that be used for all the applications of RAD??? Is the classpath application specific ( as i have only one classpath variable in app1, but existing app has many variables for the classpath)???

Please help!!!

Regards,
Roshani
 
Sheriff
Posts: 28436
104
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand what you mean when you say you "set the classpath" for WAS 6.0. That doesn't make any sense. If you want to include a jar file in your web application, you just put it in the application's WEB-INF/lib directory. There's no classpath for WAS.

As for RAD, I don't understand your question either. I don't understand what these "applications" are. RAD allows you to organize your work in "projects" -- maybe that is what you meant. Anyway, each project has its own build path, which is RAD's equivalent of classpath. That's one of the project's properties. If you are editing the .classpath file in the project directly, then don't do that. Modify the build path via the Properties option of the project.
 
RoshaniG Gopal
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

Please excuse me being so obscure. Allow me to explain once again.

1) I create 2 new Projects (logexample and testapp). For logexample I go to Window>Prefernces>Java>Build Path>Classpath Varaiables and set a New Variable for the log4j. The program works fine. No exception is thrown for the NoClassDefFoundError /Logger.

2) For testapp I go to Window>Prefernces>Java>Build Path>Classpath Varaiables and set a New Variable for the log4j. The Build path contains many more variables. I add a new variable but it now gives me NoClassDefFoundError /Logger.

I wanted to know if the build path is specific to each WAS Project? FYI, I had the file (log4j.jar) in the WEB-INF/lib but it still gave me the error.

Any help is appreciated.

Regards,
Roshani.
 
Paul Clapham
Sheriff
Posts: 28436
104
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by RoshaniG Gopal:
I wanted to know if the build path is specific to each WAS Project? FYI, I had the file (log4j.jar) in the WEB-INF/lib but it still gave me the error.

You have already seen that you can control the build path for a RAD project. And you have already seen that you can make different build paths for different RAD projects. I don't see how you could consider drawing the conclusion that the build path is not specific to the project.

However RAD also has to follow the rules for web applications. If your web application needs to have a jar file in its WEB-INF/lib directory (as for example yours needs log4j.jar) then you do have to actually put it there and not somewhere else. You will notice that doing that causes the jar file to automatically appear in the build path for the project. Putting the jar file somewhere else and adding it to the project's build path may cause things to compile correctly, but the web application won't run as you expect.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In testapp project try following.
testapp> right click> select properties> java Jar Dependancies
and check whether log4j.jar is selected there. if not select and give it a try.
 
RoshaniG Gopal
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

Thanks so much for your Suggestion. It solved my problem. I put the file in WEB-INF/lib and then gave the Build Path.
Then also I specified the properties file that was to be used in the program.
Thanks for all the replies.
javaranch rules

Regards,
Roshani
 
So I left, I came home, and I ate some pie. And then I read this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic