Blog
During the past few months, we have been setting up hudson on our servers to automate our GWT and SOA builds, testing and deployments to Weblogic.
Using the helpful wiki page provided on the hudson wiki and thank you to Maxence Button's blog post, this is a step by step installation guide to get Hudson 2.0.1 deployed on to Weblogic 10.3.4.0.
Due to Weblogic's class loading structure, if the hudson.war is directly deployed, the application will fail to startup. This is to because there are jar conflicts between Hudson and Weblogic. To get around the issue, we use the FilteringClassLoader mechanism so that specific hudson jars get priority in the classpath over Weblogic's jars.
Download hudson.war from hudson downloads.
hudson/ |_____ META-INF/ |_____ application.xml |_____ weblogic-application.xml |_____ hudson.war |
Note: This step will not work correctly on MacOSX as it will generate .DS_STORE files within the folders.
Enter the following into application.xml
<?xml version="1.0" encoding="UTF-8"?><?xml version="1.0" encoding="UTF-8"?><application xmlns="http://java.sun.com/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"version="5"><module id="hudson"><web><web-uri>hudson.war</web-uri><context-root>/hudson</context-root></web></module> |
Enter the following into weblogic-application.xml
<?xml version="1.0" encoding="UTF-8"?><wls:weblogic-applicationxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsdhttp://www.bea.com/ns/weblogic/weblogic-application ><!-- server-version: 10.3 --><wls:application-param><wls:param-name>webapp.encoding.default</wls:param-name><wls:param-value>UTF-8</wls:param-value></wls:application-param><wls:prefer-application-packages><wls:package-name>org.apache.*</wls:package-name><wls:package-name>javax.xml.stream.*</wls:package-name><wls:package-name>org.dom4j.*</wls:package-name></wls:prefer-application-packages></wls:weblogic-application>
|
Weblogic needs this because (unlike JBoss, Tomcat, Jetty et. al) Weblogic will not load the JARs in the WAR before the Weblogic installed JARs, and usually the resulting error is that there is an old version of Ant 1.7 in scope, instead of Ant 1.8.x as Hudson wants. There is also a conflict with stax-api-1.0.1.jar for the javax.xml package listed.
Inside the hudson directory, at the same level as META-INF and hudson.war, run the following unix commands or zip the contents of the directory and then rename to hudson.ear
[server]$ zip -r hudson *[server]$ mv hudson.zip hudson.ear
|
Note: Do not zip the hudson folder directly, this will not work. Zip the contents of the hudson folder.
Note: remember to delete any old Hudson WAR or EAR deployments first.
The application will deploy to http://serverName:port/hudson.
If you run into certain java exceptions after deployment (see below for an example). Try removing the hudson working directory (In linux, this is in <user_home>/.hudson) and redeploying the hudson.ear file
org.jvnet.hudson.reactor.ReactorException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.)) at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:246) at hudson.model.Hudson.executeReactor(Hudson.java:727) at hudson.model.Hudson.(Hudson.java:630) at hudson.model.Hudson.(Hudson.java:569) at hudson.WebAppMain$2.run(WebAppMain.java:248) Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.)) at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351) at org.springframework.context.support.MessageSourceSupport.(MessageSourceSupport.java:42) at org.springframework.context.support.AbstractMessageSource.(AbstractMessageSource.java:63) at org.springframework.context.support.ResourceBundleMessageSource.(ResourceBundleMessageSource.java:57) at org.acegisecurity.AcegiMessageSource.(AcegiMessageSource.java:34) at org.acegisecurity.AcegiMessageSource.getAccessor(AcegiMessageSource.java:41) at org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.(AbstractUserDetailsAuthenticationProvider.java:72) at hudson.security.AbstractPasswordBasedSecurityRealm$Authenticator.(AbstractPasswordBasedSecurityRealm.java:175) at hudson.security.AbstractPasswordBasedSecurityRealm.createSecurityComponents(AbstractPasswordBasedSecurityRealm.java:68) at hudson.security.SecurityRealm.getSecurityComponents(SecurityRealm.java:387) at hudson.security.HudsonFilter.reset(HudsonFilter.java:134) at hudson.model.Hudson.setSecurityRealm(Hudson.java:1999) at hudson.model.Hudson$14.run(Hudson.java:2420) at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:147) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:260) at hudson.model.Hudson$4.runTask(Hudson.java:708) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:909) at java.lang.Thread.run(Thread.java:619) Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.) at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397) at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351) at org.springframework.context.support.MessageSourceSupport.(MessageSourceSupport.java:42) at org.springframework.context.support.AbstractMessageSource.(AbstractMessageSource.java:67) at org.springframework.context.support.ResourceBundleMessageSource.(ResourceBundleMessageSource.java:59) ... 17 more Caused by: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:385) ... 24 more