当我点击应用程序URL(http://localhost:9082/pages/upload.jsf
)时,我在浏览器上只显示“错误:500 StackOverflowError”。
从我在这个问题上的基础工作,我可以看出这可能是由于一些递归问题。
部署我的应用程序的服务器是WAS 8
有人请帮我解决这个问题。我知道这很模糊,如果我需要分享任何内容,请告诉我。 (例如,控制台上的错误消息和内容)
at javax.faces.context.FacesContext.getAttributes(FacesContext.java:64)
at javax.faces.context.FacesContext.getAttributes(FacesContext.java:64)
[the same line repeated many times]
at javax.faces.context.FacesContext.getAttributes(FacesContext.java:64)
at javax.faces.context.FacesContext.getAttributes(FacesContext.java:64)
at org.apache.myfaces.application.ResourceHandlerImpl.isResourceRequest(ResourceHandlerImpl.java:416)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:180)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1188)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:763)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:454)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:125)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)
at com.lmig.putt.customComponents.UploadFilter.doFilter(UploadFilter.java:61)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:919)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1016)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3703)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1659)
`这是我点击URL后在控制台上找到的错误消息。请帮助我,因为我发现它是全新的,难以破解
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>PUTT</display-name>
<context-param>
<param-name>log4ConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/application-context.xml</param-value>
</context-param>
<!-- Log4jConfigListener also tries to
set the webAppRootKey. solve this by adding the following statements in web.xml -->
<context-param>
<param-name>log4jExposeWebAppRoot</param-name>
<param-value>false</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<jsp-config>
<taglib>
<taglib-uri>http://www.lmig.com/PUTT/upload</taglib-uri>
<taglib-location>/WEB-INF/upload.tld</taglib-location>
</taglib>
</jsp-config>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<filter>
<filter-name>Upload Filter</filter-name>
<filter-class>com.lmig.putt.customComponents.UploadFilter</filter-class>
<init-param>
<param-name>com.lmig.putt.customComponents.UploadFilter.sizeThreshold</param-name>
<param-value>1024</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Upload Filter</filter-name>
<url-pattern>/pages/upload.jsf</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Upload Filter</filter-name>
<url-pattern>/pages/upload.jsp</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>
javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<resource-ref>
<description>DataSource</description>
<res-ref-name>jdbc/db2DS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
</web-app>
faces-config.xml中
<?xml version="1.0" encoding="UTF-8"?>
<!-- <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude"
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_1_2.xsd"> -->
<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_0.xsd"
version="2.0">
.
.
.
.
</faces-config>
答案 0 :(得分:5)
基于MyFaces 2.0.5源代码,堆栈跟踪中的行号匹配,FacesContext#getAttributes()
如下所示:
55 public Map<Object, Object> getAttributes()
56 {
57 FacesContext ctx = _firstInstance.get();
58
59 if (ctx == null)
60 {
61 throw new UnsupportedOperationException();
62 }
63
64 return ctx.getAttributes();
65 }
换句话说,_firstInstance.get()
在您的特定情况下错误地返回当前实例。这表明在其他地方的代码中的某些时候,JSF内部代码中发生了以下操作:
FacesContext.setCurrentInstance(FacesContext.getCurrentInstance());
这是不对的。 FacesContext
的当前实例不应该指自己。它只会导致每次访问自身的无限循环,如堆栈跟踪所示。
此外,您显然已经在您的web.xml
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
建议您使用MyFaces&#39;竞争对手Mojarra在webapp的运行时类路径中。换句话说,您正在混合两个完全不同的JSF实现!这绝对不对。这就像在一辆汽车发动机中混合汽油和柴油一样。 IBM WebSphere捆绑了MyFaces。您应该删除任何与Mojarra相关的JAR文件(jsf-api.jar
,jsf-impl.jar
和/或javax.faces.jar
),配置条目(com.sun.faces.*
)和其他工件来自您的webapp。他们与MyFaces发生冲突。
答案 1 :(得分:0)
此错误可能是由于类加载问题造成的。最可能的是,您在WAS 7.0或更高版本中部署了应用程序。 要解决这个问题, 转到WAS控制台并打开 应用程序==&gt;企业应用程序==&gt;经理模块==&gt;您的战争模块
选择“首先加载本地类加载器的类(父类最后一个)”。对于类加载器订单
点击“应用”和“保存”