Grails 2 app wont deploy on JBOSS: BeanCreationException - grails

After having upgraded one of my apps from Grails 1.3.7 to 2.1.0 and installed a couple of additional plugins the app will no longer deploy on JBOSS AS 5.1, which is used for production.
The error I am getting from the JBOSS server log is the following:
13:39:10,263 ERROR [[/]] Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Found class org.hibernate.cfg.Mappings, but interface was expected
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.doCreateBean(ReloadAwareAutowireCapableBeanFactory.java:126)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:707)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:449)
at org.codehaus.groovy.grails.commons.spring.DefaultRuntimeSpringConfiguration.getApplicationContext(DefaultRuntimeSpringConfiguration.java:153)
at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:170)
at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:127)
at org.codehaus.groovy.grails.web.context.GrailsConfigUtils.configureWebApplicationContext(GrailsConfigUtils.java:121)
at org.codehaus.groovy.grails.web.context.GrailsContextLoader.initWebApplicationContext(GrailsContextLoader.java:104)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4393)
In order to resolve another issue I had earlier on( LifecycleException/ReflectionException: Cannot find method addChild...) I have introduced a jboss-classloading.xml into my WEB-INF directory. At the current moment this has the following contents:
<classloading xmlns="urn:jboss:classloading:1.0" name="ROOT.war" domain="DefaultDomain" top-level-classloader="true" export-all="NON_EMPTY" import-all="true" parent-first="false"> </classloading>
I suspect that the current issue is also class-loading related, especially since I see that the class in question is being loaded from JBOSS lib folder, and not from the jars in the war's lib folder:
[Loaded org.hibernate.cfg.Mappings from jar:file:/usr/local/jboss-5.1.0.GA/common/lib/hibernate-core.jar!/]
Apparently the class org.hibernate.cfg.Mappings exists both in hibernate-core.jar as well as inside the app's lib folder(hibernate-core-3.6.10.Final.jar). I have therefore tried to tweak the jboss-classloading.xml file in different ways in order to force JBOSS to load this specific class from within the war file, but no matter what I do I keep getting the same error (or different ones much earlier in the deploy cycle).
The full contents of my war's WEB-INF/lib dir:
activation-1.1.jar google-collections.jar h2-1.3.164.jar sitemesh-2.4.jar
antlr-2.7.7.jar grails-bootstrap-2.1.0.jar hamcrest-all-1.1.jar smartsprites-0.2.1.jar
aopalliance-1.0.jar grails-core-2.1.0.jar hibernate-commons-annotations-3.2.0.Final.jar spring-aop-3.1.0.RELEASE.jar
asm-3.1.jar grails-crud-2.1.0.jar hibernate-core-3.6.10.Final.jar spring-asm-3.1.0.RELEASE.jar
aspectjrt-1.6.10.jar grails-datastore-core-1.0.9.RELEASE.jar hibernate-ehcache-3.6.10.Final.jar spring-aspects-3.1.0.RELEASE.jar
aspectjweaver-1.6.10.jar grails-datastore-gorm-1.0.9.RELEASE.jar hibernate-jpa-2.0-api-1.0.1.Final.jar spring-beans-3.1.0.RELEASE.jar
avalon-framework-4.1.3.jar grails-datastore-simple-1.0.9.RELEASE.jar hibernate-validator-4.1.0.Final.jar spring-binding-2.0.8.RELEASE.jar
axis-1.4.jar grails-hibernate-2.1.0.jar javase-1.7.jar spring-context-3.1.0.RELEASE.jar
axis-jaxrpc-1.4.jar grails-logging-2.1.0.jar javassist-3.12.0.GA.jar spring-context-support-3.1.0.RELEASE.jar
axis-saaj-1.4.jar grails-plugin-codecs-2.1.0.jar javassist-3.7.ga.jar spring-core-3.1.0.RELEASE.jar
axis-wsdl4j-1.5.1.jar grails-plugin-controllers-2.1.0.jar jcaptcha-all-1.0-RC6.jar spring-expression-3.1.0.RELEASE.jar
cas-client-core-3.2.1.jar grails-plugin-converters-2.1.0.jar jstl-1.1.2.jar spring-jdbc-3.1.0.RELEASE.jar
cglib-2.2.jar grails-plugin-datasource-2.1.0.jar jta-1.1.jar spring-jms-3.1.0.RELEASE.jar
commons-beanutils-1.8.3.jar grails-plugin-domain-class-2.1.0.jar jul-to-slf4j-1.6.2.jar spring-js-2.0.8.RELEASE.jar
commons-codec-1.5.jar grails-plugin-filters-2.1.0.jar logkit-1.0.1.jar spring-orm-3.1.0.RELEASE.jar
commons-collections-3.2.1.jar grails-plugin-gsp-2.1.0.jar mail-1.4.3.jar spring-test-3.1.0.RELEASE.jar
commons-dbcp-1.4.jar grails-plugin-i18n-2.1.0.jar mysql-connector-java-5.1.6.jar spring-tx-3.1.0.RELEASE.jar
commons-discovery-0.2.jar grails-plugin-log4j-2.1.0.jar ognl-2.7.3.jar spring-web-3.1.0.RELEASE.jar
commons-el-1.0.jar grails-plugin-mimetypes-2.1.0.jar oro-2.0.8.jar spring-webflow-2.0.8.RELEASE.jar
commons-fileupload-1.2.2.jar grails-plugin-scaffolding-2.1.0.jar pjl-comp-filter-1.7.jar spring-webmvc-3.1.0.RELEASE.jar
commons-io-2.1.jar grails-plugin-services-2.1.0.jar quartz-1.6.1.jar tomcat-catalina-ant-7.0.27.jar
commons-lang-2.6.jar grails-plugin-servlets-2.1.0.jar quartz-2.1.5.jar tomcat-embed-core-7.0.27.jar
commons-logging-1.1.jar grails-plugin-tomcat-2.1.0.jar selenium-java-client-driver-1.0.2.jar tomcat-embed-jasper-7.0.27.jar
commons-pool-1.5.6.jar grails-plugin-url-mappings-2.1.0.jar servlet-api-2.5.jar tomcat-embed-logging-juli-7.0.27.jar
commons-validator-1.3.1.jar grails-plugin-validation-2.1.0.jar shiro-cas-1.2.0.jar tomcat-embed-logging-log4j-7.0.27.jar
concurrentlinkedhashmap-lru-1.2_jdk5.jar grails-resources-2.1.0.jar shiro-core-1.2.0.jar utils-0.0.2.jar
core-1.7.jar grails-spring-2.1.0.jar shiro-ehcache-1.2.0.jar validation-api-1.0.0.GA.jar
dom4j-1.6.1.jar grails-web-2.1.0.jar shiro-quartz-1.2.0.jar xpp3_min-1.1.4c.jar
ecj-3.6.2.jar grails-webflow-2.1.0.jar shiro-spring-1.2.0.jar yuicompressor-2.4.2.jar
ehcache-core-2.4.6.jar groovy-all-1.8.6.jar shiro-web-1.2.0.jar
Does anyone have an idea about how to get around this issue?

