This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Jar hell concerning log4j

 
Greenhorn
Posts: 4
Eclipse IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I use Taverna 1.7.2 and specifically the bootstrap jar 1.7.2.1. I want to run it from my web application (war, named ProticPort) launched by jetty-runner.jar, but I get a conflict when I try to execute a workflow (via Taverna bootstrap). I have my own log4j jar embedded into my webapp with my config, and it seems that Bootstrap get its own too, which lead to a jar hell and make my app shuting down, as you can see below when I try to execute simple example workflow "file:/taverna/taverna-1.7.2/examples/fetch_today_s_xkcd_comic.xml" with Boostrap.main(workflowArgs):

log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [loader{log4j:log4j:1.2.12} from 31539877] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [ContextLoader@Archetype Created Web Application : ProticPort].
log4j:ERROR Could not instantiate appender named "stdout".
log4j:ERROR A "org.apache.log4j.RollingFileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [loader{log4j:log4j:1.2.12} from 31539877] whereas object of type
log4j:ERROR "org.apache.log4j.RollingFileAppender" was loaded by [ContextLoader@Archetype Created Web Application : ProticPort].
log4j:ERROR Could not instantiate appender named "rollingFile".
log4j:ERROR A "org.apache.log4j.RollingFileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [loader{log4j:log4j:1.2.12} from 31539877] whereas object of type
log4j:ERROR "org.apache.log4j.RollingFileAppender" was loaded by [ContextLoader@Archetype Created Web Application : ProticPort].
log4j:ERROR Could not instantiate appender named "rollingFile".
log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [loader{log4j:log4j:1.2.12} from 31539877] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [ContextLoader@Archetype Created Web Application : ProticPort].
log4j:ERROR Could not instantiate appender named "stdout".
log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [loader{log4j:log4j:1.2.12} from 31539877] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [ContextLoader@Archetype Created Web Application : ProticPort].
log4j:ERROR Could not instantiate appender named "stdout".
log4j:ERROR A "org.apache.log4j.RollingFileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [loader{log4j:log4j:1.2.12} from 31539877] whereas object of type
log4j:ERROR "org.apache.log4j.RollingFileAppender" was loaded by [ContextLoader@Archetype Created Web Application : ProticPort].
log4j:ERROR Could not instantiate appender named "rollingFile".
log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [loader{log4j:log4j:1.2.12} from 31539877] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [ContextLoader@Archetype Created Web Application : ProticPort].
log4j:ERROR Could not instantiate appender named "stdout".
log4j:ERROR A "org.apache.log4j.RollingFileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [loader{log4j:log4j:1.2.12} from 31539877] whereas object of type
log4j:ERROR "org.apache.log4j.RollingFileAppender" was loaded by [ContextLoader@Archetype Created Web Application : ProticPort].
log4j:ERROR Could not instantiate appender named "rollingFile".
log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [loader{log4j:log4j:1.2.12} from 31539877] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [ContextLoader@Archetype Created Web Application : ProticPort].
log4j:ERROR Could not instantiate appender named "stdout".
log4j:ERROR A "org.apache.log4j.RollingFileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [loader{log4j:log4j:1.2.12} from 31539877] whereas object of type
log4j:ERROR "org.apache.log4j.RollingFileAppender" was loaded by [ContextLoader@Archetype Created Web Application : ProticPort].
log4j:ERROR Could not instantiate appender named "rollingFile".
log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [loader{log4j:log4j:1.2.12} from 31539877] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [ContextLoader@Archetype Created Web Application : ProticPort].
log4j:ERROR Could not instantiate appender named "CONSOLE".
Unable to determine file for log4j.properties
log4j:WARN No appenders could be found for logger (net.sf.taverna.utils.MyGridConfiguration).
log4j:WARN Please initialize the log4j system properly.
2010-06-16 19:11:57.440:INFO::Shutdown hook executing




Does anyone of you know how to avoid such a jar hell ? Is it possible to disable log for Taverna in order Bootstrap runs correctly ?

For information, I include bootstrap class with maven pom.xml. Running bootstrap jar from command line works correctly.

Any help would be greatly appreciated.
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there and welcome to Javaranch! I'm a little confused, where exactly is the log4j.jar that the bootstrap is using?
 
R Flores
Greenhorn
Posts: 4
Eclipse IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks for your welcome.

log4j.jar is in $jar/WEB_INF/lib/ folder, as taverna-bootstrap.jar. I guess bootstrap uses log4j.jar present in lib directory because bootstrap jar does not contain any third party library.
 
Ranch Hand
Posts: 198
Oracle Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check if you are having multiple log4j.xml files in your workspace/application.

Playing around log4j.xml will definitely resolve your problem.
 
R Flores
Greenhorn
Posts: 4
Eclipse IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I've checked and indeed there is another minimal-log4j.properties in taverna-core jar embedded into my war lib folder: ./taverna-core-1.7.2.1/minimal-log4j.properties (once extracted).

I have deleted this file and another one contained into another embedded jar (Jmol).

To find these files, I have exploded all embedded jar and taken a look into them:



But, even if I remove all other log4j configuration files, I still get the error:



For information, here is my log4j.properties file:



I don't see what is currently causing trouble, any hints is welcome.

Thanks for your help.
 
Prabhakar Reddy Bokka
Ranch Hand
Posts: 198
Oracle Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you use log4j.xml instead of log4j.properties?

That gives you a clear configurations than properties file.
 
Martijn Verburg
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You also need to think about class loading and the scope of your classes. e.g. Jboss Application Server has a log4j.jar and log4j.xml that it uses by default. To supply our own with our deployed EAR files we had to ensure that we bundled our own log4j.xml and own log4j.jar and then told the EAR to consider those first in class loading.
 
R Flores
Greenhorn
Posts: 4
Eclipse IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Prabhakar Bokka: I don't use log4j.xml because of historical facts for this webapp. XML migration may be done later if needed and if dedlines allow it.


Martijn Verburg wrote:To supply our own with our deployed EAR files we had to [...] told the EAR to consider [our own log4j.xml and own log4j.jar] first in class loading.



Ok, where and how do you do this please ?
 
Always look on the bright side of life. At least this ad is really tiny:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!