java.lang.StackOverflowError在Weblogic 12c上运行JSF 2示例 [英] java.lang.StackOverflowError Running JSF 2 example on Weblogic 12c

查看:207
本文介绍了java.lang.StackOverflowError在Weblogic 12c上运行JSF 2示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了示例并且似乎无法通过以下错误:

I followed the very basic tutorial found here example and cannot seem to get past the following error:

Error 500--Internal Server Error 
java.lang.StackOverflowError
    at weblogic.servlet.internal.ServletResponseImpl.addHeader(ServletResponseImpl.java:567)
    at javax.servlet.http.HttpServletResponseWrapper.addHeader(HttpServletResponseWrapper.java:200)
    at javax.servlet.http.HttpServletResponseWrapper.addHeader(HttpServletResponseWrapper.java:200)
    at javax.servlet.http.HttpServletResponseWrapper.addHeader(HttpServletResponseWrapper.java:200)
    at javax.servlet.http.HttpServletResponseWrapper.addHeader(HttpServletResponseWrapper.java:200)

几次按shift + F5组合键可以生成稍微不同的堆栈跟踪,如下所示:

Error 500--Internal Server Error 
java.lang.StackOverflowError
    at com.sun.faces.application.ViewHandlerResponseWrapper.setStatus(ViewHandlerResponseWrapper.java:88)
    at javax.servlet.http.HttpServletResponseWrapper.setStatus(HttpServletResponseWrapper.java:224)
    at com.sun.faces.application.ViewHandlerResponseWrapper.setStatus(ViewHandlerResponseWrapper.java:88)
    at javax.servlet.http.HttpServletResponseWrapper.setStatus(HttpServletResponseWrapper.java:224)

这是我的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">

<display-name>JavaServerFaces</display-name>

<!-- JSF mapping -->
<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<!-- Map these files with JSF -->
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>

</web-app>

这是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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>JavaServerFaces</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>JavaServerFaces Maven Webapp</name>
<url>http://maven.apache.org</url>

<dependencies>
            <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.1.7</version>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.1.7</version>
    </dependency>
            <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>
            <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
    </dependency>
  </dependencies>

<build>
    <finalName>JavaServerFaces</finalName>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>
</project>

我已经花了几个小时在网络上搜索并构建新项目,但是没有运气.我知道StackOverflowError是由错误的递归调用和无限循环产生的,但是在这里我看不到这种情况.

I have exhausted several hours searching the web and constructing new projects with no luck. I understand that the StackOverflowError is produced from bad recursion calls and infinite loops, however I can't see this as the case here.

我当前的开发堆栈是使用JSF 2.1的eclipse juno,m2e-wtp,weblogic 12c,Java EE 6

My current dev stack is eclipse juno, m2e-wtp, weblogic 12c, Java EE 6 using JSF 2.1

我希望这很简单,例如pom.xml中缺少依赖项或weblogic插件.任何帮助我都将不胜感激.

I am hoping it is something simple like a missing dependency or weblogic plugin in my pom.xml. Any help would me MUCH appreciated.

更新1:如果我使用eclipse导出war文件(右键单击项目-> Export-> WAR文件),然后通过weblogic管理员建议手动部署该应用程序,则该应用程序将按预期工作.更具体地说,eclipse的版本是oracle的版本(oepe-12.1.1.2.1-juno-distro-win32-x86_64.zip).

UPDATE 1: If I export the war file using eclipse (Right click the project -> Export -> WAR file) then manually deploy it via the weblogic admin counsel the app works as expected. More specifically the version of eclipse is the one from oracle (oepe-12.1.1.2.1-juno-distro-win32-x86_64.zip).

推荐答案

(在问题编辑中回答.转换为社区Wiki答案.请参见

(Answered in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )

OP写道:

解决了问题!在pom.xml中添加JSF 2.1之后,在项目构面中选中了JSF 2.1复选框,但是未将faces-config.xml添加到项目中.我简单地在webapp-> WEB-INF文件夹下创建了一个名为faces-config.xml的新xml文件,并添加了以下xml:

Solved the problem! After adding JSF 2.1 in the pom.xml the JSF 2.1 checkbox was checked in project facets, however it did not add the faces-config.xml to the project. I simple created a new xml file named faces-config.xml under the webapp --> WEB-INF folder and added the following xml:

<?xml version='1.0' encoding='UTF-8'?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd" version="2.1">

<application></application>

</faces-config>

我希望这对其他人有帮助!

I Hope this helps others!

这篇关于java.lang.StackOverflowError在Weblogic 12c上运行JSF 2示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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