Wenn ich über localhost index.html aufrufe bekomme ich http Status 404

Hallo liebe Leute,

das bekomme ich nach dem Serverstart

M?r 10, 2015 12:21:07 PM org.apache.catalina.core.AprLifecycleListener init
Information: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/admin/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
M?r 10, 2015 12:21:07 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
Warnung: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‚source‘ to ‚org.eclipse.jst.jee.server:VehicleBooking‘ did not find a matching property.
M?r 10, 2015 12:21:07 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
Warnung: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‚source‘ to ‚org.eclipse.jst.jee.server:Test‘ did not find a matching property.
M?r 10, 2015 12:21:08 PM org.apache.coyote.AbstractProtocol init
Information: Initializing ProtocolHandler [„http-bio-8080“]
M?r 10, 2015 12:21:08 PM org.apache.coyote.AbstractProtocol init
Information: Initializing ProtocolHandler [„ajp-bio-8009“]
M?r 10, 2015 12:21:08 PM org.apache.catalina.startup.Catalina load
Information: Initialization processed in 1361 ms
M?r 10, 2015 12:21:08 PM org.apache.catalina.core.StandardService startInternal
Information: Starting service Catalina
M?r 10, 2015 12:21:08 PM org.apache.catalina.core.StandardEngine startInternal
Information: Starting Servlet Engine: Apache Tomcat/7.0.42
M?r 10, 2015 12:21:15 PM org.apache.catalina.core.ApplicationContext log
Information: No Spring WebApplicationInitializer types detected on classpath
M?r 10, 2015 12:21:15 PM com.sun.faces.config.ConfigureListener contextInitialized
Information: Mojarra 2.1.6 (SNAPSHOT 20111206) f?r Kontext ‚/VehicleBooking‘ wird initialisiert.
M?r 10, 2015 12:21:16 PM com.sun.faces.spi.InjectionProviderFactory createInstance
Information: JSF1048: PostConstruct/PreDestroy-Annotationen vorhanden. Verwaltete Bean-Methoden, die mit diesen Annotationen markiert sind, lassen die entsprechenden Annotationen verarbeiten.
M?r 10, 2015 12:21:18 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
Information: Running on PrimeFaces 3.1.1
M?r 10, 2015 12:21:18 PM org.apache.coyote.AbstractProtocol start
Information: Starting ProtocolHandler [„http-bio-8080“]
M?r 10, 2015 12:21:18 PM org.apache.coyote.AbstractProtocol start
Information: Starting ProtocolHandler [„ajp-bio-8009“]
M?r 10, 2015 12:21:18 PM org.apache.catalina.startup.Catalina start
Information: Server startup in 10424 ms

nach Zahlreiche suchen dachte ich diese Zeile könnte mir helfen

No Spring WebApplicationInitializer types detected on classpath
und bin ich auf dem Link gestossen . Die Sachen mit clean hat nicht geholfen und dann habe ich versucht unter src packet main/webapp/WEB-INF zu machen damit WEB-INF Sachen dort verschiebe, aber erlaubt eclipse mir nicht

habt ihr einen Ratschlag für mich?

Die Warnungen der fehlenden APR-Libs haben nichts mit dem Fehler zu tun. Das heißt nur, dass der Tomcat mit plain Java läuft und keine nativen Funktionen des Betriebssystems nutzt. Die APRs baut man auf produktiven Servern ein, um die Performance zu steigern.

Der Fehler kommt, weil es schlicht keine index.html gibt. Wenn ich den Screenshot richtig verstehe, sollte es auch keine geben. Denn es handelt sich ja um einen Webservice und nicht um eine interaktive Webanwendung. Im Zweifel müsste Content, der direkt aufrufbar sein soll, direkt unter WebContent liegen, NICHT unter WEB-INF.

wenn ich über localhost index.html aufrufe bekomme ich http Status 404

Was tippst du oben im Browser überhaupt ein?

Port 8080? Pfad?

Kontext '/VehicleBooking' wird initialisiert.

http://localhost:8080/VehicleBooking waere wohl besser

ja ich rufe

localhost:8080/VehicleBooking/index.html
auf. Wenn ich index.html unter WebContent habe , dann funktioniert auch nicht

Du kannst nix unter WEB-INF direkt vom Browser aus aufrufen, deine index.html gehoert einen Ordner nach oben

ja das war mein Fehler dass index.html in WEB-INF war aber jetzt habe ich in WebContent und funktioniert trotzdem nicht

Hast du denn schon neu-deployed?

