Tobago und Facelets

marie12

Mitglied
Hi,

ich versuch gerade Tobago in mein Projekt zu integrieren, allerdings klappt das nicht so richtig.
Verwende die 1.5.4 (also auch tobago-facelets-1.5.4) Version von Tobago, die myfaces-api und impl version 1.2.11 und die jsf-facelets-1.1.14.jar

Beim Deployen bekomm ich folgenden Fehler:
Code:
Schwerwiegend: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: 
  Source Document: jar:file:/C:/apache-tomcat-7.0.25/webapps/zz2/WEB-INF/lib/tobago-facelets-1.5.3.jar!/META-INF/tobago-extension.taglib.xml
  Cause: Class 'org.apache.myfaces.tobago.facelets.extension.TobagoExtensionTagLibrary' is missing a runtime dependency: java.lang.NoClassDefFoundError: com/sun/facelets/tag/AbstractTagLibrary

...

Schwerwiegend: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! org.apache.myfaces.tobago.facelets.extension.TobagoExtensionTagLibrary cannot be cast to com.sun.faces.facelets.tag.TagLibrary


hier noch die web-xml:
[XML]
<?xml version="1.0"?>
<web-app version="3.0" 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-app_3_0.xsd">
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml,/WEB-INF/faces-managed-beans.xml,/WEB-INF/faces-navigation.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<!-- JavaServer Faces -->
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>

<!-- Tobago -->
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<filter>
<filter-name>multipartFormdataFilter</filter-name>
<filter-class>org.apache.myfaces.tobago.webapp.TobagoMultipartFormdataFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>multipartFormdataFilter</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>

<filter>
<filter-name>SecurityFilter</filter-name>
<filter-class>mypetstore.view.util.SecurityFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SecurityFilter</filter-name>
<url-pattern>*.jsf</url-pattern>
</filter-mapping>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
<!-- Tiles Servlet -->
<servlet>
<servlet-name>Tiles Servlet</servlet-name>
<servlet-class>org.apache.struts.tiles.TilesServlet</servlet-class>
<init-param>
<param-name>definitions-config</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>SpringContextServlet</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>

<!-- Tobago -->
<servlet>
<servlet-name>ResourceServlet</servlet-name>
<servlet-class>org.apache.myfaces.tobago.servlet.ResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ResourceServlet</servlet-name>
<url-pattern>/org/apache/myfaces/tobago/renderkit/*</url-pattern>
</servlet-mapping>

<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
</web-app>
[/XML]

stimmt was mit den beiden facelets.jars nicht?
kann mir vll. jemand helfen?
 

marie12

Mitglied
wenn ich die tobago-facelets.jar entferne dann geht das Programm einigermaßen, also es wird nicht richtig dargestellt und ich bekomm den Fehler:

Code:
TobagoRenderKit:77 The class which was found by the ResourceManager cannot be found or instantied: classname=javax.faces.Html
 

marie12

Mitglied
niemand eine Ahnung?

brauch ich die jsf-facelets-1.1.14.jar?
muss ich tobago-facelets.jar und jsf-facelets.jar beide drin haben?
oder ist das so wie mit den myfaces bibliotheken, dass wenn ich die rein nehm die jsf-api und impl rausnehmen muss?

Kann sein dass die javax.faces-2.1.6.jar irgendwie ein Fehler verursacht?
 

marie12

Mitglied
ok, neuer Versuch, vll kann mir da jemand weiterhelfen.
Jetzt mit der myfaceses Implementation versucht:

myfaces-api-2.1.6.jar
myfaces-impl-2.1.6.jar

tobago-core-1.5.4.jar
tobago..
..
tobago-facelets-1.5.4.jar
...

und

[XML]
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
[/XML]

wurde aus der web.xml entfernt

es deployt jetzt mal ohne Fehler, aber wenn ich die Seite im Browser aufrufen möchte kommt einfach nichts, also nur eine weiße Seite. Auf der Konsole werden die normalen Info-logs ausgegeben, dass die Beans laden etc.
Kommt aber kein Fehler, daher weiß ich auch grad nicht wonach ich suchen soll

hier mal ne einfache Seite die ich aufrufen möchte, allerdings nur ne weiße Seite kommt:

HTML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
	<title>Account Page</title>
</head>
<body>
	<f:view id="start">
	
	<h:form>
	<h:outputText value="hallo da" />
	</h:form>
	
	</f:view>  		
</body>
</html>

wenn ich die mit seite.xhtml aufrufe, wird der Tab des Browser auch mit der Überschrift der Seite "start" beschriftet.

jemand ne Ahnung?
 

marie12

Mitglied
ich arbeite jetzt mit dem tobago-example-1.5.3.
Die jsp Seiten zeigt er an, aber wie gesagt, die xhtml seiten nicht, da kommt nur eine weiße Seite

die verädnerte web.xml des tobago-example:

[XML]
<?xml version="1.0" encoding="UTF-8"?>

<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<display-name>Blank Tobago Application</display-name>

<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>


<filter>
<filter-name>multipartFormdataFilter</filter-name>
<filter-class>org.apache.myfaces.tobago.webapp.TobagoMultipartFormdataFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>multipartFormdataFilter</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>


<!-- workaround (e.g. for Oracle AS 10.1.2.0.0)-->
<listener>
<listener-class>org.apache.myfaces.tobago.webapp.TobagoServletContextListener</listener-class>
</listener>

<!-- servlet -->
<!-- no longer needed since Weblogic 8.1 SP 3
<servlet>
<servlet-name>WeblogicWorkaroundServlet</servlet-name>
<servlet-class>org.apache.myfaces.tobago.webapp.WeblogicWorkaroundServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
-->

<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet>
<servlet-name>ResourceServlet</servlet-name>
<servlet-class>org.apache.myfaces.tobago.servlet.ResourceServlet</servlet-class>
</servlet>


<!-- servlet-mapping -->

<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ResourceServlet</servlet-name>
<url-pattern>/org/apache/myfaces/tobago/renderkit/*</url-pattern>
</servlet-mapping>

<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

</web-app>
[/XML]


und hab die jsf-facelets.jar hinzugefügt.

meine xhtml Seite:

HTML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:tc="http://myfaces.apache.org/tobago/component">
<head>
	<title>Account Page</title>
</head>
<body>
	
<f:view>
  <tc:page>
    <f:facet name="layout">
      <tc:gridLayout/>
    </f:facet>
    <tc:out value="Hello World"/>
  </tc:page>
</f:view>
       		
</body>
</html>

wie gesagt weiße Seite wenn ich die aufrufe und Seitenquelltext aus dem Browser sieht auch demenstprechend aus:


HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html
></html>

die .jsp Seiten wo im Beispiel drin waren laufen
 

marie12

Mitglied
ok, ich glaube ich hab die Lösung, und zwar muss man in die faces-config den view handler mit rein nehmen:

[XML]
<view-handler>
com.sun.facelets.FaceletViewHandler
</view-handler>
[/XML]

kann mir mal jemand sagen warum? Dachte den soll man iwie für die neueren Versionen von JSF (ab jsf 2.0? oder so) nicht mehr in die faces-config mit rein nehmen, oder verwechsle ich da was?
 

Ähnliche Java Themen

Neue Themen


Oben