Grails

Deployment error on both jboss-4.2.3.GA and jboss-5.1.0.GA

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Won't Fix
  • Affects Version/s: 1.2-RC2
  • Fix Version/s: 1.2 final
  • Component/s: None
  • Labels:
    None
  • Environment:
    windows 2000

Description

How to replicate issue:
1) Download and install Grails 1.2-RC2
2) grails create-app test
3) grails war
4) Copy test-0.1.war to jboss deploy directory

  • e.g. xx\jboss-4.2.3.GA\server\default\deploy
    5) run jboss
  • e.g run.bat -c default

Jboss will split a lot of errors. Here is some portion of the errors:

— MBeans waiting for other MBeans —
ObjectName: jboss.web.deployment:war=test-0.1.war,id=971911194
State: FAILED
Reason: org.jboss.deployment.DeploymentException: URL file:/C:/Documents and S
ettings/tecways.TECWAYS-0278920/Desktop/jboss-4.2.3.GA/server/default/tmp/deploy
/tmp6828575293335056983test-0.1-exp.war/ deployment failed

— MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM —
ObjectName: jboss.web.deployment:war=test-0.1.war,id=971911194
State: FAILED
Reason: org.jboss.deployment.DeploymentException: URL file:/C:/Documents and S
ettings/tecways.TECWAYS-0278920/Desktop/jboss-4.2.3.GA/server/default/tmp/deploy
/tmp6828575293335056983test-0.1-exp.war/ deployment failed

Trying to fix by removing log4j jar in BuildConfig.groovy :

grails.war.resources = {path ->
delete(file: "$path/WEB-INF/lib/log4j-1.2.15.jar")
}

but no luck.

Issue Links

Activity

Hide
Graeme Rocher added a comment -

Reducing to minor because this is IMO, not a Grails issue. JBoss packages up a whole bunch of libraries such as log4j, hibernate-* and so on that Grails uses. This results in conflicts and deployment time. You have to explicitly create a jboss-web.xml like the below that specifies classloader isolation:

<jboss-web>
	<class-loading>		
		<loader-repository>
		   org.myapp:loader=SomeClassloader
		   <loader-repository-config>
		      java2ParentDelegation=false
		   </loader-repository-config>
		 </loader-repository> 		
	</class-loading>
</jboss-web>

If that doesn't work for you I suggest raising a JIRA on the JBoss JIRA as then it is JBoss doing something bad with its classloaders. In summary, not a Grails issue.

Show
Graeme Rocher added a comment - Reducing to minor because this is IMO, not a Grails issue. JBoss packages up a whole bunch of libraries such as log4j, hibernate-* and so on that Grails uses. This results in conflicts and deployment time. You have to explicitly create a jboss-web.xml like the below that specifies classloader isolation:
<jboss-web>
	<class-loading>		
		<loader-repository>
		   org.myapp:loader=SomeClassloader
		   <loader-repository-config>
		      java2ParentDelegation=false
		   </loader-repository-config>
		 </loader-repository> 		
	</class-loading>
</jboss-web>
If that doesn't work for you I suggest raising a JIRA on the JBoss JIRA as then it is JBoss doing something bad with its classloaders. In summary, not a Grails issue.
Hide
Mohd Rozi added a comment -

It is not work. I just updated to Grails 1.2 final version.After creating jboss-web.xml, I configured like above and remove slf4j-log4j12-1.5.8.jar from the war file. It's still not working. Maybe I need to remove some other files?

I'm stuck now. I need to deploy my application on Jboss but this issue blocked me.

Show
Mohd Rozi added a comment - It is not work. I just updated to Grails 1.2 final version.After creating jboss-web.xml, I configured like above and remove slf4j-log4j12-1.5.8.jar from the war file. It's still not working. Maybe I need to remove some other files? I'm stuck now. I need to deploy my application on Jboss but this issue blocked me.
Hide
Reiner Saddey added a comment -

Hi Mohd,

even when logging prbs might have been resolved one way or the other, JBoss 4 still is just a pain in the *** and I'd urge you to move on to at least JBoss 5.1.

Here's why:

  • JBoss includes Hibernate jars in order to implement EJB3
  • Those ancient Hibernate jars of JBoss 4 conflict with the ones both supplied and needed by Grails
  • Fiddling with class loader delegation within a war does not help at all - JBoss will still prefer its won Hibernate jars in favor of the ones supplied within the war.
  • Trying to work-around by using an EAR instead of a war might solve the problem, but in order to show any effect, it would require to rip out all and every jar from your war, put it into the EAR instead, declare it as a dependency and last-not-least set up class loader isolation within the EAR (which is a non-trivial task in its own due to conflicting documentation).

The only real-world feasible way to have a Grails app successfully deployed to JBoss 4.2 is to manually rip out its Hibernate Jars - thus loosing EJB3. I've done it twice and this has cost my employer 6 hours for each attempt (production servers running at customers sites). Note that this is not a problem with Grails. And it might not be problem with JBoss either, but instead just a version incompatibility to be read this way: Your app requires a version of Hibernate that is just not supplied by JBoss 4 - full stop

So if ever possible, upgrade to JBoss 5. Running Grails on JBoss 5 is a snap - have a look at http://blog.saddey.net/2010/03/06/how-to-deploy-a-grails-application-to-jboss-5/

Regards,
Reiner

Show
Reiner Saddey added a comment - Hi Mohd, even when logging prbs might have been resolved one way or the other, JBoss 4 still is just a pain in the *** and I'd urge you to move on to at least JBoss 5.1. Here's why:
  • JBoss includes Hibernate jars in order to implement EJB3
  • Those ancient Hibernate jars of JBoss 4 conflict with the ones both supplied and needed by Grails
  • Fiddling with class loader delegation within a war does not help at all - JBoss will still prefer its won Hibernate jars in favor of the ones supplied within the war.
  • Trying to work-around by using an EAR instead of a war might solve the problem, but in order to show any effect, it would require to rip out all and every jar from your war, put it into the EAR instead, declare it as a dependency and last-not-least set up class loader isolation within the EAR (which is a non-trivial task in its own due to conflicting documentation).
The only real-world feasible way to have a Grails app successfully deployed to JBoss 4.2 is to manually rip out its Hibernate Jars - thus loosing EJB3. I've done it twice and this has cost my employer 6 hours for each attempt (production servers running at customers sites). Note that this is not a problem with Grails. And it might not be problem with JBoss either, but instead just a version incompatibility to be read this way: Your app requires a version of Hibernate that is just not supplied by JBoss 4 - full stop So if ever possible, upgrade to JBoss 5. Running Grails on JBoss 5 is a snap - have a look at http://blog.saddey.net/2010/03/06/how-to-deploy-a-grails-application-to-jboss-5/ Regards, Reiner

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: