Grails - 试图在glassfish 3.0.1中部署一个nojars应用程序 [英] Grails - trying to deploy a nojars application into glassfish 3.0.1

查看:120
本文介绍了Grails - 试图在glassfish 3.0.1中部署一个nojars应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于内存限制,我正在尝试构建一个具有较小内存占用的Grails应用程序。我用这个论点--nojars来构建战争。我创建了一个没有所有jar的war文件,当我在glassfish中部署时遇到了这个错误。

Because of memory constraint i am trying to build a grails app with smaller memory footprint. I build the war with this argument "--nojars". I created a war file without all the jar and when i deploy within the glassfish i encounter this error

加载应用程序时的异常:java.lang.Exception:java.lang .IllegalStateException:ContainerBase.addChild:start:org.apache.catalina.LifecycleException:java.lang.IllegalArgumentException:java.lang.ClassNotFoundException:org.codehaus.groovy.grails.web.util.Log4jConfigListener

Exception while loading the app : java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: org.codehaus.groovy.grails.web.util.Log4jConfigListener

看起来应用程序无法找到jar文件的位置。

It seems like the application fail to find where is the jar file.

我曾经在使用glassfish部署应用程序之前指出了库的路径。

I had already indicates the path to the library before deploying the application in glassfish.

我错过了吗somethinng?

did i miss out somethinng?

推荐答案

通常推荐使用GlassFish的 Common Classloader 。这意味着将共享的JARS放入 $ domain-dir / lib 文件夹(但不是 )到该子文件夹中。

It is commonly recommended to use GlassFish's Common Classloader. That means putting the shared JARS into the $domain-dir/lib folder (but not into a subfolder of that).

您可能试图使用 Application Classloader asadmin deploy --libraries 命令。这更复杂且容易出错。如果您不需要不同版本的相同JAR与不同的Web应用程序,那么您应该按照上面的指定去使用 Common Classloader

You're probably trying to use the Application Classloader with the asadmin deploy --libraries command. This is more complicated and error-prone. If you don't need different versions of the same JARs with different web applications, you should definitely go for the Common Classloader as specified above.

另请参阅 Classloader Hierarchy 以供参考。

编辑根据提问者的评论更新:

EDIT Updated as per the questioner's comment:

domain / domain1 / lib 文件夹绝对有效(我测试过)。为了验证这一点,将 log4j.jar 放入该文件夹,并将 test.jsp 添加到

The domain/domain1/lib folder definitely works (I've tested that). To validate that, put log4j.jar into that folder and add a test.jsp to domain1/applications/$applicationName, that just contains:

<% out.println(
    org.apache.log4j.Logger.getLogger(this.getClass())); %>






如果这可行,但其他代码不行,可能还有另外一点需要考虑:您使用的是Log4J的 Logger.getLogger(..)或Apache Commons的 LogFactory.getInstance(..) / code>在你的代码中?


If that works but your other code does not, there may be another point to consider: Are you using Log4J's Logger.getLogger(..) or Apache Commons' LogFactory.getInstance(..) in your code?

请参阅文章使用Jakarta Commons Logging时遇到的类加载器问题的分类法以了解相关问题。 - 我还想建议您发布完整的堆栈跟踪。

See the article Taxonomy of class loader problems encountered when using Jakarta Commons Logging for related issues. - I'd also like to advise you to post your complete stacktrace.

这篇关于Grails - 试图在glassfish 3.0.1中部署一个nojars应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