meinst du dass ich tomcat neu runterlasen soll und von eclipse loschen und wieder einfügen? oder reicht es wenn ich von eclipse lösche und wieder einfüge?

Ich meinte eigentlich die WebApp neu deployen :wink:

Lokale Aenderungen in der IDE werden nicht immer propagiert.

meinst du dass ich Projekt neu anlegen muss und Tomcat , maven und Spring alles neu einstellen muss?
Ist das richtige Vorgang, damit ich endlich lerne wie es wirklich geht?

  1. eine Dynamische webappliction erstellen in Eclipse
  2. Tomcat in eclipse einfügen
  3. maven ->pom.xml
  4. Hibernate

oder falls du meinst dass ich auf eclipse von Tomcat server Projekt loschen und dann wieder neu hinzufügen soll, habe ich schon gemacht aber hilft trotzdem nicht :frowning:

In Eclipse heisst ein re-deploy zB. “publish” oder auch “re-publish”…

Falls deine POM immer noch kaputt ist, soltest du den Maven Teil die komplett ignorieren (inkl. kein Maven Projekt in Eclipse einrichten), oder die POM richten.

Was landet denn alles im Tomcat?

Dank dir habe ich im pom.xml keine Fehler mehr

spring-security.xml
applicationContext.xml

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

VehicleBooking

index.html
index.htm
index.jsp
default.html
default.htm
default.jsp


contextConfigLocation

/WEB-INF/spring-security.xml
/WEB-INF/applicationContext.xml



org.springframework.web.context.ContextLoaderListener


dispatcher
org.springframework.web.servlet.DispatcherServlet
1


dispatcher
/*


This is a MySQL database connection
jdbc/vb
javax.sql.DataSource
Container

[/XML]

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

<security:http auto-config=„true“ use-expressions=„true“ access-denied-page=„/rest/auth/denied“ >

<security:intercept-url pattern="/rest/auth/login" access="permitAll"/>
<security:intercept-url pattern="/rest/main/admin" access="hasRole('ROLE_ADMIN')"/>
<security:intercept-url pattern="/rest/main/common" access="hasRole('ROLE_USER')"/>

<!-- Adding the openid-login tag activates Spring Security's support for OpenID  -->
<security:openid-login
        login-page="/rest/auth/login" 
        authentication-failure-url="/rest/auth/login?error=true" 
        default-target-url="/rest/main/common"/>

<security:logout 
        invalidate-session="true" 
        logout-success-url="/rest/auth/login" 
        logout-url="/rest/auth/logout"/>

</security:http>

security:authentication-manager
<security:authentication-provider user-service-ref=„userDetailsService“>
<security:password-encoder ref=„passwordEncoder“/>
</security:authentication-provider>
</security:authentication-manager>

<security:user-service id=„userDetailsService“>

<security:user name=„https://www.google.com/accounts/o8/id?id=AItxxioJSDLFJLjxcksdfjOpAASDFosSSoJ0E
password=„“ authorities=„ROLE_USER, ROLE_ADMIN“ />
</security:user-service>
[/XML]

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

<context:annotation-config />

<context:component-scan base-package=„com.vb.controller“ />

<mvc:annotation-driven />
[/XML]

Landet dein WebContent denn auch im Tomcat?

Die POM dich ich erstellt habe passt so gar nicht zu deiner Projekttruktur in Eclipse aus deinen Bildern :wink:
Entweder hast du weiter angepasst oder eben eine kaputte POM bzw. ein kaputtes Porjekt.

das soll ich von web.xml auslesen können oder?
von WebContent sind nur die in tomcat[XML]
/WEB-INF/spring-security.xml
/WEB-INF/applicationContext.xml
[/XML]

verzeichnisstruktur schaut so aus

[XML]WebContent
→ META-INF
->MANIFEST.MF
->WEB-INF
->lib
->applicationContext.xml
->spring-config.xml
->spring-security.xml
->web.xml
->index.html[/XML]

mit ist noch was komisches aufgefallen. Wenn ich http://localhost:8080 aufrufe statt tomcat Seite bekomme ich 404 fehlerstatus. Ich habe dann ein Dynamisches Projekt Test erstellt und http://localhost:8080/Test/index.html Aufruf funktioniert reibungslos

Nein, du sollst nachsehen was wirklich von deinen Dateien im Tomcat landet.
Falls die Projektstruktur nicht zur POM passt, kann einiges fehlen

Eben, passt nicht zur POM/Projekt was ich geschickt hatte.
Ist ja aber nur aus der IDE, was wirklich ankommt interessiert.

anscheinend liegt nicht an tomcat wenn http://localhost:8080 aufgerufen wird und tomcat startseite nicht kommt, sondern weil ich das von eclipse starte und deswegen

mein pom.xml funktioniert
[XML]
4.0.0
com.vb
VehicleBooking
war
1.0-SNAPSHOT
VehicleBooking
http://maven.apache.org

src


org.apache.tomcat.maven
tomcat7-maven-plugin
2.1

http://localhost:8080/VehicleBooking
my-tomcat
/VehicleBooking



org.apache.maven.plugins
maven-compiler-plugin
3.1

1.7
1.7



org.apache.maven.plugins
maven-war-plugin
2.6

/WebContent






prime-repo
PrimeFaces Maven Repository
http://repository.primefaces.org
default

<properties>
	<spring.version>3.1.1.RELEASE</spring.version>
</properties>

<dependencies>

	<!-- Spring 3 dependencies -->
	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-core</artifactId>
		<version>${spring.version}</version>
	</dependency>

	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-context</artifactId>
		<version>${spring.version}</version>
	</dependency>

	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-webmvc</artifactId>
		<version>${spring.version}</version>
	</dependency>

	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-web</artifactId>
		<version>${spring.version}</version>
	</dependency>

	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-tx</artifactId>
		<version>${spring.version}</version>
	</dependency>

	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-orm</artifactId>
		<version>${spring.version}</version>
	</dependency>

	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-test</artifactId>
		<version>${spring.version}</version>
	</dependency>

	<!-- JSF library -->
	<dependency>
		<groupId>com.sun.faces</groupId>
		<artifactId>jsf-api</artifactId>
		<version>2.1.6</version>
	</dependency>

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

	<dependency>
		<groupId>javax.servlet</groupId>
		<artifactId>jstl</artifactId>
		<version>1.2</version>
	</dependency>
	<dependency>
		<groupId>cglib</groupId>
		<artifactId>cglib-nodep</artifactId>
		<version>2.2</version>
	</dependency>

	<!-- Primefaces library -->
	<dependency>
		<groupId>org.primefaces</groupId>
		<artifactId>primefaces</artifactId>
		<version>3.1.1</version>
	</dependency>

	<!-- Hibernate library -->
	<dependency>
		<groupId>org.hibernate</groupId>
		<artifactId>hibernate-core</artifactId>
		<version>4.1.0.Final</version>
	</dependency>

	<dependency>
		<groupId>javassist</groupId>
		<artifactId>javassist</artifactId>
		<version>3.12.1.GA</version>
	</dependency>

	<!-- MySQL Java Connector library -->
	<dependency>
		<groupId>mysql</groupId>
		<artifactId>mysql-connector-java</artifactId>
		<version>5.1.17</version>
	</dependency>

	<dependency>
		<groupId>c3p0</groupId>
		<artifactId>c3p0</artifactId>
		<version>0.9.1.2</version>
	</dependency>

	<!-- Security -->
	<dependency>
		<groupId>org.springframework.security</groupId>
		<artifactId>spring-security-core</artifactId>
		<version>${spring.version}</version>
		<type>jar</type>
	</dependency>
	<dependency>
		<groupId>org.springframework.security</groupId>
		<artifactId>spring-security-config</artifactId>
		<version>${spring.version}</version>
	</dependency>
	<dependency>
		<groupId>org.springframework.security</groupId>
		<artifactId>spring-security-web</artifactId>
		<version>${spring.version}</version>
	</dependency>

	<!-- Servlet API -->
	<dependency>
		<groupId>javax.servlet</groupId>
		<artifactId>javax.servlet-api</artifactId>
		<version>3.0.1</version>
		<scope>provided</scope>
	</dependency>
	<!-- Log4j library -->
	<dependency>
		<groupId>log4j</groupId>
		<artifactId>log4j</artifactId>
		<version>1.2.16</version>
	</dependency>
	<dependency>
		<groupId>org.slf4j</groupId>
		<artifactId>slf4j-log4j12</artifactId>
		<version>1.7.10</version>
	</dependency>


	<dependency>
		<groupId>org.testng</groupId>
		<artifactId>testng</artifactId>
		<version>6.4</version>
	</dependency>
	
	<!-- Jackson for JSON -->
	<dependency>
		<groupId>com.fasterxml.jackson.core</groupId>
		<artifactId>jackson-databind</artifactId>
		<version>2.0.2</version>
	</dependency>
	<dependency>
	  <groupId>org.codehaus.jackson</groupId>
	  <artifactId>jackson-mapper-asl</artifactId>
	  <version>1.9.13</version>
	</dependency>
</dependencies>

[/XML]