Deploying grails application on Jboss 7.1.2 with provided dependencies - grails

I want to deploy multiple grails applications on Jboss. Because they all use same grails version (2.1.1) I want to exclude common jars from war file and provide them via Jboss module. For starters, I'm trying with one application, but can't get it to work.
What I tried
Set defaultDependenciesProvided true in BuildConfig.groovy (before inherits("global"))
Created module folders: modules/commons/grails/main and put all the common jars in
Created module.xml
Added Dependencies: commons.grails to MANIFEST.MF file inside war
Tried to deploy the app
What happend
10:16:12,800 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "sofmk13-web-0.1.war"
10:16:23,095 WARN [org.jboss.modules] (MSC service thread 1-4) Failed to define class org.codehaus.groovy.grails.web.taglib.jsp.JspInvokeGrailsTagLibTag in Module "commons.grails:main" from local module loader #4ec57293 (roots: C:\development\tools\jboss-as-7.1.2.Final\modules,C:\development\repository\jboss): java.lang.LinkageError: Failed to link org/codehaus/groovy/grails/web/taglib/jsp/JspInvokeGrailsTagLibTag (Module "commons.grails:main" from local module loader #4ec57293 (roots: C:\development\tools\jboss-as-7.1.2.Final\modules,C:\development\repository\jboss))
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
at org.jboss.modules.Module.loadModuleClass(Module.java:527)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_17]
at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [rt.jar:1.7.0_17]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_17]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
at org.jboss.modules.Module.loadModuleClass(Module.java:527)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_17]
at java.lang.Class.forName(Class.java:266) [rt.jar:1.7.0_17]
at org.jboss.as.server.deployment.reflect.DeploymentClassIndex.classIndex(DeploymentClassIndex.java:54)
at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:81) [jboss-as-ee-7.1.2.Final.jar:7.1.2.Final]
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:116)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
Caused by: java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/DynamicAttributes
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_17]
at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [rt.jar:1.7.0_17]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_17]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
... 31 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.jsp.tagext.DynamicAttributes from [Module "commons.grails:main" from local module loader #4ec57293 (roots: C:\development\tools\jboss-as-7.1.2.Final\modules,C:\development\repository\jboss)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 36 more
There is a lot of similar warnings for different classes.
Can somebody point me to what to try next? I can't decipher what exactly is wrong from the error message.
Thanks!

After some trial and error I finally managed to exclude some of the jars and provide them as modules. The hardest part was to get all the jar dependencies right. A brief overview follows. We start with description of how to prepare war archive to use the modules. Then we describe how modules are added to jboss.
Prepare WAR archive (assuming the modules are already provided)
create jboss-deployment-structure.xml file inside /web-app/WEB-INF folder. Here we specify which modules application uses and set appropriate versions (with slot parameter). Note that these modules provide all the jars we'll excluded from the war in the next step.
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<dependencies>
<module name="commons.restGrailsJars" slot="2.1.1"/>
<module name="org.springframework" slot="3.1.2.RELEASE"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
add code to exclude shared jars from war file. We use grails.war.resources configuration option inside BuildConfig.groovy. It lets us do some extra processing before war is created, so we can delete shared jars from the archive (they are listed in the list). Append following lines to the file:
grails.war.resources = { resourceDir ->
File libDir = new File(resourceDir, 'WEB-INF/lib')
['aopalliance',
'asm',
'aspectjrt',
'aspectjweaver',
'cglib',
'commons-beanutils',
'commons-codec',
'commons-collections',
'commons-dbcp',
'commons-el',
'commons-fileupload',
'commons-io',
'oro',
'sitemesh',
'slf4j',
'spring-aop',
'spring-asm',
'spring-beans',
'spring-core',
'spring-expression',
'xpp3_min',
'h2',
'servlet-api']
.each { jarNameStart ->
libDir.eachFile { file ->
if (file.name.startsWith(jarNameStart)) {
file.delete()
println "deleted jar $file"
}
}
}
}
Adding Jboss modules
Adding modules is pretty easy if we know what dependencies are needed by each jar library. Here is an example of adding modules for Spring version 3.2.3.RELEASE.
Spring framework jars reside inside modules/org/springframework folder.
Create new folder named 3.2.3.RELEASE and copy all the jars that can be shared*.
Put module.xml beside the jars. It looks something like this: (notice changed slot value which corresponds to release version and folder name)
<module xmlns="urn:jboss:module:1.1" name="org.springframework" slot="3.2.3.RELEASE">
<resources>
<resource-root path="spring-asm-3.2.3.RELEASE.jar"/>
<resource-root path="spring-core-3.2.3.RELEASE.jar"/>
<resource-root path="spring-aop-3.2.3.RELEASE.jar"/>
<resource-root path="spring-beans-3.2.3.RELEASE.jar"/>
<resource-root path="spring-expression-3.2.3.RELEASE.jar"/>
</resources>
<dependencies>
<module name="aopalliance.aopalliance" export="true"/>
<module name="cglib.cglib" export="true"/>
<module name="org.aspectj.aspectjweaver" export="true"/>
<module name="org.apache.commons.logging" export="true"/>
<module name="org.apache.commons.pool" export="true"/>
<module name="javax.servlet.api"/>
<module name="javax.faces.api" slot="1.2" />
<module name="com.sun.jsf-impl" slot="1.2" />
<module name="org.jboss.vfs"/>
<module name="javax.persistence.api"/>
<module name="javax.xml.bind.api"/>
<module name="javax.api"/>
<module name="javax.jms.api"/>
<module name="javax.annotation.api"/>
</dependencies>
</module>
If some modules are missing, application won't deploy (or it will, but strange things, like email validation failures will happen).
You have to do similar thing for all the libraries you want to exclude from war archive. I managed to exclude all the jars listed in 'Prepare WAR archive' section (2.).

There are several root resources you are including that are already modules so you should add a dependency rather than including the JAR. You also should probably avoid adding jcl-over-slf4j-1.6.2.jar. There is already an slf4j bridge provided.
The error seems to indicate you need a dependency on javax.servlet.jsp.api.
I didn't go over it in great detail, but I'm thinking your module.xml should look more like the following.
<module xmlns="urn:jboss:module:1.1" name="commons.grails">
<resources>
<resource-root path="aopalliance-1.0.jar"/>
<resource-root path="asm-3.1.jar"/>
<resource-root path="aspectjrt-1.6.10.jar"/>
<resource-root path="aspectjweaver-1.6.10.jar"/>
<resource-root path="cglib-2.2.jar"/>
<resource-root path="commons-codec-1.5.jar"/>
<resource-root path="commons-dbcp-1.4.jar"/>
<resource-root path="commons-el-1.0.jar"/>
<resource-root path="commons-fileupload-1.2.2.jar"/>
<resource-root path="commons-validator-1.3.1.jar"/>
<resource-root path="concurrentlinkedhashmap-lru-1.2_jdk5.jar"/>
<resource-root path="ehcache-core-2.4.6.jar"/>
<resource-root path="grails-bootstrap-2.1.1.jar"/>
<resource-root path="grails-core-2.1.1.jar"/>
<resource-root path="grails-crud-2.1.1.jar"/>
<resource-root path="grails-datastore-core-1.1.0.RELEASE.jar"/>
<resource-root path="grails-datastore-gorm-1.1.0.RELEASE.jar"/>
<resource-root path="grails-datastore-simple-1.1.0.RELEASE.jar"/>
<resource-root path="grails-hibernate-2.1.1.jar"/>
<resource-root path="grails-logging-2.1.1.jar"/>
<resource-root path="grails-plugin-codecs-2.1.1.jar"/>
<resource-root path="grails-plugin-controllers-2.1.1.jar"/>
<resource-root path="grails-plugin-converters-2.1.1.jar"/>
<resource-root path="grails-plugin-datasource-2.1.1.jar"/>
<resource-root path="grails-plugin-domain-class-2.1.1.jar"/>
<resource-root path="grails-plugin-filters-2.1.1.jar"/>
<resource-root path="grails-plugin-gsp-2.1.1.jar"/>
<resource-root path="grails-plugin-i18n-2.1.1.jar"/>
<resource-root path="grails-plugin-log4j-2.1.1.jar"/>
<resource-root path="grails-plugin-mimetypes-2.1.1.jar"/>
<resource-root path="grails-plugin-scaffolding-2.1.1.jar"/>
<resource-root path="grails-plugin-services-2.1.1.jar"/>
<resource-root path="grails-plugin-servlets-2.1.1.jar"/>
<resource-root path="grails-plugin-url-mappings-2.1.1.jar"/>
<resource-root path="grails-plugin-validation-2.1.1.jar"/>
<resource-root path="grails-resources-2.1.1.jar"/>
<resource-root path="grails-spring-2.1.1.jar"/>
<resource-root path="grails-web-2.1.1.jar"/>
<resource-root path="groovy-all-1.8.8.jar"/>
<resource-root path="icu4j-51_1.jar"/>
<resource-root path="oro-2.0.8.jar"/>
<resource-root path="postgresql-9.2-1002.jdbc4.jar"/>
<resource-root path="sitemesh-2.4.jar"/>
<resource-root path="spring-aop-3.1.2.RELEASE.jar"/>
<resource-root path="spring-asm-3.1.2.RELEASE.jar"/>
<resource-root path="spring-aspects-3.1.2.RELEASE.jar"/>
<resource-root path="spring-beans-3.1.2.RELEASE.jar"/>
<resource-root path="spring-context-3.1.2.RELEASE.jar"/>
<resource-root path="spring-context-support-3.1.2.RELEASE.jar"/>
<resource-root path="spring-core-3.1.2.RELEASE.jar"/>
<resource-root path="spring-expression-3.1.2.RELEASE.jar"/>
<resource-root path="spring-jdbc-3.1.2.RELEASE.jar"/>
<resource-root path="spring-jms-3.1.2.RELEASE.jar"/>
<resource-root path="spring-orm-3.1.2.RELEASE.jar"/>
<resource-root path="spring-tx-3.1.2.RELEASE.jar"/>
<resource-root path="spring-web-3.1.2.RELEASE.jar"/>
<resource-root path="spring-webmvc-3.1.2.RELEASE.jar"/>
<resource-root path="xpp3_min-1.1.4c.jar"/>
</resources>
<dependencies>
<module name="javax.servlet.jsp.api" export="true"/>
<module name="javax.servlet.jstl.api" export="true"/>
<module name="com.h2database.h2"/>
<module name="org.apache.commons.beanutils"/>
<module name="org.apache.commons.collections"/>
<module name="org.apache.commons.lang"/>
<module name="org.apache.commons.io"/>
<module name="org.apache.commons.pool"/>
<module name="org.apache.log4j"/>
<module name="org.slf4j"/>
</dependencies>
</module>
I've removed some of the dependencies not needed and added module dependencies where appropriate.

Related

Why isn't Ivy downloading an artifact from our intranet repo?

I've had a prototype Ivy build working reasonably well. I just looked at it today and I'm seeing that it's finding an artifact on my intranet repo but not downloading it to the local cache or retrieving it in my local build, which causes the build to fail.
The build specifies several other dependencies, most of which are found on mavencentral, and one in another repo in the same local intranet repo that it's finding (but not downloading) the other artifact.
I've tried a few times to clear out the ivy cache and run this again, but it downloads all of the artifacts except for this particular one.
First, here is the relevant output from the build, with some minor pieces elided:
install-dependencies:
:: Apache Ivy 2.3.0 - 20130110142753 :: http://ant.apache.org/ivy/ ::
:: loading settings :: file = <pathtoivysettingsxmlfile>
:: resolving dependencies :: com.att.ecom.poc#coherence_poc;working#<hostname> [not transitive]
confs: [default]
found com.att.ecom.poc#poc-domain-model;0.0.1-SNAPSHOT in mavenCentralSnapshots
found org.apache.commons#commons-lang3;3.1 in central
found org.springframework#spring-aop;4.0.0.RELEASE in central
found org.springframework#spring-beans;4.0.0.RELEASE in central
found org.springframework#spring-context;4.0.0.RELEASE in central
found org.springframework#spring-core;4.0.0.RELEASE in central
found org.springframework#spring-expression;4.0.0.RELEASE in central
found org.springframework#spring-web;4.0.0.RELEASE in central
found com.oracle.coherence#coherence;12.1.2-0-0 in mavenCentralThirdparty
:: resolution report :: resolve 351ms :: artifacts dl 8ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 9 | 0 | 0 | 0 || 8 | 0 |
---------------------------------------------------------------------
:: retrieving :: com.att.ecom.poc#coherence_poc
confs: [default]
0 artifacts copied, 8 already retrieved (0kB/5ms)
The repositories "mavenCentralSnapshots" and "mavenCentralThirdparty" are actually on our local intranet repo (which is also confusedly called "maven central").
Notice that it says there are 9 modules, but only 8 were downloaded. The first artifact in the list, "poc-domain-model" is the one that is not being downloaded, but I don't see why.
Here is my "ivysettings.xml" file:
<ivysettings>
<settings defaultResolver="default"/>
<property name="m2-pattern" value="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" override="false" />
<resolvers>
<chain name="default">
<filesystem name="local-maven2" m2compatible="true" >
<artifact pattern="${m2-pattern}"/>
<ivy pattern="${m2-pattern}"/>
</filesystem>
<ibiblio name="mavenCentralSnapshots" m2compatible="true"
root="http://<hostandport>/nexus/content/repositories/cditspoc-snapshots"/>
<ibiblio name="mavenCentralThirdparty" m2compatible="true"
root="http://<hostandport>/nexus/content/repositories/cditspoc-3rd-party"/>
<ibiblio name="central" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
And here is my "ivy.xml":
<ivy-module version="2.0">
<info organisation="com.att.ecom.poc" module="coherence_poc"/>
<dependencies>
<dependency org="com.att.ecom.poc" name="poc-domain-model" rev="0.0.1-SNAPSHOT"/>
<dependency org="org.apache.commons" name="commons-lang3" rev="3.1"/>
<dependency org="org.springframework" name="spring-aop" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-beans" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-context" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-core" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-expression" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-web" rev="4.0.0.RELEASE"/>
<dependency org="com.oracle.coherence" name="coherence" rev="12.1.2-0-0"/>
</dependencies>
</ivy-module>
And finally, here's the excerpt from my build.xml that calls Ivy:
<target name="install-dependencies">
<ivy:resolve transitive="false" type="jar"/>
<ivy:retrieve conf="*" type="jar" pattern="${basedir}/lib/[artifact]-[type]-[revision].[ext]"/>
</target>
Is it obvious what my problem is, or is there something I can do to get more information?
Update:
Here is an elided version of my "com.att.ecom.poc-coherence_poc-default.xml" file:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
<info
organisation="com.att.ecom.poc"
module="coherence_poc"
revision="working#<hostname>"
conf="default"
confs="default"
date="20140210084517"/>
<dependencies>
<module organisation="com.oracle.coherence" name="coherence">
<revision name="12.1.2-0-0" status="release" pubdate="20131118143843" resolver="mavenCentralThirdparty" artresolver="mavenCentralThirdparty" homepage="" downloaded="false" searched="false" default="false" conf="system, default, optional, compile, *, provided, runtime, javadoc, sources, master" position="8">
<metadata-artifact status="no" details="" size="2283" time="0" location="<homedir>\.ivy2\cache\com.oracle.coherence\coherence\ivy-12.1.2-0-0.xml" searched="false" origin-is-local="false" origin-location="<intranetmavenrepo>/nexus/content/repositories/cditspoc-3rd-party/com/oracle/coherence/coherence/12.1.2-0-0/coherence-12.1.2-0-0.pom"/>
<caller organisation="com.att.ecom.poc" name="coherence_poc" conf="default" rev="12.1.2-0-0" rev-constraint-default="12.1.2-0-0" rev-constraint-dynamic="12.1.2-0-0" callerrev="working#<hostname>"/>
<artifacts>
<artifact name="coherence" type="jar" ext="jar" status="no" details="" size="7027491" time="0" location="<homedir>\.ivy2\cache\com.oracle.coherence\coherence\jars\coherence-12.1.2-0-0.jar">
<origin-location is-local="false" location="<intranetmavenrepo>/nexus/content/repositories/cditspoc-3rd-party/com/oracle/coherence/coherence/12.1.2-0-0/coherence-12.1.2-0-0.jar"/>
</artifact>
</artifacts>
</revision>
</module>
<module organisation="org.springframework" name="spring-web">
<revision name="4.0.0.RELEASE" status="release" pubdate="20131211234952" resolver="central" artresolver="central" homepage="https://github.com/SpringSource/spring-framework" downloaded="false" searched="false" default="false" conf="system, default, optional, compile, *, provided, runtime, javadoc, sources, master" position="7">
<license name="The Apache Software License, Version 2.0" url="http://www.apache.org/licenses/LICENSE-2.0.txt"/>
<metadata-artifact status="no" details="" size="5998" time="0" location="<homedir>\.ivy2\cache\org.springframework\spring-web\ivy-4.0.0.RELEASE.xml" searched="false" origin-is-local="false" origin-location="http://repo1.maven.org/maven2/org/springframework/spring-web/4.0.0.RELEASE/spring-web-4.0.0.RELEASE.pom"/>
<caller organisation="com.att.ecom.poc" name="coherence_poc" conf="default" rev="4.0.0.RELEASE" rev-constraint-default="4.0.0.RELEASE" rev-constraint-dynamic="4.0.0.RELEASE" callerrev="working#<hostname>"/>
<artifacts>
<artifact name="spring-web" type="jar" ext="jar" status="no" details="" size="661567" time="0" location="<homedir>\.ivy2\cache\org.springframework\spring-web\jars\spring-web-4.0.0.RELEASE.jar">
<origin-location is-local="false" location="http://repo1.maven.org/maven2/org/springframework/spring-web/4.0.0.RELEASE/spring-web-4.0.0.RELEASE.jar"/>
</artifact>
</artifacts>
</revision>
</module>
... several other spring and commons artifacts resolved from central
<module organisation="com.att.ecom.poc" name="poc-domain-model">
<revision name="0.0.1-SNAPSHOT" status="integration" pubdate="20140207093019" resolver="mavenCentralSnapshots" artresolver="mavenCentralSnapshots" homepage="" downloaded="false" searched="false" default="false" conf="system, default, optional, compile, *, provided, runtime, javadoc, sources, master" position="0">
<metadata-artifact status="no" details="" size="3337" time="0" location="<homedir>\.ivy2\cache\com.att.ecom.poc\poc-domain-model\ivy-0.0.1-SNAPSHOT.xml" searched="false" origin-is-local="false" origin-location="<intranetmavenrepo>/nexus/content/repositories/cditspoc-snapshots/com/att/ecom/poc/poc-domain-model/0.0.1-SNAPSHOT/poc-domain-model-0.0.1-20140207.173018-85.pom"/>
<caller organisation="com.att.ecom.poc" name="coherence_poc" conf="default" rev="0.0.1-SNAPSHOT" rev-constraint-default="0.0.1-SNAPSHOT" rev-constraint-dynamic="0.0.1-SNAPSHOT" callerrev="working#<hostname>"/>
<artifacts>
</artifacts>
</revision>
</module>
</dependencies>
</ivy-report>
Update:
I finally noticed that the download fails because the exact fully-qualified path doesn't exist on the intranet repo. It's looking for a file with "SNAPSHOT" in the name, but the files in the directory only have timestamps, not "SNAPSHOT".
I noticed the following discussion, which seems relevant: enter link description here .
As a result of this, I modified by "ivysettings.xml" to the following slightly elided version:
<ivysettings>
<settings defaultResolver="default"/>
<property name="m2-pattern" value="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" override="false" />
<resolvers>
<chain name="default">
<filesystem name="local-maven2" m2compatible="true" >
<artifact pattern="${m2-pattern}"/>
<ivy pattern="${m2-pattern}"/>
</filesystem>
<ibiblio name="mavenCentralSnapshots" m2compatible="true"
root="http://<hostandport>/nexus/content/repositories/cditspoc-snapshots"
pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
<ibiblio name="mavenCentralThirdparty" m2compatible="true"
root="http://<hostandport>/nexus/content/repositories/cditspoc-3rd-party"/>
<ibiblio name="central" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
Unfortunately, this made no difference, it still just tries to find the "SNAPSHOT" file, which doesn't exist.
Update:
Actually, I realized another extremely important detail in that error where it fails to find the SNAPSHOT artifact on our MavenCentral. Here's the actual excerpt from the output:
:: problems summary ::
:::: WARNINGS
[FAILED ] com.att.ecom.poc#poc-domain-model;0.0.1-SNAPSHOT!poc-domain-model.jar(bundle): (0ms)
==== shared: tried
C:\Users\dk068x\.ivy2\shared\com.att.ecom.poc\poc-domain-model\0.0.1-SNAPSHOT\bundles\poc-domain-model.jar
==== public: tried
http://repo1.maven.org/maven2/com/att/ecom/poc/poc-domain-model/0.0.1-SNAPSHOT/poc-domain-model-0.0.1-SNAPSHOT.jar
What I should have noticed from this is that it isn't even trying to get the artifact from my snapshot repository at all. It's failing to find it on the public mavencentral, not mine. That tells me there's something wrong with my "ivysettings.xml", but I don't know what it would be.
Please check the comment above as well:
however in addition: change your ivy.xml to the following:
<ivy-module version="2.0">
<info organisation="com.att.ecom.poc" module="coherence_poc"/>
<dependencies>
<dependency org="com.att.ecom.poc" name="poc-domain-model" rev="0.0.1-SNAPSHOT"/>
</dependencies>
</ivy-module>
And then enable check the "ivy console" with debug level. (Ivy console in the console view of Eclipse) if possible.

Publish fails for large artifact

For a legacy project I'm currently introducing Ivy with Artifactory. I have some reusable scripts that work pretty well for jars and zips with sources. However, now I need to publish several large artifacts - zip-files, largest ~150MB. The publish fails with the following error-message:
impossible to publish artifacts for com.siemens.nucleus.tmbo#TMBO-RELEASE;1.6-SNAPSHOT: java.io.IOException: Error writing to server
Caused by: java.io.IOException: Error writing to server at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:578)
A workaround is to change the order of artifacts: small one first. It seems it has something to do with authentication - ivy seems to try with anonymous first, if that fails it tries with the configured user, but in the error case it only tries with anonymous, but twice (interpretation of Artifactory's access-log).
I'd rather go with a solution than a workaround - any ideas? Can I force ivy to always use the credentials?
Here is my ivy.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info
organisation="myorg"
module="mymodule"
revision="1.6-SNAPSHOT"
status="integration" />
<configurations>
<include file="${ivy.confs.file}" />
</configurations>
<publications>
<artifact name="large_artifact" ext="zip" type="deploy" />
<artifact name="small_artifact" ext="zip" type="deploy" />
</publications>
<dependencies>
<!-- None. -->
</dependencies>
</ivy-module>
EDIT:
ivysettings.xml:
<ivy-settings>
<settings defaultResolver="default" />
<include url="ivysettings-shared.xml" />
<include url="${ivy.default.settings.dir}/ivysettings-local.xml" />
<resolvers>
<chain name="default" returnFirst="true" checkmodified="true">
<resolver ref="local" />
<resolver ref="shared" />
</chain>
</resolvers>
</ivy-settings>
ivysettings-shared.xml:
<ivy-settings>
<!--Authentication required for publishing (deployment). 'Artifactory Realm'
is the realm used by Artifactory so don't change it. -->
<credentials host="my-url.com" realm="Artifactory Realm"
username="${ivy.repo.my-company.username}" passwd="${ivy.repo.my-company.password}" />
<resolvers>
<chain name="shared">
<url name="my-releases" m2compatible="false">
<artifact
pattern="https://my-url.com/artifactory/my-releases/[organisation]/[module]/[revision]/[type]s/[artifact](-[classifier])-[revision].[ext]" />
<ivy
pattern="https://my-url.com/artifactory/my-releases/[organisation]/[module]/[revision]/[type]s/ivy-[revision].xml" />
</url>
<url name="my-snapshots" m2compatible="false">
<artifact
pattern="https://my-url.com/artifactory/my-snapshots/[organisation]/[module]/[revision]/[type]s/[artifact](-[classifier])-[revision].[ext]" />
<ivy
pattern="https://my-url.com/artifactory/my-snapshots/[organisation]/[module]/[revision]/[type]s/ivy-[revision].xml" />
</url>
<ibiblio name="my-external" m2compatible="true"
root="https://my-url.com/artifactory/all" />
</chain>
</resolvers>
</ivy-settings>
ivy.repo.my-company.username and ivy.repo.my-company.password are defined in a properties file %IVY-HOME%\security.properties

Why I receive this strange 'ExceptionHandlerFactory' issue on jboss-7?

I want to migrate an existing icefaces application into jboss server 7 but I receive this exception:
15:01:27,399 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC ser
vice thread 1-2) Critical error during deployment: : com.sun.faces.config.Config
urationException: Factory 'javax.faces.context.ExceptionHandlerFactory' was not
configured properly.
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactories
Exist(FactoryConfigProcessor.java:305) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.processor.FactoryConfigProcessor.process(Factory
ConfigProcessor.java:219) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:361)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureLi
stener.java:225) [jsf-impl-2.1.7-jbossorg-2.jar:]
at org.apache.catalina.core.StandardContext.contextListenerStart(Standar
dContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
850) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentS
ervice.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
rviceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
rollerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1110) [rt.jar:1.7.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:603) [rt.jar:1.7.0]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
Caused by: javax.faces.FacesException: org.icefaces.impl.application.ExtendedExc
eptionHandlerFactory
at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java
:643) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.jav
a:509) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.FactoryFinder.access$400(FactoryFinder.java:139) [jboss-j
sf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.jav
a:993) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:343) [jboss-j
sf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactories
Exist(FactoryConfigProcessor.java:303) [jsf-impl-2.1.7-jbossorg-2.jar:]
... 11 more
Caused by: java.lang.InstantiationException: org.icefaces.impl.application.Exten
dedExceptionHandlerFactory
at java.lang.Class.newInstance0(Class.java:357) [rt.jar:1.7.0]
at java.lang.Class.newInstance(Class.java:325) [rt.jar:1.7.0]
at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java
:641) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
... 16 more
I am simply stuck 'cause I don't know how to solve this.
Does anybody have a clue?
I have javax.faces.jar in my lib directory of ear but seems that removing it does not help (I receive a lot of other exceptions).
UPDATE: If I add this to web.xml:
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
the error seems to be gone, but another one appears:
15:56:51,975 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-
host].[/cloudmatrix]] (MSC service thread 1-3) Exception sending context initial
ized event to listener instance of class com.sun.faces.config.ConfigureListener:
java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIG
URATION FAILED! Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider i
s not an instance of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureLi
stener.java:292) [javax.faces.jar:2.1.6-SNAPSHOT]
at org.apache.catalina.core.StandardContext.contextListenerStart(Standar
dContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
850) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentS
ervice.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
rviceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
rollerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1110) [rt.jar:1.7.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:603) [rt.jar:1.7.0]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
Caused by: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! Cl
ass org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is not an instance
of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:375)
[javax.faces.jar:2.1.6-SNAPSHOT]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureLi
stener.java:225) [javax.faces.jar:2.1.6-SNAPSHOT]
... 8 more
Caused by: javax.faces.FacesException: Class org.jboss.as.web.deployment.jsf.Jan
dexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.spi.AnnotationProviderFactory.createAnnotationProvider(
AnnotationProviderFactory.java:78) [javax.faces.jar:2.1.6-SNAPSHOT]
at com.sun.faces.config.ConfigManager$AnnotationScanTask.<init>(ConfigMa
nager.java:807) [javax.faces.jar:2.1.6-SNAPSHOT]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:348)
[javax.faces.jar:2.1.6-SNAPSHOT]
... 9 more
I had to put jboss-deployment-structure.xml in my ear with this content:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="javax.faces.api" slot="main"/>
<module name="com.sun.jsf-impl" slot="main"/>
<module name="javax.faces.api" slot="1.2"/>
<module name="com.sun.jsf-impl" slot="1.2"/>
<module name="org.jboss.as.web" slot="main" />
</exclusions>
<dependencies>
<module name="org.hibernate.validator" export="true"/>
<module name="javax.validation.api" export="true"/>
<module name="org.codehaus.jettison" export="true"/>
<module name="org.jboss.resteasy.resteasy-jaxrs" export="true"/>
<module name="org.jboss.resteasy.resteasy-jackson-provider" export="true"/>
<module name="org.apache.log4j" export="true"/>
<module name="org.jboss.as.web" slot="main" export="true"/>
<module name="javax.faces.api" slot="main" export="true"/>
<module name="com.sun.jsf-impl" slot="main" export="true"/>
<module name="org.jboss.as.web" slot="main">
<imports>
<include path="/org/**" />
<exclude path="/META-INF/**" />
</imports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>

Configuring JBoss AS 7.1.1 with Mojarra 2.0.4 issues

I have a working webapp on JBoss AS 5.1.0 GA. Which uses Mojarra 2.0.4 jars. I'm in a process of migrating this on to JBoss AS 7.1.1. This version of JBoss is shipped with 2.1.7. So I downgraded the Mojarra version by defining slots for 2.0.4 and referring to them as dependency in the META-INF/jboss-deployment-structure.xml along with other dependencies.
jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="javax.faces.api" slot="main"/>
<module name="com.sun.jsf-impl" slot="main"/>
<module name="javax.faces.api" slot="1.2"/>
<module name="com.sun.jsf-impl" slot="1.2"/>
</exclusions>
<dependencies>
<module name="org.hibernate.validator" export="true"/>
<module name="javax.validation.api" export="true"/>
<module name="com.google.gson" export="true"/>
<module name="org.codehaus.jettison" export="true"/>
<module name="org.jboss.resteasy.resteasy-jaxrs" export="true"/>
<module name="org.jboss.resteasy.resteasy-jackson-provider" export="true"/>
<module name="org.apache.log4j" export="true"/>
<module name="org.jboss.as.web" slot="main" export="true"/>
<module name="javax.faces.api" slot="2.0.4" export="true"/>
<module name="com.sun.jsf-impl" slot="2.0.4" export="true"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
This caused the following exception to be thrown at deployment
12:51:18,761 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-3) Initializing Mojarra 2.0.4 (FCS b09) for context ''
12:51:20,355 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-3) Unsanitized stacktrace from failed start...: javax.faces.FacesException: Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
To which I referred to this link and modified my dependencies as follows
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="javax.faces.api" slot="main"/>
<module name="com.sun.jsf-impl" slot="main"/>
<module name="javax.faces.api" slot="1.2"/>
<module name="com.sun.jsf-impl" slot="1.2"/>
<module name="org.jboss.as.web" slot="main" />
</exclusions>
<dependencies>
<module name="org.hibernate.validator" export="true"/>
<module name="javax.validation.api" export="true"/>
<module name="com.google.gson" export="true"/>
<module name="org.codehaus.jettison" export="true"/>
<module name="org.jboss.resteasy.resteasy-jaxrs" export="true"/>
<module name="org.jboss.resteasy.resteasy-jackson-provider" export="true"/>
<module name="org.apache.log4j" export="true"/>
<module name="org.jboss.as.web" slot="main" export="true"/>
<module name="javax.faces.api" slot="2.0.4" export="true"/>
<module name="com.sun.jsf-impl" slot="2.0.4" export="true"/>
<module name="org.jboss.as.web" slot="main">
<imports>
<include path="/org/**" />
<exclude path="/META-INF/**" />
</imports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>
Which got rid of the error at deployment but introduced the following runtime exception
12:59:19,434 ERROR [stderr] (http--0.0.0.0-8080-4) java.lang.IllegalArgumentException: null source
12:59:19,435 ERROR [stderr] (http--0.0.0.0-8080-4) at java.util.EventObject.<init>(EventObject.java:38)
12:59:19,436 ERROR [stderr] (http--0.0.0.0-8080-4) at javax.faces.event.SystemEvent.<init>(SystemEvent.java:71)
12:59:19,444 ERROR [stderr] (http--0.0.0.0-8080-4) at javax.faces.event.ComponentSystemEvent.<init>(ComponentSystemEvent.java:73)
and
12:59:19,489 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/].[Faces Servlet]] (http--0.0.0.0-8080-4) Servlet.service() for servlet Faces Servlet threw exception: java.lang.NullPointerException
at com.sun.faces.context.PartialViewContextImpl.createPartialResponseWriter(PartialViewContextImpl.java:431) [jsf-impl.jar:2.0.4-b09]
at com.sun.faces.context.PartialViewContextImpl.access$300(PartialViewContextImpl.java:72) [jsf-impl.jar:2.0.4-b09]
at com.sun.faces.context.PartialViewContextImpl$DelayedInitPartialResponseWriter.getWrapped(PartialViewContextImpl.java:559) [jsf-impl.jar:2.0.4-b09]
I figured (by googling, of course) that the exception is often caused by three things
Invalid/unclosed tags used in xhtml (a wrongly propagated exception)
Session timeout (a wrongly propagated exception)
Limit on no of POST parameters in Tomcat
Unfortunately, first two were not the causes. I ran my erroneous xhtml pages through validators and found that markup was valid, neither was my session had expired. I also increased the org.apache.tomcat.util.http.Parameters.MAX_COUNT to 5000 in standalone.xml to address the third point. The error still persists.
I also tried migrating to the default bundled Mojarra 2.7.1 version. That prevented the first runtime exception but the second one remained.
The only peculiar thing about those pages causing this error is they have ajax calls in them.
Funny enough, the application is working fine with AS 5.1.0 GA, so if my markup is erroneous, it would have given me a difficult time on 5.1.0 as well, which it didn't. So invalid markup is unlikely.
Any pointers much appreciated!
UPDATE: Just found out that line at PartialViewContextImpl.java:431 shows that the ctx.getRenderKit() is evaluating to null. No idea why though
UPDATE2: It turns out that the problem is seen only if I use pure html input components within the form i.e. <input type="text">, <select> etc. If I remove those from the <h:form> or I convert them into corresponding JSF tags, it works fine. Something is going terribly wrong somewhere. I'm not able to figure out excatly if this is caused by jboss, Mojarra or specifically my app. I tried it with a plain vanilla JSF app and it had no errors whether or not I use html input tags. So its the combination of my app and jboss 7.x that is causing this. Any ideas?
Finally! The issue was related to a bug in Mojarra 2.1.7 as reported here
The Solution is to give a name attribute to every pure html component included in <h:form>. The part that I could not understand that this bug seems to be related to Mojarra 2.1.7. And the jars I configured for my app were 2.0.4 version, yet the error was seen.