There is a plugins for this :)
http://grails.org/plugin/jbossas
The docs are located here:
http://grails-plugins.github.com/grails-jbossas/
This is why this is happenning:
https://community.jboss.org/thread/156441
You will need to configure JBoss to exclude the hibernate jars. The JBoss Hibernate jars that are in common/lib in the JBoss install are loading first, instead of the Grails Hibernate jars. This is a classloader order / preference issue.
A very dirty solution is to remove the jars under common/lib or as recommended get the classloader working to exclude those jars.

I'm using JBoss 6.1 for a project. We started on 1.3.7, then moved to 2.0.3 and are now on 2.1.
I never got that exact issue, nor have I experienced any conflicts with Hibernate, but we did experience conflicts with Quartz.
Here's what I use to isolate things...
I have this in /WEB-INF/jboss-scanning.xml:
<?xml version='1.0' encoding='UTF-8' ?>
<scanning xmlns='urn:jboss:scanning:1.0'>
<path name='WEB-INF/lib/grails-datastore-gorm-*.jar'>
<include name='org.grails.datastore' />
</path>
</scanning>
I have this in /WEB-INF/jboss-classloading.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<classloading
xmlns="urn:jboss:classloading:1.0"
domain="hotdesk.war"
export-all="NON_EMPTY"
import-all="true"
/>
And finally, I have this in BuildConfig.groovy:
dependencies {
//Added to deal with problems running Quartz on JBoss
//NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V]
compile ('cglib:cglib-nodep:2.2')
}
//Added to deal with problems running Quartz on JBoss
//NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V]
grails.war.resources = { stagingDir, args ->
println "Removing export jars from WEB-INF/lib/"
delete(file: "${stagingDir}/WEB-INF/lib/cglib-2.2.jar")
}
Hope that gets you closer to resolving your issue.

Related

Grails 3 schemaExport contains warning with FileNotFoundException that looks for sitemesh.xml

