0

When I am deploying my war file in Jboss 5.1 , I am getting:

 ERROR [STDERR] log4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
 ERROR [STDERR] log4j:ERROR [BaseClassLoader@18c1f7d{vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/OnlineUsage.war/}] whereas object of type
 ERROR [STDERR] log4j:ERROR "org.jboss.logging.appender.FileAppender" was loaded by [org.jboss.bootstrap.NoAnnotationURLClassLoader@291aff].
 ERROR [STDERR] log4j:ERROR Could not instantiate appender named "FILE".

Even with the above error , I can hit the ?wsdl URL correctly.

Next I tried simply by deleting the log4j jar file from war and deployed successfully without any error. Got ?wsdl correctly too.

My question is whether this will create problem in production or real time(Real time error or binding error).

In the past I got an error Failed to create SAX Parser. If it is not an issue to remove the jar from war, can I remove XercesImpl jar also? Since Jboss has its own jar files, I can avoid Class cast-exceptions.

Philippe Marschall
  • 4,452
  • 1
  • 34
  • 52
Jagan Vittal
  • 98
  • 4
  • 11

1 Answers1

1

In order to avoid class casting exception, I would highly recommend not packaging any JBoss or JDK provided jars in your WEB-INF/lib folder. If you have to for some reason, the utilize class loading isolation with jboss-classloading.xml file.

This principle holds true for other Java EE containers (Websphere, Weblogic, GlassFish, etc) as well. You never want to package JDK and container provided libraries in your own artifact.

You can make use JBoss Tattletale which is a great open source tool to find out what dependencies to not package in WAR/EAR.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
CoolBeans
  • 20,654
  • 10
  • 86
  • 101
  • Thanks for the answer. i have used jboss-classloading.xml also. But of no use. Finally i decided to move the jar files present in WEB-INF/lib to external lib which are not packaged in WAR. Will it be problem in production. What if jar not present when executing the code. Will it look in jboss lib folder. What is the sequence. How it will find the jar. First WEB-ING lib then Jboss/lib if i am right? – Jagan Vittal Mar 15 '13 at 06:12
  • @user1665651 - if JBoss is already providing that jar (jboss-as/lib, or jboss-as/$server_profile/lib, etc) then your WAR will find the classes fine during run time. – CoolBeans Mar 15 '13 at 14:11