How to include a file in ivy.xml?

I have a fairly large ivy.xml containing a number of configurations which are the same for a number of projects.
I would like to break out this large repetitive section in to a common include file. Somehow I can't find any documentation describing that this can be done.
Anyone who has an idea whether this is doable?
EDIT: After some further thinking, I think this is not doable on purpose. An Ivy file is meant to be one cohesive unit and should contain no file based references, only references to other ivy modules...
You could create an ivy meta-module, which depends upon all of those common packages, and then have all your other projects resolve the common libraries through transitive dependency:
<?xml version="1.0"?>
<ivy-module version="2.0">
<info organisation="com.example" module="common-libs"/>
<configurations>
<conf name="runtime" transitive="true" visibility="public" />
<conf name="master" transitive="true" visibility="public" />
<conf name="compile" transitive="true" visibility="public" />
<conf name="default" transitive="true" visibility="public" extends="master" />
</configurations>
<dependencies>
<dependency org="oracle" name="ojdbc14_g" rev="10.2.0.3"
conf="compile->compile(*),master(*);runtime->runtime(*);master->master(*)"/>
<dependency org="tomcat" name="servlet-api" rev="6.0.16"
conf="compile->compile(*),master(*);runtime->runtime(*);master->master(*)"/>
<dependency org="junit" name="junit" rev="4.3"
conf="compile->compile(*),master(*);runtime->runtime(*);master->master(*)"/>
</dependencies>
</ivy-module>
And for a typical project:
<?xml version="1.0"?>
<ivy-module version="2.0">
<info organisation="com.example" module="myproject"/>
<configurations>
<conf name="runtime" transitive="true" visibility="public" />
<conf name="master" transitive="true" visibility="public" extends="runtime"/>
<conf name="compile" transitive="true" visibility="public" />
<conf name="default" transitive="true" visibility="public" extends="master" />
</configurations>
<dependencies>
<dependency org="com.example" name="common-libs" rev="latest.release"
conf="compile->compile(*),master(*);runtime->runtime(*);master->master(*)"/>
</dependencies>
</ivy-module>
Here I'm using the traditional configuration naming conventions from the POM->Ivy translations of the Maven resolver, though you could map the configuration names in any way that made sense to you. I tend to use the ivy:install task to copy Maven modules into our Ivy repository, so I use the default ivy.xmls for the most part. If you're using IvyRoundup, you'll primarily want to map the "default" configuration transitively.
If you are using ivy from ant and you are running Ant 1.6 or later, you could use the <import> task to include build file fragments within your ant build file. The referenced files have to be complete Ant build files, though:
<?xml version="1.0"?>
<project name="my-project" default="usage" basedir=".">
<target name="setup">
...
</target>
<import file="./common.xml"/>
...
</project>
You could also use standard XML syntax from within your ivy.xml or build.xml file:
<?xml version="1.0"?>
<!DOCTYPE project [
<!ENTITY common SYSTEM "common.xml">
]>
<project name="my-project" default="usage" basedir=".">
<target name="setup">
...
</target>
&common;
...
</project>
This will literally include the contents of common.xml where you've placed the &common; entity.
(The filename common.xml in this example is resolved relative to the containing XML file by the XML parser. You may also use an absolute file: protocol URI.)

Resources