JSF(Mojarra)1.2在部署时导致java.lang.OutOfMemoryError

时间:2014-03-19 18:57:59

标签: java maven jsf jboss5.x

将JavaEE 6遗留项目转换为Maven后,当我的应用程序上下文(并且只针对我的上下文)尝试初始化mojarra 时,我有一个java.lang.OutOfMemoryError 原始项目使用“手动”依赖关系管理,并使用Apache Ant进行构建。

我成功将项目转换为Maven。我使用了相同版本的依赖项,并且我成功地编译和构建了包。在应用程序部署期间, JBossAS 5.1冻结

INFO  [config] Initializing Mojarra (1.2_16-20110421-1728-SNAPSHOT) for context '/myApp'

8分钟后,我收到以下错误:

WARN  [ClassLoaderManager] Unexpected error during load of:javax.el.ELResolver
java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:45)
    at java.lang.StringBuffer.<init>(StringBuffer.java:91)
    at java.net.URLStreamHandler.toExternalForm(URLStreamHandler.java:473)
    at java.net.URL.toExternalForm(URL.java:901)
    at org.jboss.virtual.plugins.context.zip.ZipEntryHandler.getRealURL(ZipEntryHandler.java:259)
    at org.jboss.virtual.plugins.context.DelegatingHandler.getRealURL(DelegatingHandler.java:222)
    at org.jboss.virtual.VFSUtils.getRealURL(VFSUtils.java:1064)
    at org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy.getProtectionDomain(VFSClassLoaderPolicy.java:651)
    at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:547)
    at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:532)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:530)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:507)
    at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:134)
    at org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(FilteredDelegateLoader.java:131)
    at org.jboss.classloader.spi.base.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:452)
    at org.jboss.classloader.spi.base.ClassLoaderManager.nextTask(ClassLoaderManager.java:251)
    at org.jboss.classloader.spi.base.ClassLoaderManager.process(ClassLoaderManager.java:150)
    at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:265)
    at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1119)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:798)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:441)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:63)
    at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:572)
    at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:532)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:530)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:507)
15:34:06,498 ERROR [[/horas]] Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! GC overhead limit exceeded
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:214)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:200)
    at org.jboss.web.jsf.integration.config.JBossJSFConfigureListener.contextInitialized(JBossJSFConfigureListener.java:60)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4393)
    at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
    at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
    at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
    at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
    at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
    at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
    at com.sun.proxy.$Proxy38.start(Unknown Source)
    at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
    at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
    at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
    at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
    at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
    at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
    at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
    at org.jboss.system.ServiceController.start(ServiceController.java:460)
    at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
    at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
    at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
    at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
    at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
    at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
    at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
    at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
    at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
    at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
    at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
    at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
    at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
    at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
    at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
    at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
    at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
    at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
    at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
    at org.jboss.Main.boot(Main.java:221)
    at org.jboss.Main$1.run(Main.java:556)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:45)
    at java.lang.StringBuffer.<init>(StringBuffer.java:91)
    at java.net.URLStreamHandler.toExternalForm(URLStreamHandler.java:473)
    at java.net.URL.toExternalForm(URL.java:901)
    at org.jboss.virtual.plugins.context.zip.ZipEntryHandler.getRealURL(ZipEntryHandler.java:259)
    at org.jboss.virtual.plugins.context.DelegatingHandler.getRealURL(DelegatingHandler.java:222)
    at org.jboss.virtual.VFSUtils.getRealURL(VFSUtils.java:1064)
    at org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy.getProtectionDomain(VFSClassLoaderPolicy.java:651)
    at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:547)
    at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:532)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:530)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:507)
    at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:134)
    at org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(FilteredDelegateLoader.java:131)
    at org.jboss.classloader.spi.base.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:452)
    at org.jboss.classloader.spi.base.ClassLoaderManager.nextTask(ClassLoaderManager.java:251)
    at org.jboss.classloader.spi.base.ClassLoaderManager.process(ClassLoaderManager.java:150)
    at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:265)
    at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1119)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:798)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:441)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:63)
    at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:572)
    at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:532)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:530)
    at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:507)

这是我的 pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                         http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.cpny</groupId>
<artifactId>minhaApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Minha Aplicação</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>6.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.facelets</groupId>
        <artifactId>jsf-facelets</artifactId>
        <version>1.1.14</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.richfaces.framework</groupId>
        <artifactId>richfaces-impl</artifactId>
        <version>3.3.3.Final</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.richfaces.ui</groupId>
        <artifactId>richfaces-ui</artifactId>
        <version>3.3.3.Final</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.seam</groupId>
        <artifactId>jboss-seam</artifactId>
        <version>2.2.2.Final</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>3.3.1.GA</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>3.3.1.ga</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>3.1.0.GA</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-annotations</artifactId>
        <version>3.4.0.GA</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-commons-annotations</artifactId>
        <version>3.1.0.GA</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.envers</groupId>
        <artifactId>jboss-envers</artifactId>
        <version>1.2.2.GA-hibernate-3.3</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.1</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.0</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.14</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-core</artifactId>
        <version>5.0.1</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-compiler</artifactId>
        <version>5.0.1</version>
        <scope>compile</scope>
    </dependency>

</dependencies>

<build>
    <finalName>minhaApp</finalName>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <showDeprecation>true</showDeprecation>
                <optimize>true</optimize>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.4</version>
        </plugin>
    </plugins>
</build>

<repositories>
    <!-- Repositório JBoss / Hibernate / JPA / EHCache -->
    <repository>
        <id>repository.jboss.org-public</id>
        <name>JBoss repository</name>
        <url>https://repository.jboss.org/nexus/content/groups/public</url>
    </repository>

    <!-- Sourceforge -->
    <repository>
        <id>sourceforge</id>
        <url>http://oss.sonatype.org/content/groups/sourceforge/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>

    <!-- EHCache -->
    <repository>
        <id>terracotta-releases</id>
        <url>http://www.terracotta.org/download/reflector/releases</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>
</project>

1 个答案:

答案 0 :(得分:0)

问题解决了!

首先,我使用 JBoss Seam 。依赖项以pom.xml这种方式声明:

<dependency>
    <groupId>org.jboss.seam</groupId>
    <artifactId>jboss-seam</artifactId>
    <version>2.2.2.Final</version>
    <scope>compile</scope>
</dependency>

但是,JBoss Seam的依赖包括el-api.jar(版本1.0),当我使用Maven构建项目时,这个库进入WEB-INF/lib文件夹。但是,如果你查看<JBOSS_HOME>/common/lib,你会发现另一个el-api.jar。不知何故,将自己的库放在war文件中与JBoss AS附带的库存在问题。

所以,我们必须从war文件中取出el-api.jar。为此,我在pom.xml上添加了一项排除:

<dependency>
    <groupId>org.jboss.seam</groupId>
    <artifactId>jboss-seam</artifactId>
    <version>2.2.2.Final</version>
    <scope>compile</scope>
    <exclusions>
         <exclusion>
             <groupId>javax.el</groupId>
             <artifactId>el-api</artifactId>
         </exclusion>
    </exclusions>
</dependency>

部署工作绝对正常......直到我尝试打开索引!当我访问索引时,另一个错误!这一个:

ERROR [facelets.compiler] (http-localhost%2F127.0.0.1-8180-1) Missing Built-in Tag Libraries! Make sure they are included within the META-INF directory of Facelets' Jar
ERROR [facelets.viewhandler] (http-localhost%2F127.0.0.1-8180-1) Error Rendering View[/login.xhtml]
javax.el.ELException: Function 'rich:element' not found
    at org.jboss.el.lang.ExpressionBuilder.visit(ExpressionBuilder.java:187)
    at org.jboss.el.parser.SimpleNode.accept(SimpleNode.java:129)
    at org.jboss.el.lang.ExpressionBuilder.prepare(ExpressionBuilder.java:138)
    at org.jboss.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:152)
    at org.jboss.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:206)

该异常指出了facelets和缺少标记库中的问题。但是将facelets 从版本1.1.14升级到版本1.1.15 也解决了这个问题,并且应用程序到目前为止工作正常。

在pom.xml中声明的Facelets依赖:

<dependency>
    <groupId>com.sun.facelets</groupId>
    <artifactId>jsf-facelets</artifactId>
    <version>1.1.15</version>
    <scope>compile</scope>
</dependency>