# cannot find FacesContext in Eclipse-JSF1.2 mit JBoss



## ifconfig (15. Okt 2011)

Hallo,

könnt ihr mir bitte bei folgendem Problem helfen, ich google seit Tagen, aber alle Tipps zu diesem Problem, die bereits im Internet bestehen, die helfen bei mir nicht, oder ich hab irgendwas übersehen. Ich versuche gerade mich in jsf mit JBoss einzuarbeiten, aber es scheitert schon beim Aufsetzen eines einfachen jsf-Projektes in Eclipse mit Wizard.
Ich will mit Eclipse 3.6 mir ein JSF1.2-Projekt mit JBoss aufsetzen, aber beim Versuch, dieses zu deployen, also Rechtsklick auf das JSP-File und run as...run on Server...JBoss 4.2...kommt immer eine Fehlermeldung cannot find FacesContext. Was mache ich falsch? 
Ich habe mir einen JBoss 4.2.3 von jboss.org gedownloaded und entpackt.
Ich durchlaufe eigentlich brav diesen create Project-Wizard von Eclipse:
new Dynamic web project...Project name "e", Target runtime JBoss 4.2, dyn web module version 2.5, configuration jsf v1.2 Project, dann next klicken, dann beim source folders wiedernext klicken, bei web module Fenster auch wieder next klicken, dann im jsf capabilities Fenster wähle ich die jsf Apache MyFaces jsf core 1.2 api 1.2.9, das Häkchen bei "include libraries with this application" ist gesetzt, und übernehme auch wieder die Vorgabe-Einstellungen für das Faces Servlet, also mit dem url mapping pattern "/faces/*", dann finish klicken. dann gehe ich im web project auf den WebContent-ORdner, rechtsklick new jsp-File...name"a", wähle das oberste "new jsf page(html) Template, und klicke auf finish. in diesem erzeugten "a.jsp" klicke ich im Sourcecode nun rechts...run as...run on server...wähle JBoss v4.2 at localhost...klicke next und finish. 

Die Konsole meldet:


```
Buildfile: /home/user1/eclipse/plugins/org.eclipse.jst.server.generic.jboss_1.6.1.v200904151730/buildfiles/jboss323.xml
deploy.j2ee.web:
      [jar] Building jar: /home/user1/workspace-4/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/e.war
     [move] Moving 1 file to /home/user1/jboss-4.2.3.GA/server/default/deploy
```

Eclipse startet automatisch den Browser mit der url http://localhost:8080/e/faces/a.jsp

im Browser erscheint diese Meldung:

```
An exception occurred processing JSP page /a.jsp at line 11 8: <title>Insert title here</title> 9: </head> 10: <body> 11: <f:view> 12: 13: </f:view> 14: </body> Stacktrace:

Caused by:
java.lang.RuntimeException - Cannot find FacesContext
```

Die Server-Konsolenausgabe liefert dieses hier:


```
07:55:22,415 INFO  [Server] Starting JBoss (MX MicroKernel)...
07:55:22,416 INFO  [Server] Release ID: JBoss [Trinity] 4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)
07:55:22,418 INFO  [Server] Home Dir: /home/user1/jboss-4.2.3.GA
07:55:22,418 INFO  [Server] Home URL: file:/home/user1/jboss-4.2.3.GA/
07:55:22,419 INFO  [Server] Patch URL: null
07:55:22,419 INFO  [Server] Server Name: default
07:55:22,419 INFO  [Server] Server Home Dir: /home/user1/jboss-4.2.3.GA/server/default
07:55:22,419 INFO  [Server] Server Home URL: file:/home/user1/jboss-4.2.3.GA/server/default/
07:55:22,419 INFO  [Server] Server Log Dir: /home/user1/jboss-4.2.3.GA/server/default/log
07:55:22,419 INFO  [Server] Server Temp Dir: /home/user1/jboss-4.2.3.GA/server/default/tmp
07:55:22,420 INFO  [Server] Root Deployment Filename: jboss-service.xml
07:55:22,792 INFO  [ServerInfo] Java version: 1.6.0_25,Sun Microsystems Inc.
07:55:22,792 INFO  [ServerInfo] Java VM: Java HotSpot(TM) 64-Bit Server VM 20.0-b11,Sun Microsystems Inc.
07:55:22,792 INFO  [ServerInfo] OS-System: Linux 2.6.35-22-generic,amd64
07:55:23,175 INFO  [Server] Core system initialized
07:55:25,025 INFO  [WebService] Using RMI server codebase: http://127.0.0.1:8083/
07:55:25,028 INFO  [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
07:55:25,560 INFO  [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
07:55:25,560 INFO  [TransactionManagerService] Setting up property manager MBean and JMX layer
07:55:25,791 INFO  [TransactionManagerService] Starting recovery manager
07:55:25,853 INFO  [TransactionManagerService] Recovery manager started
07:55:25,853 INFO  [TransactionManagerService] Binding TransactionManager JNDI Reference
07:55:28,235 INFO  [EJB3Deployer] Starting java:comp multiplexer
07:55:30,078 INFO  [NativeServerConfig] JBoss Web Services - Native
07:55:30,078 INFO  [NativeServerConfig] jbossws-3.0.1-native-2.0.4.GA (build=200803312044)
07:55:31,079 INFO  [Embedded] Catalina naming disabled
07:55:31,185 INFO  [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/jre/lib/amd64/server:/usr/java/jre/lib/amd64:/usr/java/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
07:55:31,234 INFO  [Http11Protocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
07:55:31,235 INFO  [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
07:55:31,235 INFO  [Catalina] Initialization processed in 156 ms
07:55:31,235 INFO  [StandardService] Starting service jboss.web
07:55:31,237 INFO  [StandardEngine] Starting Servlet Engine: JBossWeb/2.0.1.GA
07:55:31,269 INFO  [Catalina] Server startup in 34 ms
07:55:31,377 INFO  [TomcatDeployer] deploy, ctxPath=/, warUrl=.../deploy/jboss-web.deployer/ROOT.war/
07:55:32,016 INFO  [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=.../deploy/http-invoker.sar/invoker.war/
07:55:32,148 INFO  [TomcatDeployer] deploy, ctxPath=/jbossws, warUrl=.../deploy/jbossws.sar/jbossws-context.war/
07:55:32,246 INFO  [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
07:55:33,194 INFO  [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../deploy/management/console-mgr.sar/web-console.war/
07:55:33,746 INFO  [MailService] Mail Service bound to java:/Mail
07:55:33,879 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-local-jdbc.rar
07:55:33,935 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-xa-jdbc.rar
07:55:33,955 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-local-jdbc.rar
07:55:33,973 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-xa-jdbc.rar
07:55:34,026 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jms/jms-ra.rar
07:55:34,109 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/mail-ra.rar
07:55:34,165 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/quartz-ra.rar
07:55:34,185 INFO  [QuartzResourceAdapter] start quartz!!!
07:55:34,253 INFO  [SimpleThreadPool] Job execution threads will use class loader of thread: main
07:55:34,271 INFO  [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
07:55:34,273 INFO  [RAMJobStore] RAMJobStore initialized.
07:55:34,274 INFO  [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
07:55:34,274 INFO  [StdSchedulerFactory] Quartz scheduler version: 1.5.2
07:55:34,274 INFO  [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
07:55:35,495 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
07:55:35,708 INFO  [A] Bound to JNDI name: queue/A
07:55:35,710 INFO  [B] Bound to JNDI name: queue/B
07:55:35,712 INFO  [code] Bound to JNDI name: queue/C
07:55:35,713 INFO  [D] Bound to JNDI name: queue/D
07:55:35,715 INFO  [ex] Bound to JNDI name: queue/ex
07:55:35,730 INFO  [testTopic] Bound to JNDI name: topic/testTopic
07:55:35,732 INFO  [securedTopic] Bound to JNDI name: topic/securedTopic
07:55:35,733 INFO  [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
07:55:35,737 INFO  [testQueue] Bound to JNDI name: queue/testQueue
07:55:35,773 INFO  [UILServerILService] JBossMQ UIL service available at : /127.0.0.1:8093
07:55:35,811 INFO  [DLQ] Bound to JNDI name: queue/DLQ
07:55:35,910 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
07:55:36,009 INFO  [TomcatDeployer] deploy, ctxPath=/e, warUrl=.../tmp/deploy/tmp5039336544132651806e-exp.war/
07:55:36,251 INFO  [StartupServletContextListener] Checking for plugins:org.apache.myfaces.FACES_INIT_PLUGINS
07:55:36,310 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON' found, using default value false
07:55:36,316 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS' found, using default value false
07:55:36,317 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.SAVE_FORM_SUBMIT_LINK_IE' found, using default value false
07:55:36,317 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS' found, using default value true
07:55:36,317 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.RENDER_VIEWSTATE_ID' found, using default value true
07:55:36,317 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.STRICT_XHTML_LINKS' found, using default value true
07:55:36,317 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.CONFIG_REFRESH_PERIOD' found, using default value 2
07:55:36,317 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.VIEWSTATE_JAVASCRIPT' found, using default value false
07:55:36,317 INFO  [MyfacesConfig] Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
07:55:36,317 INFO  [MyfacesConfig] Starting up Tomahawk on the RI-JSF-Implementation.
07:55:36,317 INFO  [MyfacesConfig] Starting up Tomahawk on the MyFaces-JSF-Implementation
07:55:36,317 ERROR [MyfacesConfig] Both MyFaces and the RI are on your classpath. Please make sure to use only one of the two JSF-implementations.
07:55:36,449 INFO  [FacesConfigurator] Reading standard config META-INF/standard-faces-config.xml
07:55:36,566 INFO  [FacesConfigurator] Reading config /WEB-INF/faces-config.xml
07:55:36,625 INFO  [FacesConfigurator] Starting up MyFaces-package : myfaces-api in version : 1.2.9 from path : file:/home/user1/jboss-4.2.3.GA/server/default/tmp/deploy/tmp5039336544132651806e-exp.war/WEB-INF/lib/myfaces-api-1.2.9.jar
07:55:36,629 INFO  [FacesConfigurator] Starting up MyFaces-package : myfaces-impl in version : 1.2.9 from path : file:/home/user1/jboss-4.2.3.GA/server/default/tmp/deploy/tmp5039336544132651806e-exp.war/WEB-INF/lib/myfaces-impl-1.2.9.jar
07:55:36,630 INFO  [FacesConfigurator] MyFaces-package : tomahawk not found.
07:55:36,630 INFO  [FacesConfigurator] MyFaces-package : tomahawk12 not found.
07:55:36,630 INFO  [FacesConfigurator] MyFaces-package : tomahawk-sandbox not found.
07:55:36,630 INFO  [FacesConfigurator] MyFaces-package : tomahawk-sandbox12 not found.
07:55:36,630 INFO  [FacesConfigurator] MyFaces-package : tomahawk-sandbox15 not found.
07:55:36,630 INFO  [FacesConfigurator] MyFaces-package : myfaces-orchestra-core not found.
07:55:36,630 INFO  [FacesConfigurator] MyFaces-package : myfaces-orchestra-core12 not found.
07:55:36,630 INFO  [FacesConfigurator] MyFaces-package : trinidad-api not found.
07:55:36,630 INFO  [FacesConfigurator] MyFaces-package : trinidad-impl not found.
07:55:36,630 INFO  [FacesConfigurator] MyFaces-package : tobago not found.
07:55:36,630 INFO  [FacesConfigurator] MyFaces-package : commons-el not found.
07:55:36,630 INFO  [FacesConfigurator] MyFaces-package : jsp-api not found.
07:55:36,643 WARN  [LocaleUtils] Locale name in faces-config.xml null or empty, setting locale to default locale : de_DE
07:55:36,714 INFO  [FacesConfigurator] Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
07:55:37,342 INFO  [AbstractFacesInitializer] ServletContext '/home/user1/jboss-4.2.3.GA/server/default/./tmp/deploy/tmp5039336544132651806e-exp.war/' initialized.
07:55:37,342 INFO  [StartupServletContextListener] Checking for plugins:org.apache.myfaces.FACES_INIT_PLUGINS
07:55:37,345 WARN  [JBossJSFConfigureListener] MyFaces JSF implementation found!  This version of JBoss AS ships with the java.net implementation of JSF.  There are known issues when mixing JSF implementations.  This warning does not apply to MyFaces component libraries such as Tomahawk.  However, myfaces-impl.jar and myfaces-api.jar should not be used without disabling the built-in JSF implementation.  See the JBoss wiki for more details.
07:55:38,029 INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
07:55:38,345 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
07:55:38,398 INFO  [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
07:55:38,407 INFO  [Server] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)] Started in 15s:986ms
07:55:43,486 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
java.lang.RuntimeException: Cannot find FacesContext
	at javax.faces.webapp.UIComponentClassicTagBase.getFacesContext(UIComponentClassicTagBase.java:1855)
	at javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:1672)
	at org.apache.jsp.a_jsp._jspx_meth_f_005fview_005f0(a_jsp.java:93)
	at org.apache.jsp.a_jsp._jspService(a_jsp.java:67)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
	at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:341)
	at org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:486)
	at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:337)
	at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
	at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:187)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
	at java.lang.Thread.run(Thread.java:662)
07:55:43,535 ERROR [_ErrorPageWriter] An exception occurred
javax.faces.FacesException: An exception occurred processing JSP page /a.jsp at line 11

8: <title>Insert title here</title>
9: </head>
10: <body>
11: <f:view>
12: 
13: </f:view>
14: </body>


Stacktrace:
	at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:347)
	at org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:486)
	at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:337)
	at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
	at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:187)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
	at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.jasper.JasperException: An exception occurred processing JSP page /a.jsp at line 11

8: <title>Insert title here</title>
9: </head>
10: <body>
11: <f:view>
12: 
13: </f:view>
14: </body>


Stacktrace:
	at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:415)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
	at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:341)
	... 23 more
Caused by: java.lang.RuntimeException: Cannot find FacesContext
	at javax.faces.webapp.UIComponentClassicTagBase.getFacesContext(UIComponentClassicTagBase.java:1855)
	at javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:1672)
	at org.apache.jsp.a_jsp._jspx_meth_f_005fview_005f0(a_jsp.java:93)
	at org.apache.jsp.a_jsp._jspService(a_jsp.java:67)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
	... 33 more
```