When schemaExport is executed using Gradle for a Grails 3.3 application, below warning is in the log though ddl.sql is created. According to Grails 3 documentation sitemesh.xml is removed so naturally the file wouldn't be available. Am I missing something?
Tools and version: Grails 3.3.0, Gradle 3.3, Hibnerate 5, Sybase ASE 15.7
2017-09-13 12:50:45.264 WARN --- [ main] o.s.mock.web.MockServletContext : Couldn't determine real path of resource class path resource [src/main/webapp/WEB-INF/sitemesh.xml]
java.io.FileNotFoundException: class path resource [src/main/webapp/WEB-INF/sitemesh.xml] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:187)
at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:49)
at org.springframework.mock.web.MockServletContext.getRealPath(MockServletContext.java:458)
at org.grails.web.sitemesh.Grails5535Factory.<init>(Grails5535Factory.java:78)
at org.grails.web.servlet.view.SitemeshLayoutViewResolver.loadSitemeshConfig(SitemeshLayoutViewResolver.java:105)
at org.grails.web.servlet.view.SitemeshLayoutViewResolver.init(SitemeshLayoutViewResolver.java:67)
at org.grails.web.servlet.view.SitemeshLayoutViewResolver.onApplicationEvent(SitemeshLayoutViewResolver.java:146)
at org.grails.web.servlet.view.SitemeshLayoutViewResolver.onApplicationEvent(SitemeshLayoutViewResolver.java:42)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at grails.boot.GrailsApp.run(GrailsApp.groovy:83)
at grails.ui.command.GrailsApplicationContextCommandRunner.run(GrailsApplicationContextCommandRunner.groovy:55)
at grails.ui.command.GrailsApplicationContextCommandRunner.main(GrailsApplicationContextCommandRunner.groovy:102)
This is just a WARN message. The underlying spring class is looking for it and just saying it's not there. The default the log level does not show this output.
You can safely ignore the message or adjust your logger to not show it.
https://github.com/spring-projects/spring-framework/blob/master/spring-test/src/main/java/org/springframework/mock/web/MockServletContext.java#L460

Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean

I'm trying to deploy a simple webapp with an embedded instance of Jetty. My embedded test code is:
public static void main(String[] args) throws Exception{
Server server = new Server(8181);
WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath("/");
webAppContext.setWar(ContUtil.warPath + ContUtil.warName);
server.setHandler(webAppContext);
logger.info("starting jetty...");
server.start();
server.join();
}
but I got the following error:
Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/C:/Users/lingguo/AppData/Local/Temp/jetty-0.0.0.0-8181-MemCloud-Web-1.0-SNAPSHOT.war-_-any-6830790104248388668.dir/webapp/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:232)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
... 23 more
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/D:/Program%20Files%20(x86)/apache-maven-2.2.1/repo/org/apache/struts/struts2-core/2.2.1/struts2-core-2.2.1.jar!/struts-default.xml:29:72 - bean - jar:file:/C:/Users/lingguo/AppData/Local/Temp/jetty-0.0.0.0-8181-MemCloud-Web-1.0-SNAPSHOT.war-_-any-6830790104248388668.dir/webapp/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)
... 26 more
I've referenced many similar answers about this problems, for example: Struts2 Error when Deploying: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory; Most of the similar problems are caused by jar packages conflict of different versions. But my problem is a little different. I ensure that there is only one version of struts2-core (2.2.1) in my classpath.
I checked the error message, I think that jetty creates a tmp file, that is: /C:/Users/lingguo/AppData/Local/Temp/jetty-0.0.0.0-8181-MemCloud-Web-1.0-SNAPSHOT.war-_-any-6830790104248388668.dir,and the jar struts2-core-2.2.1 is confict with the jar in my local maven repository.
Could anybody know where is going wrong? Thanks in advance!

Websphere 8.5 - JSF webapp context init error: cleanupInitMaps

