具有unpackWARs =“false”的Tomcat无法部署基于CDI Weld的应用程序

时间:2013-07-02 08:20:21

标签: java-ee tomcat war jboss-weld

我是一名java开发人员,我正在研究基于Java的Web应用程序项目。 我们正在使用tomcat 7.0.40应用程序服务器。 由于我将应用程序迁移到jsr299提供的jboss-weld 1.1.10.Final支持,因此我在tomcat上部署应用程序时遇到了麻烦。

出于安全原因,我不会在生产服务器上爆炸部署的WAR。 在预生产测试中,我注意到因为server.xml中的unpackWARs=false而导致异常。

如果我在本地服务器上将此属性更改为unpackWARs=false,则会出现相同的异常。否则(在本地和预生产服务器中均使用unpackWARs=true),应用程序可以正常工作。

以下是异常:

com.sun.faces.lifecycle.ProcessValidationsPhase execute
WARNING: /usersearch.xhtml @40,123 value="#{userSearch.valuebean.userID}": Target Unreachable, identifier 'userSearch' resolved to null
javax.el.PropertyNotFoundException: /userSearch.xhtml @40,123 value="#{userSearch.valuebean.userID}": Target Unreachable, identifier 'userSearch' resolved to null
at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1030)
at javax.faces.component.UIInput.validate(UIInput.java:960)
at javax.faces.component.UIInput.executeValidate(UIInput.java:1233)
at javax.faces.component.UIInput.processValidators(UIInput.java:698)
at javax.faces.component.UIForm.processValidators(UIForm.java:253)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1172)
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.execute(CodiLifecycleWrapper.java:95)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)

框架,我正在使用:

  • Tomcat 7.0.40(无Java-EE堆栈)
  • JBoss-Weld:org.jboss.weld.servlet 1.1.10.Final
  • Apache Myfaces CODI扩展:org.apache.myfaces.extensions.cdi.core和jsf-module,v1.0.3
  • JSF impl。 Mojarra v2.1.7
  • JSF Richfaces组件库,v4.3.0.Final

Target Unreachable, identifier resolved to null - 如果JSF Unified-EL中存在一些错误拼写以访问bean属性,或者beans.xml放错了位置,则会经常发生异常。但是它们不适用于我,因为应用程序适用于unpackWARs=true

非常感谢您对此事的关注。 亲切的问候,abertschi

server.xml(tomcat,我没有更改任何其他属性):

<?xml version="1.0" encoding="UTF-8"?
 <Server port="8005" shutdown="SHUTDOWN">
  <Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
  <Listener className="org.apache.catalina.core.JasperListener"/>
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
  <GlobalNamingResources>
    <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
    <Engine defaultHost="localhost" name="Catalina">
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
      </Realm>
      <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="false">
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log." suffix=".txt"/>
      </Host>
    </Engine>
  </Service>
</Server>

1 个答案:

答案 0 :(得分:0)

ichchumenöddusus。 z vill Infos。 Rüefmichmal,wänns问题nöchstmalvorchunnt。 好的,jetzt chumi drus。施拉格... 简而言之:当部署打包为war(unpackWar = FALSE)时,应用程序无法访问某些bean。 我会在下次发生时查看您的设置。