Grüße
Stefan


----------



## ifconfig (15. Okt 2011)

die automatisch erzeugte 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>e</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <description>
	This parameter tells MyFaces if javascript code should be allowed in
	the rendered HTML output.
	If javascript is allowed, command_link anchors will have javascript code
	that submits the corresponding form.
	If javascript is not allowed, the state saving info and nested parameters
	will be added as url parameters.
	Default is 'true'</description>
    <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <description>
	If true, rendered HTML code will be formatted, so that it is 'human-readable'
	i.e. additional line separators and whitespace will be written, that do not
	influence the HTML code.
	Default is 'true'</description>
    <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
    <param-value>false</param-value>
  </context-param>
  <context-param>
    <description>
	If true, a javascript function will be rendered that is able to restore the
	former vertical scroll on every request. Convenient feature if you have pages
	with long lists and you do not want the browser page to always jump to the top
	if you trigger a link or button action that stays on the same page.
	Default is 'false'
</description>
    <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
    <param-value>true</param-value>
  </context-param>
  <listener>
    <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
  </listener>
</web-app>
```


die autom. erz. faces-config.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_1_2.xsd"
    version="1.2">

</faces-config>
```

und die a.jsp:

```
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<f:view>

</f:view>
</body>
</html>
```


Übrigens, wie kann man so lange Konsolenausgaben geschickter in einen Forumsbeitrag packen? ich bekam vorhin eine Fehlermeldung, dass mein Beitrag über der Grenze von 25000 Zeichen liegt. Darum hier der zweite Beitrag.


----------



## Sym (15. Okt 2011)

Ich meine, Du brauchst noch


```
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
```

in Deiner web.xml. 

Ansonsten findest Du hier ganz viel zu Deinem Problem.


----------



## ifconfig (15. Okt 2011)

Hallo Sym,
dein Tipp mit dem Listener hilft leider nichts. Die Server-Konsole liefert wieder die gleichen Fehler.
Der interessanteste Teil ist hier:


```
19:18:26,594 INFO  [StartupServletContextListener] Checking for plugins:org.apache.myfaces.FACES_INIT_PLUGINS
19:18:26,652 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON' found, using default value false
19:18:26,666 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS' found, using default value false
19:18:26,666 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.SAVE_FORM_SUBMIT_LINK_IE' found, using default value false
19:18:26,666 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS' found, using default value true
19:18:26,666 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.RENDER_VIEWSTATE_ID' found, using default value true
19:18:26,666 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.STRICT_XHTML_LINKS' found, using default value true
19:18:26,666 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.CONFIG_REFRESH_PERIOD' found, using default value 2
19:18:26,666 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces.VIEWSTATE_JAVASCRIPT' found, using default value false
19:18:26,666 INFO  [MyfacesConfig] Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
19:18:26,667 INFO  [MyfacesConfig] Starting up Tomahawk on the RI-JSF-Implementation.
19:18:26,667 INFO  [MyfacesConfig] Starting up Tomahawk on the MyFaces-JSF-Implementation
19:18:26,667 ERROR [MyfacesConfig] Both MyFaces and the RI are on your classpath. Please make sure to use only one of the two JSF-implementations.
19:18:26,790 INFO  [FacesConfigurator] Reading standard config META-INF/standard-faces-config.xml
19:18:27,131 INFO  [FacesConfigurator] Reading config /WEB-INF/faces-config.xml
19:18:27,280 INFO  [FacesConfigurator] Starting up MyFaces-package : myfaces-api in version : 1.2.9 from path : file:/home/user1/jboss-4.2.3.GA/server/default/tmp/deploy/tmp7411141379143254875e-exp.war/WEB-INF/lib/myfaces-api-1.2.9.jar
19:18:27,281 INFO  [FacesConfigurator] Starting up MyFaces-package : myfaces-impl in version : 1.2.9 from path : file:/home/user1/jboss-4.2.3.GA/server/default/tmp/deploy/tmp7411141379143254875e-exp.war/WEB-INF/lib/myfaces-impl-1.2.9.jar
19:18:27,281 INFO  [FacesConfigurator] MyFaces-package : tomahawk not found.
19:18:27,281 INFO  [FacesConfigurator] MyFaces-package : tomahawk12 not found.
19:18:27,281 INFO  [FacesConfigurator] MyFaces-package : tomahawk-sandbox not found.
19:18:27,281 INFO  [FacesConfigurator] MyFaces-package : tomahawk-sandbox12 not found.
19:18:27,281 INFO  [FacesConfigurator] MyFaces-package : tomahawk-sandbox15 not found.
19:18:27,281 INFO  [FacesConfigurator] MyFaces-package : myfaces-orchestra-core not found.
19:18:27,281 INFO  [FacesConfigurator] MyFaces-package : myfaces-orchestra-core12 not found.
19:18:27,281 INFO  [FacesConfigurator] MyFaces-package : trinidad-api not found.
19:18:27,281 INFO  [FacesConfigurator] MyFaces-package : trinidad-impl not found.
19:18:27,281 INFO  [FacesConfigurator] MyFaces-package : tobago not found.
19:18:27,282 INFO  [FacesConfigurator] MyFaces-package : commons-el not found.
19:18:27,282 INFO  [FacesConfigurator] MyFaces-package : jsp-api not found.
```


Und zu deinem Tipp, dass ich googeln soll, bringt mir leider auch nichts, weil ich wie gesagt ja am Anfang meines ersten Posts mitgeteilt habe, dass ich eben schon TAGELANG GEGOOGELT habe. Und das ist keine leere Floskel sondern bittere Wahrheit. Und deinen Tipp mit diesem Listener einfügen hab ich bei meinem tagelangen Fehler-Googeln schon öfters gelesen.
Also bitte helft mir, das kann doch nicht sein, dass man dieses Problem nicht lösen kann.

Grüße
Stefan


----------



## Final_Striker (15. Okt 2011)

Vielleicht liegt es ja daran?


```
07:55:36,317 ERROR [MyfacesConfig] Both MyFaces and the RI are on your classpath. Please make sure to use only one of the two JSF-implementations.
```


----------



## ifconfig (15. Okt 2011)

also ich habe aber nur die myfaces beim Eclipse-Projekterstellen ausgewählt, wie ich oben beschrieben habe. Hier ein Bild aus meinem Workspace-Projekt, wo die jars gezeigt sind.


----------



## ifconfig (15. Okt 2011)

ja, das ist das Problem, dass halt dieses Eclipse nur die Apache MyFaces oder so ein Mojara anbietet. Aber egal welche der beiden ich gewählt habe, es kommt immer dieses Problem, weil JBoss trotzdem sein eigenes jsf nimmt. Warum kann man denn dem Eclipse nicht einfach sagen dass er die JBoss-eigenen jsf-jars nehmen soll? Und warum wird in KEINEM einzigen Eclipse-jsf-jboss-Tutorial gezeigt, wie man dieses zwangsläufig auftretende Problem lösen kann?

Naja...ich hab jetzt jedenfalls gerade endlich eine Möglichkeit gefunden, wie ich beim Eclipse-JSF-JBoss-Projekterstellen direkt die JBoss-eigenen jsf-Libs einbinden kann! Warum soll man den eigentlich krampfhaft diese Apache-myfaces nehmen, wenn JBoss doch sowieso schon jsf-Libs hat? Und warum funktioniert das myfaces-Einbinden nie, egal welche Anleitung man versucht, nachzumachen?

Aber wie gesagt: Ich habs jetzt endlich lösen können!!!!!!!
LÖSUNG:
SO GEHTS: beim Eclipse: new dynamic web project, configuration: jsf v1.2, target runtime JBoss 4.2, next klicken, wiedeer next, DANN: oben auf managed libraries Icon klicken, dann "new.." klicken, name:"jsf-von-jboss4", dann dieses markieren und "add jars..." klicken, dann den Folder angeben, wo die JBoss-eigenen jsf jars liegen, nämlich bei mir unter "/home/user1/jboss-4.2.3.GA/server/default/deploy/jboss-web.deployer/jsf-libs", dann ok klicken, FERTIG!
jsp File mit jsf(html) Template erzeugen.
Dann das jsp File rechtsklicken, run as, on server, JBoss, und ES GEHT!!!

hier die nun fehlerfreie Server-startup-Konsole:

```
20:19:38,665 INFO  [Server] Starting JBoss (MX MicroKernel)...
20:19:38,666 INFO  [Server] Release ID: JBoss [Trinity] 4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)
20:19:38,667 INFO  [Server] Home Dir: /home/user1/jboss-4.2.3.GA
20:19:38,667 INFO  [Server] Home URL: file:/home/user1/jboss-4.2.3.GA/
20:19:38,668 INFO  [Server] Patch URL: null
20:19:38,668 INFO  [Server] Server Name: default
20:19:38,668 INFO  [Server] Server Home Dir: /home/user1/jboss-4.2.3.GA/server/default
20:19:38,668 INFO  [Server] Server Home URL: file:/home/user1/jboss-4.2.3.GA/server/default/
20:19:38,668 INFO  [Server] Server Log Dir: /home/user1/jboss-4.2.3.GA/server/default/log
20:19:38,668 INFO  [Server] Server Temp Dir: /home/user1/jboss-4.2.3.GA/server/default/tmp
20:19:38,668 INFO  [Server] Root Deployment Filename: jboss-service.xml
20:19:39,115 INFO  [ServerInfo] Java version: 1.6.0_25,Sun Microsystems Inc.
20:19:39,116 INFO  [ServerInfo] Java VM: Java HotSpot(TM) 64-Bit Server VM 20.0-b11,Sun Microsystems Inc.
20:19:39,116 INFO  [ServerInfo] OS-System: Linux 2.6.35-22-generic,amd64
20:19:39,506 INFO  [Server] Core system initialized
20:19:41,863 INFO  [WebService] Using RMI server codebase: http://127.0.0.1:8083/
20:19:41,872 INFO  [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
20:19:42,549 INFO  [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
20:19:42,550 INFO  [TransactionManagerService] Setting up property manager MBean and JMX layer
20:19:42,821 INFO  [TransactionManagerService] Starting recovery manager
20:19:42,970 INFO  [TransactionManagerService] Recovery manager started
20:19:42,970 INFO  [TransactionManagerService] Binding TransactionManager JNDI Reference
20:19:45,616 INFO  [EJB3Deployer] Starting java:comp multiplexer
20:19:47,626 INFO  [NativeServerConfig] JBoss Web Services - Native
20:19:47,626 INFO  [NativeServerConfig] jbossws-3.0.1-native-2.0.4.GA (build=200803312044)
20:19:48,727 INFO  [Embedded] Catalina naming disabled
20:19:48,891 INFO  [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/jre/lib/amd64/server:/usr/java/jre/lib/amd64:/usr/java/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
20:19:48,952 INFO  [Http11Protocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
20:19:48,953 INFO  [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
20:19:48,953 INFO  [Catalina] Initialization processed in 226 ms
20:19:48,953 INFO  [StandardService] Starting service jboss.web
20:19:48,956 INFO  [StandardEngine] Starting Servlet Engine: JBossWeb/2.0.1.GA
20:19:49,017 INFO  [Catalina] Server startup in 63 ms
20:19:49,185 INFO  [TomcatDeployer] deploy, ctxPath=/, warUrl=.../deploy/jboss-web.deployer/ROOT.war/
20:19:49,869 INFO  [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=.../deploy/http-invoker.sar/invoker.war/
20:19:49,976 INFO  [TomcatDeployer] deploy, ctxPath=/jbossws, warUrl=.../deploy/jbossws.sar/jbossws-context.war/
20:19:50,083 INFO  [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
20:19:51,053 INFO  [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../deploy/management/console-mgr.sar/web-console.war/
20:19:51,560 INFO  [MailService] Mail Service bound to java:/Mail
20:19:51,688 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-local-jdbc.rar
20:19:51,729 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-xa-jdbc.rar
20:19:51,762 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-local-jdbc.rar
20:19:51,805 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-xa-jdbc.rar
20:19:51,874 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jms/jms-ra.rar
20:19:51,916 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/mail-ra.rar
20:19:51,973 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/quartz-ra.rar
20:19:51,986 INFO  [QuartzResourceAdapter] start quartz!!!
20:19:52,093 INFO  [SimpleThreadPool] Job execution threads will use class loader of thread: main
20:19:52,244 INFO  [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
20:19:52,246 INFO  [RAMJobStore] RAMJobStore initialized.
20:19:52,260 INFO  [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
20:19:52,260 INFO  [StdSchedulerFactory] Quartz scheduler version: 1.5.2
20:19:52,260 INFO  [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
20:19:54,137 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
20:19:54,428 INFO  [A] Bound to JNDI name: queue/A
20:19:54,430 INFO  [B] Bound to JNDI name: queue/B
20:19:54,431 INFO  [code] Bound to JNDI name: queue/C
20:19:54,432 INFO  [D] Bound to JNDI name: queue/D
20:19:54,433 INFO  [ex] Bound to JNDI name: queue/ex
20:19:54,446 INFO  [testTopic] Bound to JNDI name: topic/testTopic
20:19:54,448 INFO  [securedTopic] Bound to JNDI name: topic/securedTopic
20:19:54,449 INFO  [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
20:19:54,451 INFO  [testQueue] Bound to JNDI name: queue/testQueue
20:19:54,486 INFO  [UILServerILService] JBossMQ UIL service available at : /127.0.0.1:8093
20:19:54,523 INFO  [DLQ] Bound to JNDI name: queue/DLQ
20:19:54,662 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
20:19:54,720 INFO  [TomcatDeployer] deploy, ctxPath=/f, warUrl=.../tmp/deploy/tmp1085905535337277994f-exp.war/
20:19:56,173 INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
20:19:56,419 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
20:19:56,462 INFO  [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
20:19:56,501 INFO  [Server] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)] Started in 17s:831ms
20:32:31,881 INFO  [TomcatDeployer] undeploy, ctxPath=/f, warUrl=.../tmp/deploy/tmp1085905535337277994f-exp.war/
20:32:32,428 INFO  [TomcatDeployer] deploy, ctxPath=/f, warUrl=.../tmp/deploy/tmp1262000415703675276f-exp.war/
```

Gruß
Stefan


----------



## Final_Striker (15. Okt 2011)

gibt es eigentlich einen Grund, warum du noch JSF 1.2 nutzen willst?


----------



## ifconfig (15. Okt 2011)

Ja, diesen Grund gibt es leider...bei mir in der Arbeit wird noch jsf1.2  und JBoss 4.2.3 eingesetzt.
Wie ist das bei euch? Wird schon überall jsf2.0 eingesetzt? Ist meine Firma also die Ausnahme, die noch auf jsf1.2 setzt?


----------