I have got a JSF 2.1 web application developed with mojarra 2.1.17 distibution which run with any problems on JBoss 6.1 container: now i have to change application server and I have to use websphere AS 8.5 which were born with MyFaces JSF 2 distibution. I'm trying to deploy and start my webapp ignoring MyFaces and using Mojarra, configuring my EAR as IBM official guide shows, configuring shared lib with mojarra dist included, link it to a new classloader created exclusively for my server1 instance of WAS 8.5. It doesn't work at all and when I deploy my webapp i get this stacktrace when WAS try to start the application:
com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: null
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:432)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1175)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:774)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2182)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:994)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: null
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:759)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
... 14 more
Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: null
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:176)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
... 16 more
Caused by: java.lang.NullPointerException
at com.sun.faces.config.InitFacesContext.cleanupInitMaps(InitFacesContext.java:283)
at com.sun.faces.config.InitFacesContext.<init>(InitFacesContext.java:107)
at com.sun.faces.config.FacesInitializer.onStartup(FacesInitializer.java:115)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:613)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
... 17 more
I debugged cleanupInitMaps() method of mojarra dist too and i saw that it tries to get two Map of kind of variable from FacesContext called threadInitContext and initContextServletContext but gets null:
Field threadMap = FacesContext.class.getDeclaredField("threadInitContext");
and
Field initContextMap = FacesContext.class.getDeclaredField("initContextServletContext");
How is this caused and how can I solve it?
Ok, i solved it !!
first of all i set classloader of my server instance to PARENT_LAST + restart. Then i followed these steps:
1) put Mojarra lib into simple shared library;
2) deploy ear with jsf web module inside and before start application from console, i linked shared lib to it and to all modules inside ear;
3) i set application classloader to PARENT_LAST;
4) start app and it works !!
That's all !!
I faced the very same issue. In my case problem was solved by removing javax.faces dependency from .war artifact. It seems to be a conflict between javax.faces implementation by WS and dependency in my .war file. If you using maven then you can set scope for youre javax.faces dependency somthing like this:
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.2.13</version>
<scope>provided</scope>
</dependency>
See also: Nullpointer exception at com.sun.faces.config.InitFacesContext.cleanupInitMaps

javax.servlet.ServletException: Filter [sitemesh]: could not be initialized when deploying grails 2.11 app to WebSphere 8.5 liberty profile?

