java - tomcat started without error, but when I try to access the website it return 404 -


i following steps in website:http://www.codejava.net/frameworks/spring/spring-4-and-hibernate-4-integration-tutorial-part-1-xml-configuration, after finished coding part, drag , drop project tomcat8.0 server, based on log seems right.. here log

oct 14, 2015 10:27:37 pm org.apache.tomcat.util.digester.setpropertiesrule begin warning: [setpropertiesrule]{server/service/engine/host/context} setting property 'source' 'org.eclipse.jst.jee.server:springmvchibernatexml' did not find matching property. oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: server version:        apache tomcat/8.0.27 oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: server built:          sep 28 2015 08:17:25 utc oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: server number:         8.0.27.0 oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: os name:               windows 8.1 oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: os version:            6.3 oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: architecture:          amd64 oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: java home:             c:\program files\java\jre7 oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: jvm version:           1.7.0_80-b15 oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: jvm vendor:            oracle corporation oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: catalina_base:         v:\programming\spring\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: catalina_home:         c:\users\vincent\desktop\apache-tomcat-8.0.27 oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:50348 oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: command line argument: -dcatalina.base=v:\programming\spring\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: command line argument: -dcatalina.home=c:\users\vincent\desktop\apache-tomcat-8.0.27 oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: command line argument: -dwtp.deploy=v:\programming\spring\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: command line argument: -djava.endorsed.dirs=c:\users\vincent\desktop\apache-tomcat-8.0.27\endorsed oct 14, 2015 10:27:37 pm org.apache.catalina.startup.versionloggerlistener log info: command line argument: -dfile.encoding=cp1252 oct 14, 2015 10:27:37 pm org.apache.catalina.core.aprlifecyclelistener lifecycleevent info: loaded apr based apache tomcat native library 1.1.33 using apr version 1.5.1. oct 14, 2015 10:27:37 pm org.apache.catalina.core.aprlifecyclelistener lifecycleevent info: apr capabilities: ipv6 [true], sendfile [true], accept filters [false], random [true]. oct 14, 2015 10:27:38 pm org.apache.catalina.core.aprlifecyclelistener initializessl info: openssl initialized (openssl 1.0.1m 19 mar 2015) oct 14, 2015 10:27:38 pm org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["http-apr-8080"] oct 14, 2015 10:27:38 pm org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["ajp-apr-8009"] oct 14, 2015 10:27:38 pm org.apache.catalina.startup.catalina load info: initialization processed in 1791 ms oct 14, 2015 10:27:38 pm org.apache.catalina.core.standardservice startinternal info: starting service catalina oct 14, 2015 10:27:38 pm org.apache.catalina.core.standardengine startinternal info: starting servlet engine: apache tomcat/8.0.27 oct 14, 2015 10:27:41 pm org.apache.jasper.servlet.tldscanner scanjars info: @ least 1 jar scanned tlds yet contained no tlds. enable debug logging logger complete list of jars scanned no tlds found in them. skipping unneeded jars during scanning can improve startup time , jsp compilation time. oct 14, 2015 10:27:41 pm org.apache.catalina.core.applicationcontext log info: no spring webapplicationinitializer types detected on classpath oct 14, 2015 10:27:42 pm org.apache.catalina.core.applicationcontext log info: initializing spring root webapplicationcontext info : org.springframework.web.context.contextloader - root webapplicationcontext: initialization started info : org.springframework.web.context.support.xmlwebapplicationcontext - refreshing root webapplicationcontext: startup date [wed oct 14 22:27:42 edt 2015]; root of context hierarchy info : org.springframework.beans.factory.xml.xmlbeandefinitionreader - loading xml bean definitions servletcontext resource [/web-inf/spring/root-context.xml] info : org.springframework.beans.factory.support.defaultlistablebeanfactory - pre-instantiating singletons in org.springframework.beans.factory.support.defaultlistablebeanfactory@a98f6d0: defining beans []; root of factory hierarchy info : org.springframework.web.context.contextloader - root webapplicationcontext: initialization completed in 430 ms oct 14, 2015 10:27:42 pm org.apache.catalina.core.applicationcontext log info: initializing spring frameworkservlet 'appservlet' info : org.springframework.web.servlet.dispatcherservlet - frameworkservlet 'appservlet': initialization started info : org.springframework.web.context.support.xmlwebapplicationcontext - refreshing webapplicationcontext namespace 'appservlet-servlet': startup date [wed oct 14 22:27:42 edt 2015]; parent: root webapplicationcontext info : org.springframework.beans.factory.xml.xmlbeandefinitionreader - loading xml bean definitions servletcontext resource [/web-inf/spring/appservlet/servlet-context.xml] info : org.springframework.context.annotation.classpathbeandefinitionscanner - jsr-250 'javax.annotation.managedbean' found , supported component scanning info : org.springframework.context.annotation.classpathbeandefinitionscanner - jsr-330 'javax.inject.named' annotation found , supported component scanning info : org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor - jsr-330 'javax.inject.inject' annotation found , supported autowiring info : org.springframework.beans.factory.support.defaultlistablebeanfactory - pre-instantiating singletons in org.springframework.beans.factory.support.defaultlistablebeanfactory@28e41b44: defining beans [org.springframework.web.servlet.mvc.method.annotation.requestmappinghandlermapping#0,org.springframework.format.support.formattingconversionservicefactorybean#0,org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter#0,org.springframework.web.servlet.handler.mappedinterceptor#0,org.springframework.web.servlet.mvc.method.annotation.exceptionhandlerexceptionresolver#0,org.springframework.web.servlet.mvc.annotation.responsestatusexceptionresolver#0,org.springframework.web.servlet.mvc.support.defaulthandlerexceptionresolver#0,org.springframework.web.servlet.handler.beannameurlhandlermapping,org.springframework.web.servlet.mvc.httprequesthandleradapter,org.springframework.web.servlet.mvc.simplecontrollerhandleradapter,org.springframework.web.servlet.resource.resourcehttprequesthandler#0,org.springframework.web.servlet.handler.simpleurlhandlermapping#0,org.springframework.web.servlet.view.internalresourceviewresolver#0,homecontroller,org.springframework.context.annotation.internalconfigurationannotationprocessor,org.springframework.context.annotation.internalautowiredannotationprocessor,org.springframework.context.annotation.internalrequiredannotationprocessor,org.springframework.context.annotation.internalcommonannotationprocessor,org.springframework.context.annotation.internalpersistenceannotationprocessor,datasource,sessionfactory,org.springframework.aop.config.internalautoproxycreator,org.springframework.transaction.annotation.annotationtransactionattributesource#0,org.springframework.transaction.interceptor.transactioninterceptor#0,org.springframework.transaction.config.internaltransactionadvisor,transactionmanager,userdao,org.springframework.context.annotation.configurationclasspostprocessor$importawarebeanpostprocessor#0]; parent: org.springframework.beans.factory.support.defaultlistablebeanfactory@a98f6d0 info : org.springframework.web.servlet.mvc.method.annotation.requestmappinghandlermapping - mapped "{[/],methods=[get],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.modelandview com.vincent.spring.homecontroller.home() info : org.springframework.web.servlet.handler.simpleurlhandlermapping - mapped url path [/resources/**] onto handler 'org.springframework.web.servlet.resource.resourcehttprequesthandler#0' info : org.springframework.web.servlet.dispatcherservlet - frameworkservlet 'appservlet': initialization completed in 3300 ms oct 14, 2015 10:27:46 pm org.apache.coyote.abstractprotocol start info: starting protocolhandler ["http-apr-8080"] oct 14, 2015 10:27:46 pm org.apache.coyote.abstractprotocol start info: starting protocolhandler ["ajp-apr-8009"] oct 14, 2015 10:27:46 pm org.apache.catalina.startup.catalina start info: server startup in 7796 ms 

and here pom.xml

<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">     <modelversion>4.0.0</modelversion>     <groupid>com.vincent</groupid>     <artifactid>springmvchibernatexml</artifactid>     <name>springmvchibernatexml</name>     <packaging>war</packaging>     <version>1.0.0-build-snapshot</version>     <properties>         <java-version>1.7</java-version>         <org.springframework-version>3.1.1.release</org.springframework-version>         <org.aspectj-version>1.6.10</org.aspectj-version>         <org.slf4j-version>1.6.6</org.slf4j-version>     </properties>     <dependencies>         <!-- spring -->         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-context</artifactid>             <version>${org.springframework-version}</version>             <exclusions>                 <!-- exclude commons logging in favor of slf4j -->                 <exclusion>                     <groupid>commons-logging</groupid>                     <artifactid>commons-logging</artifactid>                  </exclusion>             </exclusions>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-webmvc</artifactid>             <version>${org.springframework-version}</version>         </dependency>          <!-- aspectj -->         <dependency>             <groupid>org.aspectj</groupid>             <artifactid>aspectjrt</artifactid>             <version>${org.aspectj-version}</version>         </dependency>             <!-- hibernate orm -->         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-orm</artifactid>             <version>${org.springframework-version}</version>             <type>jar</type>             <scope>compile</scope>         </dependency>           <!-- logging -->         <dependency>             <groupid>org.slf4j</groupid>             <artifactid>slf4j-api</artifactid>             <version>${org.slf4j-version}</version>         </dependency>         <dependency>             <groupid>org.slf4j</groupid>             <artifactid>jcl-over-slf4j</artifactid>             <version>${org.slf4j-version}</version>             <scope>runtime</scope>         </dependency>         <dependency>             <groupid>org.slf4j</groupid>             <artifactid>slf4j-log4j12</artifactid>             <version>${org.slf4j-version}</version>             <scope>runtime</scope>         </dependency>         <dependency>             <groupid>log4j</groupid>             <artifactid>log4j</artifactid>             <version>1.2.15</version>             <exclusions>                 <exclusion>                     <groupid>javax.mail</groupid>                     <artifactid>mail</artifactid>                 </exclusion>                 <exclusion>                     <groupid>javax.jms</groupid>                     <artifactid>jms</artifactid>                 </exclusion>                 <exclusion>                     <groupid>com.sun.jdmk</groupid>                     <artifactid>jmxtools</artifactid>                 </exclusion>                 <exclusion>                     <groupid>com.sun.jmx</groupid>                     <artifactid>jmxri</artifactid>                 </exclusion>             </exclusions>             <scope>runtime</scope>         </dependency>          <!-- @inject -->         <dependency>             <groupid>javax.inject</groupid>             <artifactid>javax.inject</artifactid>             <version>1</version>         </dependency>          <!-- servlet -->         <dependency>             <groupid>javax.servlet</groupid>             <artifactid>servlet-api</artifactid>             <version>2.5</version>             <scope>provided</scope>         </dependency>         <dependency>             <groupid>javax.servlet.jsp</groupid>             <artifactid>jsp-api</artifactid>             <version>2.1</version>             <scope>provided</scope>         </dependency>         <dependency>             <groupid>javax.servlet</groupid>             <artifactid>jstl</artifactid>             <version>1.2</version>         </dependency>          <!-- test -->         <dependency>             <groupid>junit</groupid>             <artifactid>junit</artifactid>             <version>4.12</version>             <scope>test</scope>         </dependency>         <dependency>             <groupid>org.apache.commons</groupid>             <artifactid>commons-dbcp2</artifactid>             <version>2.0</version>         </dependency>         <dependency>             <groupid>mysql</groupid>             <artifactid>mysql-connector-java</artifactid>             <version>5.1.36</version>         </dependency>         <dependency>             <groupid>org.hibernate</groupid>             <artifactid>hibernate-core</artifactid>             <version>4.2.20.final</version>         </dependency>     </dependencies>     <build>         <plugins>             <plugin>                 <artifactid>maven-eclipse-plugin</artifactid>                 <version>2.9</version>                 <configuration>                     <additionalprojectnatures>                         <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>                     </additionalprojectnatures>                     <additionalbuildcommands>                         <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>                     </additionalbuildcommands>                     <downloadsources>true</downloadsources>                     <downloadjavadocs>true</downloadjavadocs>                 </configuration>             </plugin>             <plugin>                 <groupid>org.apache.maven.plugins</groupid>                 <artifactid>maven-compiler-plugin</artifactid>                 <version>2.5.1</version>                 <configuration>                     <source>1.6</source>                     <target>1.6</target>                     <compilerargument>-xlint:all</compilerargument>                     <showwarnings>true</showwarnings>                     <showdeprecation>true</showdeprecation>                 </configuration>             </plugin>             <plugin>                 <groupid>org.codehaus.mojo</groupid>                 <artifactid>exec-maven-plugin</artifactid>                 <version>1.2.1</version>                 <configuration>                     <mainclass>org.test.int1.main</mainclass>                 </configuration>             </plugin>         </plugins>     </build> </project> 

i published code github, https://github.com/zhengye1/springmvc, still cannot figure out going wrong...

edit: try access localhost:8080/springmvchibernatexml, , here hibernate.cfg.xml file in src/main/java

<?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-configuration public         "-//hibernate/hibernate configuration dtd 3.0//en"         "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration>     <session-factory>         <property name="dialect">org.hibernate.dialect.mysqldialect</property>         <property name="show_sql">true</property>         <mapping resource="com/vincent/spring/model/user.hbm.xml"/>     </session-factory> </hibernate-configuration> 

and user.hbm.xml file in src/main/java/com/vincent/spring/model/

<hibernate-mapping package="com.vincent.spring.model">     <class name="user" table="users">         <id name="id" column="user_id">             <generator class="native" />         </id>         <property name="username" column= "username" />         <property name="password" column= "password" />         <property name="email" column= "email" />     </class> </hibernate-mapping> 

web.xml file in src/main/webapp/web-inf/web.xml, (i didn't touch file @ all)

<?xml version="1.0" encoding="utf-8"?> <web-app version="2.5" 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">      <!-- definition of root spring container shared servlets , filters -->     <context-param>         <param-name>contextconfiglocation</param-name>         <param-value>/web-inf/spring/root-context.xml</param-value>     </context-param>      <!-- creates spring container shared servlets , filters -->     <listener>         <listener-class>org.springframework.web.context.contextloaderlistener</listener-class>     </listener>      <!-- processes application requests -->     <servlet>         <servlet-name>appservlet</servlet-name>         <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class>         <init-param>             <param-name>contextconfiglocation</param-name>             <param-value>/web-inf/spring/appservlet/servlet-context.xml</param-value>         </init-param>         <load-on-startup>1</load-on-startup>     </servlet>      <servlet-mapping>         <servlet-name>appservlet</servlet-name>         <url-pattern>/</url-pattern>     </servlet-mapping>  </web-app> 

this not problem hibernate, rather spring mvc. can try add web.xml?

<welcome-file-list>   <welcome-file>/</welcome-file> </welcome-file-list> 

and can try playing around @requestmapping so:

@requestmapping(value = {"","/"}) 

or can try map hand

@requestmapping(value = "springmvchibernatexml")

this might point right direction:

in servlet mapping in spring mvc how map root of url pattern directory?

hope helps.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -