Maven Abhängigkeiten für Java-EE-Anwendung auf Tomcat-Server. Was ist falsch mit Java ee-api?

Habe ich ein sehr einfaches hello world Java EE-Anwendung. Die index.xhtml ist wie folgt:

<?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">

<h:head>
    <title>JSF 2.0 Hello World</title>
</h:head>
<h:body>
    <h3>#{problemBean.helloWorld}</h3>
</h:body>
</html>

Wenn ich diese Anwendung ausführen, mit diesen Abhängigkeiten in meinem pom.xml Datei, es läuft wunderbar:

  <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.1.19</version>
  </dependency>

  <dependency>
      <groupId>com.sun.faces</groupId>
      <artifactId>jsf-impl</artifactId>
      <version>2.1.19</version>
  </dependency>

Aber wenn ich versuche:

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0</version>
</dependency>

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-web-api</artifactId>
    <version>6.0</version>
</dependency>

Bekomme ich:

java.lang.ClassNotFoundException: com.Sonne.Gesichter.config.ConfigureListener

Soweit ich weiß, Java ee-api hat auch alle Klassen, die jsf-api bieten würde?

So was vermisse ich hier?


Edit:

Dies ist mein web.xml wenn es hilft trotzdem:

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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_2_5.xsd"
         version="2.5">

    <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>

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>

</web-app>

und ProblemBean.java:

package com.tugay;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class ProblemBean {

    private String helloWorld = "Hello world";

    public String getHelloWorld() {
        return helloWorld;
    }

    public void setHelloWorld(String helloWorld) {
        this.helloWorld = helloWorld;
    }
}
was application-server verwenden Sie ?

InformationsquelleAutor Koray Tugay | 2013-04-13

Schreibe einen Kommentar