When I try and deploy my grails application to a WebSphere 8.5 liberty profile server I get the following error message.
Error Message: javax.servlet.ServletException: Filter [sitemesh]: could not be initialized
I've set up a parent last class loading policy for my application. The same war file deploys with no problems to tomcat located on the same server. Any ideas of what could be causing this and how to work around it? I've pasted the full stacktrace below.
Error Page Exception
SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.
Original Exception:
Error Message: javax.servlet.ServletException: Filter [sitemesh]: could not be initialized
Error Code: 500
Target Servlet: com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor
Error Stack:
com.opensymphony.module.sitemesh.factory.FactoryException: Could not initialize DecoratorMapper : org.codehaus.groovy.grails.web.sitemesh.GrailsLayoutDecoratorMapper: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'groovyPageLayoutFinder' is defined
at com.opensymphony.module.sitemesh.factory.BaseFactory.pushDecoratorMapper(BaseFactory.java:117)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadDecoratorMappers(Grails5535Factory.java:231)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadConfig(Grails5535Factory.java:98)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.(Grails5535Factory.java:66)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.init(GrailsPageFilter.java:83)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:579)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:480)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:299)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:372)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:903)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1036)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4173)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:302)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.handleRequest(DynamicVirtualHost.java:296)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1006)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$1.run(DynamicVirtualHost.java:253)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:457)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
at java.lang.Thread.run(Thread.java:722)
Root cause:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'groovyPageLayoutFinder' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:277)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1102)
at org.codehaus.groovy.grails.web.sitemesh.GrailsLayoutDecoratorMapper.init(GrailsLayoutDecoratorMapper.java:48)
at com.opensymphony.module.sitemesh.factory.BaseFactory.pushDecoratorMapper(BaseFactory.java:110)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadDecoratorMappers(Grails5535Factory.java:231)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadConfig(Grails5535Factory.java:98)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.(Grails5535Factory.java:66)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.init(GrailsPageFilter.java:83)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:579)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:480)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:299)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:372)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:903)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1036)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4173)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:302)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.handleRequest(DynamicVirtualHost.java:296)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1006)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$1.run(DynamicVirtualHost.java:253)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:457)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
at java.lang.Thread.run(Thread.java:722)
Error Page Exception:
Error Message: javax.servlet.ServletException: Filter [sitemesh]: could not be initialized
Error Code: 0
Target Servlet:
Error Stack:
com.opensymphony.module.sitemesh.factory.FactoryException: Could not initialize DecoratorMapper : org.codehaus.groovy.grails.web.sitemesh.GrailsLayoutDecoratorMapper: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'groovyPageLayoutFinder' is defined
at com.opensymphony.module.sitemesh.factory.BaseFactory.pushDecoratorMapper(BaseFactory.java:117)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadDecoratorMappers(Grails5535Factory.java:231)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadConfig(Grails5535Factory.java:98)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.(Grails5535Factory.java:66)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.init(GrailsPageFilter.java:83)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:579)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:480)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:299)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:372)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:906)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1036)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1383)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:191)
at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3650)
at com.ibm.ws.webcontainer.webapp.WebApp.handleException(WebApp.java:4203)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4184)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:302)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.handleRequest(DynamicVirtualHost.java:296)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1006)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$1.run(DynamicVirtualHost.java:253)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:457)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
at java.lang.Thread.run(Thread.java:722)
Root cause:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'groovyPageLayoutFinder' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:277)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1102)
at org.codehaus.groovy.grails.web.sitemesh.GrailsLayoutDecoratorMapper.init(GrailsLayoutDecoratorMapper.java:48)
at com.opensymphony.module.sitemesh.factory.BaseFactory.pushDecoratorMapper(BaseFactory.java:110)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadDecoratorMappers(Grails5535Factory.java:231)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadConfig(Grails5535Factory.java:98)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.(Grails5535Factory.java:66)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.init(GrailsPageFilter.java:83)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:579)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:480)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:299)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:372)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:906)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1036)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1383)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:191)
at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3650)
at com.ibm.ws.webcontainer.webapp.WebApp.handleException(WebApp.java:4203)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4184)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:302)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.handleRequest(DynamicVirtualHost.java:296)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1006)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$1.run(DynamicVirtualHost.java:253)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:457)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
at java.lang.Thread.run(Thread.java:722)
WebSphere 8.5 Liberty Profile does not expand WARs upon deployment, and surprisingly quite a few web applications heavily depend on the feature. That's what has led to your case.
I'm pretty sure you deployed the Grails web application as a WAR.
The solution is quite simple - deploy the web application expanded and the issue goes away.
To prove my thought I ran the sample from 2.3 Creating an Application. When I deployed it, the error message you faced was indeed displayed in the browser and the logs.
jacek:~/sandbox/helloworld
$ cp target/helloworld-0.1.war ~/apps/wlp/usr/servers/libertyGrails/dropins/
What you overlooked though was the line in the logs when it asked whether the web archive is expanded.
Caused by: java.io.FileNotFoundException: ServletContext resource
[/WEB-INF/grails-app/i18n/messages.properties] cannot be resolved to
absolute file path - web application archive not expanded? ... 20
more
I redeployed the web application (a mere rm with unzip -d afterwards), and the welcome page displayed properly.
jacek:~/sandbox/helloworld
$ rm ~/apps/wlp/usr/servers/libertyGrails/dropins/helloworld-0.1.war
jacek:~/sandbox/helloworld
$ unzip -d ~/apps/wlp/usr/servers/libertyGrails/dropins/helloworld-0.1.war target/helloworld-0.1.war
jacek:~/sandbox/helloworld
$ open http://localhost:9080/helloworld-0.1

Exception on JNDI lookup of a resource adapter in jboss 7.1

I deployed a resource adapter (XADisk) in jboss 7.1.0.final and now get an exception on JNDI lookup.
I configured the ra.xml and deployed XADisk.rar.
Then I added the following to my standalone.xml:
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
<resource-adapters>
<resource-adapter>
<archive>
XADisk.rar
</archive>
<transaction-support>XATransaction</transaction-support>
<connection-definitions>
<connection-definition
class-name="org.xadisk.connector.outbound.XADiskConnectionFactory"
jndi-name="java:/XADiskCF"
pool-name="XADiskConnectionFactory">
<xa-pool>
<min-pool-size>2</min-pool-size>
<max-pool-size>10</max-pool-size>
</xa-pool>
<security>
<application/>
</security>
</connection-definition>
</connection-definitions>
</resource-adapter>
</resource-adapters>
</subsystem>
Now I tried to use it from a simple servlet:
XADiskConnectionFactory cf1 =
(XADiskConnectionFactory) new InitialContext().lookup("java:/XADiskCF");
if I invoke the servlet the following is raised:
javax.naming.NameNotFoundException: XADiskCF -- service jboss.naming.context.java.XADiskCF at
org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97) at
org.jboss.as.naming.NamingContext.lookup(NamingContext.java:177) at
org.jboss.as.naming.InitialContext.lookup(InitialContext.java:113) at
org.jboss.as.naming.NamingContext.lookup(NamingContext.java:213) at
...
I hope someone with a better understanding of jndi and jboss can help me out.
the described problem occured due an incompatibility between xadisk and jboss 7

Resources