cannot insert row with Hibernate/JPA entityManager, MySQL and Spring - java

I've tried to implement JPA entityManager provided by Hibernate and update my database.
I use MySQL 5.7 server, where username is "tutorial" and password is just "password". I've done some configurations and tried to simply insert a row into the "country" table with columns: id(int)(pk)(auto_inc) and country(varchar), but it don't affect my database.
In country table are already 4 rows: (1, "Poland"), (2,"Slovakia"), (3, "Ukraine") and (4, "Czech Republic").
Controller:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import pl.hibernate.basics.daos.CustomersDetailsDAO;
import pl.hibernate.basics.model.Country;
#Controller
public class HomeController {
private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
#Autowired
private CustomersDetailsDAO customersDetailsDAO;
#RequestMapping(value = "/", method = RequestMethod.GET)
public String home() {
Country country = new Country();
country.setCountry("Lithuania");
logger.info("Country Entity: " + country);
customersDetailsDAO.insertCountry(country);
return "home";
}
}
CustomersDetailsDAOImpl:
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import pl.hibernate.basics.model.Country;
#Transactional
#Component
public class CustomersDetailsDAOImpl implements CustomersDetailsDAO {
#PersistenceContext
private EntityManager em;
#Override
public void insertCountry(Country country) {
em.persist(country);
}
}
Entity Class:
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
#Entity
#Table(name="country")
public class Country {
#Id
#GeneratedValue
private int id;
#Column
private String country;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
#Override
public String toString() {
return "Country [id=" + id + ", country=" + country + "]";
}
}
persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">
<tx:annotation-driven />
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/test" />
<property name="username" value="tutorial" />
<property name="password" value="password" />
</bean>
<bean id="emFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="pl.hibernate.basics" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="emFactory" />
</bean>
<bean id="persistenceExceptionTranslationPostProcessor"
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
</beans>
Console output (Note logger info at the end):
sty 29, 2016 2:31:27 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:JPA Hibernate Spring WebMVC Application' did not find a matching property.
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.23
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: May 19 2015 14:58:38 UTC
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.23.0
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 10
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.0
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre1.8.0_60
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_60-b27
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Users\Adrian\Desktop\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\Adrian\Desktop\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\Adrian\Desktop\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23\endorsed
sty 29, 2016 2:31:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1250
sty 29, 2016 2:31:27 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_60\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_60/bin/server;C:/Program Files/Java/jre1.8.0_60/bin;C:/Program Files/Java/jre1.8.0_60/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\xampp\php;;C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Users\Adrian\Desktop\eclipse;;.
sty 29, 2016 2:31:27 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
sty 29, 2016 2:31:28 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
sty 29, 2016 2:31:28 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
sty 29, 2016 2:31:28 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
sty 29, 2016 2:31:28 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1372 ms
sty 29, 2016 2:31:28 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
sty 29, 2016 2:31:28 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.23
sty 29, 2016 2:31:31 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
sty 29, 2016 2:31:31 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
sty 29, 2016 2:31:32 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 [Fri Jan 29 14:31:32 CET 2016]; root of context hierarchy
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/root-context.xml]
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/persistence.xml]
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Bean 'dataSource' of type [class org.springframework.jdbc.datasource.DriverManagerDataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Bean 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#e956be6' of type [class org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
WARN : org.hibernate.ejb.HibernatePersistence - HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Bean 'emFactory' of type [class org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#6441d7e2: defining beans [homeController,customersDetailsDAOImpl,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,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,dataSource,emFactory,transactionManager,persistenceExceptionTranslationPostProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 6254 ms
sty 29, 2016 2:31:38 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 for namespace 'appServlet-servlet': startup date [Fri Jan 29 14:31:38 CET 2016]; parent: Root WebApplicationContext
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]
INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#472f3baa: defining beans [mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#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,homeController,customersDetailsDAOImpl,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,org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0,org.springframework.web.servlet.view.InternalResourceViewResolver#0,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory#6441d7e2
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String pl.hibernate.basics.controllers.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 1362 ms
sty 29, 2016 2:31:39 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
sty 29, 2016 2:31:39 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
sty 29, 2016 2:31:39 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 11657 ms
INFO : pl.hibernate.basics.controllers.HomeController - Country Entity: Country [id=0, country=Lithuania]

Related

Spring MVC: Cannot mapping JSP files under subfolders

I'm aware there are a bunch of topics with same issues, but after 3 days researching I couldn't solve my problem.
If anyone spot the answer somewhere else, please feel free to mark this as duplicate and lead me there.
I'm trying to map a request in my Controller and then redirect to a subfolder under my default view folder. However, I'm getting a 404 error.
My web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<display-name>SIGCOM</display-name>
<servlet>
<servlet-name>springController</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springController</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springController.xml</param-value>
</context-param>
<filter>
<filter-name>SpringFilter</filter-name>
<filter-class>br.com.sigcom.filter.SpringFilter</filter-class>
<init-param>
<param-name>requestEncoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SpringFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--
<listener>
<listener-class>br.com.sigcom.listener.SpringListener</listener-class>
</listener>
-->
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/WebContent/WEB-INF/views/errorHandling/errorPage.jsp</location>
</error-page>
<error-page>
<!-- Missing resource -->
<error-code>404</error-code>
<location>/WebContent/WEB-INF/views/errorHandling/error404.jsp</location>
</error-page>
</web-app>
My servlet XML:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task.xsd">
<context:component-scan base-package="br.com.sigcom.controller" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
<mvc:annotation-driven />
<mvc:resources mapping="/resources/**" location="/resources/" cache-period="31556926" />
</beans>
As you see, my default views folder is WEB-INF/views. So far so good. I made a subfolder like this:
WEB-INF/
|-views/
|-admin/
|-default.jsp
In my Controller, I can't access WEB-INF/views/admin/default.jsp, for I get this 404 error.
My Controller:
package br.com.sigcom.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
#Controller
public class SpringController {
#RequestMapping(value = {"", "/", "home", "default", "index"})
public String redirectDefaultPage() {
return "default";
}
#RequestMapping("admin")
public String redirectAdminPage() {
return "admin/default";
}
}
I tried a lot, searched a lot, however without success. I know this must be a simple detail, but I'm exhausted. Thank you in advance!
PS.: my console:
mai 02, 2017 9:36:23 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
ADVERTÊNCIA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SIGCOM' did not find a matching property.
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server version: Apache Tomcat/8.0.43
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server built: Mar 28 2017 14:42:59 UTC
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server number: 8.0.43.0
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Name: Windows 8.1
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Version: 6.3
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Architecture: amd64
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Java Home: C:\Program Files (x86)\Java
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Version: 1.8.0_131-b11
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Vendor: Oracle Corporation
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_BASE: C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_HOME: C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.base=C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.home=C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dwtp.deploy=C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\wtpwebapps
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Djava.endorsed.dirs=C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\endorsed
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dfile.encoding=Cp1252
mai 02, 2017 9:36:23 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAÇÕES: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/bin/server;C:/Program Files (x86)/Java/bin;C:/Program Files (x86)/Java/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Intel\Shared Files\cpp\bin\Intel64;C:\Program Files (x86)\Borland\Delphi7\Bin;C:\Program Files (x86)\Borland\Delphi7\Projects\Bpl\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\MySQL\MySQL Utilities 1.6\;C:\Arquivos de programas\Borland\Delphi7\Projects\Bpl;C:\morais_san\Development\Delphi\Repository\Components\JVCL3.33\jcl;C:\morais_san\Development\Java\Maven\apache-maven-3.5.0\bin;C:\morais_san\Development\Eclipse\eclipse-jee-neon-R-win32-x86_64\eclipse;;.
mai 02, 2017 9:36:23 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["http-nio-8080"]
mai 02, 2017 9:36:23 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAÇÕES: Using a shared selector for servlet write/read
mai 02, 2017 9:36:23 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["ajp-nio-8009"]
mai 02, 2017 9:36:23 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAÇÕES: Using a shared selector for servlet write/read
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.Catalina load
INFORMAÇÕES: Initialization processed in 982 ms
mai 02, 2017 9:36:23 PM org.apache.catalina.core.StandardService startInternal
INFORMAÇÕES: Starting service Catalina
mai 02, 2017 9:36:23 PM org.apache.catalina.core.StandardEngine startInternal
INFORMAÇÕES: Starting Servlet Engine: Apache Tomcat/8.0.43
mai 02, 2017 9:36:25 PM org.apache.jasper.servlet.TldScanner scanJars
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
mai 02, 2017 9:36:26 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: No Spring WebApplicationInitializer types detected on classpath
mai 02, 2017 9:36:26 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: Initializing Spring FrameworkServlet 'springController'
mai 02, 2017 9:36:26 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFORMAÇÕES: FrameworkServlet 'springController': initialization started
mai 02, 2017 9:36:26 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFORMAÇÕES: Refreshing WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:36:26 BRT 2017]; root of context hierarchy
mai 02, 2017 9:36:26 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFORMAÇÕES: Loading XML bean definitions from ServletContext resource [/WEB-INF/springController-servlet.xml]
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFORMAÇÕES: Mapped "{[/search],methods=[GET]}" onto public java.lang.String br.com.sigcom.controller.SearchController.redirectSearchPage()
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFORMAÇÕES: Mapped "{[/admin]}" onto public java.lang.String br.com.sigcom.controller.SpringController.redirectAdminPage()
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFORMAÇÕES: Mapped "{[ || / || /home || /default || /index]}" onto public java.lang.String br.com.sigcom.controller.SpringController.redirectDefaultPage()
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFORMAÇÕES: Looking for #ControllerAdvice: WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:36:26 BRT 2017]; root of context hierarchy
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFORMAÇÕES: Looking for #ControllerAdvice: WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:36:26 BRT 2017]; root of context hierarchy
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler
INFORMAÇÕES: Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFORMAÇÕES: FrameworkServlet 'springController': initialization completed in 2250 ms
mai 02, 2017 9:36:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\docs
mai 02, 2017 9:36:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\docs has finished in 35 ms
mai 02, 2017 9:36:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\examples
mai 02, 2017 9:36:29 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: ContextListener: contextInitialized()
mai 02, 2017 9:36:29 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: SessionListener: contextInitialized()
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\examples has finished in 456 ms
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\host-manager
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\host-manager has finished in 45 ms
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\manager
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\manager has finished in 44 ms
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\ROOT
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\ROOT has finished in 32 ms
mai 02, 2017 9:36:29 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["http-nio-8080"]
mai 02, 2017 9:36:29 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["ajp-nio-8009"]
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.Catalina start
INFORMAÇÕES: Server startup in 5763 ms
mai 02, 2017 9:59:25 PM org.apache.catalina.core.StandardContext reload
INFORMAÇÕES: Reloading Context with name [/SIGCOM] has started
mai 02, 2017 9:59:25 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: Destroying Spring FrameworkServlet 'springController'
mai 02, 2017 9:59:25 PM org.springframework.web.context.support.XmlWebApplicationContext doClose
INFORMAÇÕES: Closing WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:36:26 BRT 2017]; root of context hierarchy
mai 02, 2017 9:59:27 PM org.apache.jasper.servlet.TldScanner scanJars
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
mai 02, 2017 9:59:27 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: No Spring WebApplicationInitializer types detected on classpath
mai 02, 2017 9:59:27 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: Initializing Spring FrameworkServlet 'springController'
mai 02, 2017 9:59:27 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFORMAÇÕES: FrameworkServlet 'springController': initialization started
mai 02, 2017 9:59:27 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFORMAÇÕES: Refreshing WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:59:27 BRT 2017]; root of context hierarchy
mai 02, 2017 9:59:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFORMAÇÕES: Loading XML bean definitions from ServletContext resource [/WEB-INF/springController-servlet.xml]
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFORMAÇÕES: Mapped "{[/search],methods=[GET]}" onto public java.lang.String br.com.sigcom.controller.SearchController.redirectSearchPage()
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFORMAÇÕES: Mapped "{[/admin]}" onto public java.lang.String br.com.sigcom.controller.SpringController.redirectAdminPage()
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFORMAÇÕES: Mapped "{[ || / || /home || /default || /index]}" onto public java.lang.String br.com.sigcom.controller.SpringController.redirectDefaultPage()
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFORMAÇÕES: Looking for #ControllerAdvice: WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:59:27 BRT 2017]; root of context hierarchy
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFORMAÇÕES: Looking for #ControllerAdvice: WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:59:27 BRT 2017]; root of context hierarchy
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler
INFORMAÇÕES: Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFORMAÇÕES: FrameworkServlet 'springController': initialization completed in 1456 ms
mai 02, 2017 9:59:28 PM org.apache.catalina.core.StandardContext reload
INFORMAÇÕES: Reloading Context with name [/SIGCOM] is completed
I've tried setup a project with the same setting you had except there is no filter, filter-mapping, error-page, listener in the web.xml and I'm able to access the access the URL without 404.
The controller is able to resolve the template as well.
Did you enter your URL correctly with the context path as well?
e.g. http://localhost:8080/SIGCOM/admin
I've create a new project with your code. But at last, i get the right thing. Maybe you can check you url like first floor says.
SOLVED. As you guys runned without filter, I've commented mine and worked. Now I know what to do. Appreciate your your help, guys!

Spring URL not seen, with controller and mapping

im trying to configure hello world application. The problem is my dispatcherServlet cannot see the URL's.
First thing first the vital code below:
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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>DebtDetector</display-name>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- <context-param> -->
<!-- <param-name>contextConfigLocation</param-name> -->
<!-- <param-value>/WEB-INF/rootApplicationContext.xml</param-value> -->
<!-- </context-param> -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">
<context:component-scan base-package="kaczynski" />
<context:annotation-config />
<mvc:annotation-driven />
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="WEB-INF/hibernate.properties"></property>
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${driver}" />
<property name="url" value="${url}" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="kaczynski" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="false" />
<property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect" />
</bean>
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>
<bean
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<bean
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<bean
class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />
</beans>
Controller:
package kaczynski.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
#Controller
public class ControllerAccount {
#RequestMapping("/index")
public String welcomePage(){
System.out.println("aa");
return "index";
}
}
and given warrning: (after http://localhost:8080/DebtDetector/index)
lip 15, 2016 10:57:13 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/DebtDetector/index] in DispatcherServlet with name 'mvc-dispatcher'
full server startup logs:
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.32
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Feb 2 2016 19:34:53 UTC
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.32.0
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre1.8.0_51
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_51-b16
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Users\Mateusz\Documents\workspace-sts-3.7.3.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Java\apache-tomcat-8.0.32
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\Mateusz\Documents\workspace-sts-3.7.3.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Java\apache-tomcat-8.0.32
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\Mateusz\Documents\workspace-sts-3.7.3.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Java\apache-tomcat-8.0.32\endorsed
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
lip 15, 2016 11:48:14 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_51/bin/server;C:/Program Files/Java/jre1.8.0_51/bin;C:/Program Files/Java/jre1.8.0_51/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Common Files\Autodesk Shared\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Java\jdk1.8.0_31\bin;C:\Java\apache-maven-3.3.9\bin;C:\Java\sts-bundle\sts-3.7.3.RELEASE;;.
lip 15, 2016 11:48:14 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
lip 15, 2016 11:48:14 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
lip 15, 2016 11:48:14 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
lip 15, 2016 11:48:14 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
lip 15, 2016 11:48:14 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1452 ms
lip 15, 2016 11:48:15 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
lip 15, 2016 11:48:15 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.32
lip 15, 2016 11:48:15 AM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [281] milliseconds.
lip 15, 2016 11:48:15 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\Users\Mateusz\Documents\workspace-sts-3.7.3.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\DebtDetector.xml
lip 15, 2016 11:48:15 AM org.apache.catalina.startup.SetContextPropertiesRule begin
WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:DebtDetector' did not find a matching property.
lip 15, 2016 11:48:18 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
lip 15, 2016 11:48:18 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
lip 15, 2016 11:48:18 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
lip 15, 2016 11:48:18 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
lip 15, 2016 11:48:18 AM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Fri Jul 15 11:48:18 CEST 2016]; root of context hierarchy
lip 15, 2016 11:48:18 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
lip 15, 2016 11:48:21 AM org.springframework.beans.factory.config.PropertyPlaceholderConfigurer loadProperties
INFO: Loading properties file from ServletContext resource [/WEB-INF/hibernate.properties]
lip 15, 2016 11:48:21 AM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
INFO: Loaded JDBC driver: com.mysql.jdbc.Driver
lip 15, 2016 11:48:21 AM org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean createNativeEntityManagerFactory
INFO: Building JPA container EntityManagerFactory for persistence unit 'default'
lip 15, 2016 11:48:21 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
name: default
...]
lip 15, 2016 11:48:21 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.0.9.Final}
lip 15, 2016 11:48:21 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
lip 15, 2016 11:48:21 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
lip 15, 2016 11:48:21 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
lip 15, 2016 11:48:22 AM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
lip 15, 2016 11:48:22 AM org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl useContextualLobCreation
INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
lip 15, 2016 11:48:23 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000228: Running hbm2ddl schema update
lip 15, 2016 11:48:23 AM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for #ControllerAdvice: Root WebApplicationContext: startup date [Fri Jul 15 11:48:18 CEST 2016]; root of context hierarchy
lip 15, 2016 11:48:23 AM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for #ControllerAdvice: Root WebApplicationContext: startup date [Fri Jul 15 11:48:18 CEST 2016]; root of context hierarchy
lip 15, 2016 11:48:23 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 5294 ms
lip 15, 2016 11:48:23 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'mvc-dispatcher'
lip 15, 2016 11:48:23 AM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'mvc-dispatcher': initialization started
lip 15, 2016 11:48:23 AM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'mvc-dispatcher-servlet': startup date [Fri Jul 15 11:48:23 CEST 2016]; parent: Root WebApplicationContext
lip 15, 2016 11:48:23 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
lip 15, 2016 11:48:25 AM org.springframework.beans.factory.config.PropertyPlaceholderConfigurer loadProperties
INFO: Loading properties file from ServletContext resource [/WEB-INF/hibernate.properties]
lip 15, 2016 11:48:25 AM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
INFO: Loaded JDBC driver: com.mysql.jdbc.Driver
lip 15, 2016 11:48:25 AM org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean createNativeEntityManagerFactory
INFO: Building JPA container EntityManagerFactory for persistence unit 'default'
lip 15, 2016 11:48:25 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
name: default
...]
lip 15, 2016 11:48:25 AM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
lip 15, 2016 11:48:25 AM org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl useContextualLobCreation
INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
lip 15, 2016 11:48:25 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000228: Running hbm2ddl schema update
lip 15, 2016 11:48:25 AM org.hibernate.jpa.internal.EntityManagerFactoryRegistry addEntityManagerFactory
WARN: HHH000436: Entity manager factory name (default) is already registered. If entity manager will be clustered or passivated, specify a unique value for property 'hibernate.ejb.entitymanager_factory_name'
lip 15, 2016 11:48:25 AM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for #ControllerAdvice: WebApplicationContext for namespace 'mvc-dispatcher-servlet': startup date [Fri Jul 15 11:48:23 CEST 2016]; parent: Root WebApplicationContext
lip 15, 2016 11:48:25 AM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for #ControllerAdvice: WebApplicationContext for namespace 'mvc-dispatcher-servlet': startup date [Fri Jul 15 11:48:23 CEST 2016]; parent: Root WebApplicationContext
lip 15, 2016 11:48:26 AM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'mvc-dispatcher': initialization completed in 2216 ms
lip 15, 2016 11:48:26 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deployment of configuration descriptor C:\Users\Mateusz\Documents\workspace-sts-3.7.3.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\DebtDetector.xml has finished in 10,289 ms
lip 15, 2016 11:48:26 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
lip 15, 2016 11:48:26 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
lip 15, 2016 11:48:26 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 11162 ms
lip 15, 2016 11:48:26 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/DebtDetector/] in DispatcherServlet with name 'mvc-dispatcher'
Try this.
Defining class-level request handling
#Controller
#RequestMapping("/index")
public class ControllerAccount {
public String welcomePage(){
System.out.println("aa");
return "index";
}
}
OR Defining method-level GET request handling
#Controller
public class ControllerAccount {
#RequestMapping(value="/index", method=GET)
public String welcomePage(){
System.out.println("aa");
return "index";
}
}
Use :
#Controller
public class ControllerAccount {
#RequestMapping(value = "/index", method = RequestMethod.GET)
public String welcomePage(){
System.out.println("aa");
return "index";
}
}

Simple Web App using PostgreSQL and Tomcat

I'm trying to follow a tutorial to make a simple web application using PostgreSQL as db with Hibernate, Tomcat as server and Eclipse as IDE.
The user should enter name, surname and country to a simple form
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>My first Web App</title>
</head>
<body>
<h1>Let's create a new user</h1>
<form method="POST" action = "CreateUser.do">
First Name <input type = "text" size = "40" maxlength = "40" name = "firstname" /><br/>
Last Name <input type = "text" size = "40" maxlength = "40" name = "lastname" /><br/>
Country <input type = "text" size = "40" maxlength = "40" name = "country" /><br/>
<input type = "submit" value = "create" >
</form>
</body>
</html>
Then I have AddUser.java as Controller in the Model View Controller pattern
package controller;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import model.User;
/**
* Servlet implementation class AddUser
*/
#WebServlet(description = "Create new user Servlet", urlPatterns = {"/CreateUser.do"})
public class AddUser extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/*
RequestDispatcher view = request.getRequestDispatcher("useradd.jsp");
view.forward(request, response);
*/
Configuration config = new Configuration().configure();
ServiceRegistry servReg = new StandardServiceRegistryBuilder().applySettings(config.getProperties()).build();
SessionFactory factory = config.buildSessionFactory(servReg);
Session session = factory.openSession();
session.beginTransaction();
User u = new User(request.getParameter("firstname"),
request.getParameter("lastname"),
request.getParameter("country"));
session.save(u);
session.getTransaction().commit();
session.close();
RequestDispatcher view = request.getRequestDispatcher("useradd.jsp");
view.forward(request, response);
}
}
And User.java as Model
package model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
#Entity
#Table( name = "users")
public class User {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name="user_id", nullable=false, unique=true)
private int id;
#Column(name="firstname", length=40, nullable=false)
private String firstname;
#Column(name="lastname", length=40, nullable=false)
private String lastname;
#Column(name="country", length=40, nullable=true)
private String country;
public User(String firstName, String lastName, String country) {
firstname = firstName;
lastname = lastName;
this.country = country;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFirstName() {
return firstname;
}
public void setFirstName(String firstName) {
this.firstname = firstName;
}
public String getLastName() {
return lastname;
}
public void setLastName(String lastName) {
this.lastname = lastName;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
}
Lastly, useradd.jsp acts as view and should show the data written in the DB.
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>My first Web App - New User Created!</title>
</head>
<body>
<h1>New User Created</h1>
<p>
First Name: <% String fName = request.getParameter("firstname"); out.print(fName); %> <br/>
Last Name: <% String lName = request.getParameter("lastname"); out.print(lName); %> <br/>
Country: <% String country = request.getParameter("country"); out.print(country); %> <br/>
</p>
</body>
</html>
I've also made the hibernate.cfg.xml file in the /src folder
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/firstapp</property>
<property name="hibernate.connection.username">postgres</property>
<property name="hibernate.connection.password">admin</property>
<property name="show_sql">false</property>
<mapping class="model.User"/>
</session-factory>
</hibernate-configuration>
I can run the application, type in first name/last name/country but, when I press create, it shows this error: HTTP Status 500 - Unknown entity: model.User
Of course it doesn't write anything to the DB.
This is what the console shows:
mag 13, 2016 7:20:44 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
AVVERTENZA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:2 - Hibernate' did not find a matching property.
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Server version: Apache Tomcat/8.0.33
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Server built: Mar 18 2016 20:31:49 UTC
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Server number: 8.0.33.0
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: OS Name: Windows 10
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: OS Version: 10.0
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Architecture: x86
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Java Home: C:\Program Files (x86)\Java\jre1.8.0_91
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: JVM Version: 1.8.0_91-b14
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: JVM Vendor: Oracle Corporation
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: CATALINA_BASE: C:\Users\Antonio\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: CATALINA_HOME: C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Dcatalina.base=C:\Users\Antonio\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Dcatalina.home=C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Dwtp.deploy=C:\Users\Antonio\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Djava.endorsed.dirs=C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\endorsed
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Dfile.encoding=Cp1252
mag 13, 2016 7:20:44 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAZIONI: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jre1.8.0_91\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files (x86)/Java/jre1.8.0_91/bin/client;C:/Program Files (x86)/Java/jre1.8.0_91/bin;C:/Program Files (x86)/Java/jre1.8.0_91/lib/i386;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\Antonio\Desktop\eclipse;;.
mag 13, 2016 7:20:44 PM org.apache.coyote.AbstractProtocol init
INFORMAZIONI: Initializing ProtocolHandler ["http-nio-8080"]
mag 13, 2016 7:20:44 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAZIONI: Using a shared selector for servlet write/read
mag 13, 2016 7:20:44 PM org.apache.coyote.AbstractProtocol init
INFORMAZIONI: Initializing ProtocolHandler ["ajp-nio-8009"]
mag 13, 2016 7:20:44 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAZIONI: Using a shared selector for servlet write/read
mag 13, 2016 7:20:44 PM org.apache.catalina.startup.Catalina load
INFORMAZIONI: Initialization processed in 1448 ms
mag 13, 2016 7:20:44 PM org.apache.catalina.core.StandardService startInternal
INFORMAZIONI: Starting service Catalina
mag 13, 2016 7:20:44 PM org.apache.catalina.core.StandardEngine startInternal
INFORMAZIONI: Starting Servlet Engine: Apache Tomcat/8.0.33
mag 13, 2016 7:20:45 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFORMAZIONI: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [199] milliseconds.
mag 13, 2016 7:20:46 PM org.apache.jasper.servlet.TldScanner scanJars
INFORMAZIONI: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
mag 13, 2016 7:20:46 PM org.apache.coyote.AbstractProtocol start
INFORMAZIONI: Starting ProtocolHandler ["http-nio-8080"]
mag 13, 2016 7:20:46 PM org.apache.coyote.AbstractProtocol start
INFORMAZIONI: Starting ProtocolHandler ["ajp-nio-8009"]
mag 13, 2016 7:20:46 PM org.apache.catalina.startup.Catalina start
INFORMAZIONI: Server startup in 1935 ms
mag 13, 2016 7:21:06 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.1.0.Final}
mag 13, 2016 7:21:06 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
mag 13, 2016 7:21:06 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
mag 13, 2016 7:21:07 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
mag 13, 2016 7:21:08 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
mag 13, 2016 7:21:08 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [org.postgresql.Driver] at URL [jdbc:postgresql://localhost:5432/firstapp]
mag 13, 2016 7:21:08 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {user=postgres, password=****}
mag 13, 2016 7:21:08 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
mag 13, 2016 7:21:08 PM org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
mag 13, 2016 7:21:08 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
mag 13, 2016 7:21:09 PM org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl useContextualLobCreation
INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
mag 13, 2016 7:21:09 PM org.hibernate.type.BasicTypeRegistry register
INFO: HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType#bfbdad
mag 13, 2016 7:21:10 PM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet [controller.AddUser] in context with path [/2_-_Hibernate] threw exception
org.hibernate.MappingException: Unknown entity: model.User
at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:776)
at org.hibernate.internal.SessionImpl.getEntityPersister(SessionImpl.java:1533)
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:104)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192)
at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:177)
at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73)
at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:682)
at org.hibernate.internal.SessionImpl.save(SessionImpl.java:674)
at org.hibernate.internal.SessionImpl.save(SessionImpl.java:669)
at controller.AddUser.doPost(AddUser.java:48)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
I've been stuck for hours and cannot find any solution.
Hope you guys can help me. Thanks in advance!
If you are using Hiberanate 5, please create Session factory in this way:
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
instead of
Configuration config = new Configuration().configure();
ServiceRegistry servReg = new StandardServiceRegistryBuilder().applySettings(config.getProperties()).build();
SessionFactory factory = config.buildSessionFactory(servReg);

Not able to expose a web service properly in JAVA

This is the part of my pom.xml which shows the build :
<build>
<finalName>services</finalName>
<plugins>
<!-- Enabling and configuring web resources filtering -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>web.xml</exclude>
</excludes>
</resource>
</resources>
</build>
My Web.xml looks like this :
<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_3_0.xsd"
version="3.0" metadata-complete="true">
<display-name>services</display-name>
<!-- location of spring xml files. Context-param helps you store the param name and value globally -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<!-- the listener that kick-starts Spring -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>Rest service</servlet-name>
<servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.application.newsfeed.svc</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- URL patterns -->
<servlet-mapping>
<servlet-name>Rest service</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
My applicationContext.xml looks like :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<bean
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject">
<bean
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="java.lang.System" />
<property name="targetMethod" value="getProperties" />
</bean>
</property>
<property name="targetMethod" value="putAll" />
<property name="arguments">
<!-- The new Properties -->
<util:properties>
<prop key="jsse.enableSNIExtension">false</prop>
</util:properties>
</property>
</bean>
<bean id="userValidation" class = "com.application.newsfeed.dao.impl.ReqValidationDaoImpl" />
<bean id="newsfeed" class = "com.application.newsfeed.business.impl.newsfeedBusiness" />
<bean id = "transform" class = "com.application.newsfeed.response.impl.transformResponsetoJSON" />
<bean id = "getNewsfeeddao" class = "com.application.newsfeed.dao.impl.getNewsfeedDaoImpl" />
<bean id = "getNewsfeed" class = "com.application.newsfeed.svc.getNewsfeed" />
<bean id="appDataSource" class = "org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/db" />
<property name="username" value="root" />
<property name="password" value="sdds" />
<property name="removeAbandoned" value="true" />
<property name="removeAbandonedTimeout" value="60" />
<property name="initialSize" value="20" />
<property name="maxActive" value="30" />
</bean>
<bean id="appJdbcTemplate" class = "org.springframework.jdbc.core.JdbcTemplate">
<constructor-arg ref = "appDataSource"> </constructor-arg>
</bean>
</beans>
And In the package com.application.newsfeed.svc , I have a class getNewsfeed:
#Service
#Path("/newsfeed/{username}")
public class getNewsfeed {
#Autowired
private ItransformResponsetoJSON transform;
#Autowired
private InewsfeedBusiness newsfeed;
#GET
public Response getNewsfeed(#PathParam("username") String username, #QueryParam("page") int page) {
GetNewsfeedRequestParam requestParams = null;
Response response = null;
try{
requestParams = new GetNewsfeedRequestParam(username,page);
new GetNewsfeedRequestValidator().validateRequest();
List<Newsfeed> newsfeedResponse = newsfeed.getNewsfeed(requestParams);
}catch(Exception e){
}
return null;
}
}
When I run the application on server, this is my console log :
Apr 12, 2016 10:43:50 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:app' did not find a matching property.
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.67
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Dec 7 2015 13:07:11 UTC
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.67.0
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Mac OS X
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.10.5
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: x86_64
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: /Library/Java/JavaVirtualMachines/jdk1.8.0_71.jdk/Contents/Home/jre
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_71-b15
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /Users/pgoel/Documents/workspace-sts-3.7.2.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /Users/pgoel/Downloads/apache-tomcat-7.0.67
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/Users/pgoel/Documents/workspace-sts-3.7.2.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/Users/pgoel/Downloads/apache-tomcat-7.0.67
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=/Users/pgoel/Documents/workspace-sts-3.7.2.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/Users/pgoel/Downloads/apache-tomcat-7.0.67/endorsed
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Apr 12, 2016 10:43:50 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/pgoel/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Apr 12, 2016 10:43:50 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Apr 12, 2016 10:43:50 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 471 ms
Apr 12, 2016 10:43:50 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 12, 2016 10:43:50 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.67
Apr 12, 2016 10:43:51 AM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Apr 12, 2016 10:43:51 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Apr 12, 2016 10:43:51 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Apr 12, 2016 10:43:51 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Apr 12, 2016 10:43:51 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Tue Apr 12 10:43:51 IST 2016]; root of context hierarchy
Apr 12, 2016 10:43:51 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
Apr 12, 2016 10:43:51 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#3af05cbe: defining beans [org.springframework.beans.factory.config.MethodInvokingFactoryBean#0,userValidation,newsfeed,transform,getNewsfeeddao,getNewsfeed,curofyDataSource,curofyJdbcTemplate]; root of factory hierarchy
Apr 12, 2016 10:43:51 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 300 ms
Apr 12, 2016 10:43:51 AM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
com.application.newsfeed.svc
Apr 12, 2016 10:43:51 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
class com.application.newsfeed.svc.getNewsfeed
Apr 12, 2016 10:43:51 AM com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
Apr 12, 2016 10:43:51 AM com.sun.jersey.spi.spring.container.servlet.SpringServlet getContext
INFO: Using default applicationContext
Apr 12, 2016 10:43:51 AM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
INFO: Registering Spring bean, getNewsfeed, of type com.application.newsfeed.svc.getNewsfeed as a root resource class
Apr 12, 2016 10:43:51 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.17 01/17/2013 03:31 PM'
Apr 12, 2016 10:43:52 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Apr 12, 2016 10:43:52 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Apr 12, 2016 10:43:52 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1473 ms
Now when I hit the url :
http://localhost:8080/services/newsfeed/pgoel2?page=1
I get 404. Can somebody please help me as to where I am going wrong?

Spring mapping failing: HTTP Status 404 (The requested resource is not available)

I know there are millions of possible solutions to this, and I tried many of them, but still no benefit at all.
I am trying to map a basic controller to a url and returning a JSP view. Its showing HTTP Status 404 with description The requested resource is not available. Please help.
Controller
package controllers;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
#Controller
public class HomePageController {
#RequestMapping(value = "/twenty-eight/index", method = RequestMethod.GET)
public ModelAndView homePage(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse){
ModelAndView mav = new ModelAndView("HomePage");
System.out.println("Going to index page...");
return mav;
}
}
web.xml
<web-app id="WebApp_ID" version="2.4"
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">
<display-name>Spring Web MVC Application</display-name>
<servlet>
<servlet-name>dispatcher-servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher-servlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
servlet-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="controllers" />
<mvc:annotation-driven />
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
JSP View
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Login</title>
<link rel="stylesheet" href="CSS/normalize.css">
<link rel="stylesheet" href="CSS/style.css">
</head>
<body>
<h1>Working Fine</h1>
</body>
</html>
Tomcat logs
Aug 02, 2015 7:16:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Twenty Eight' did not find a matching property.
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.21
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Mar 23 2015 14:11:21 UTC
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.21.0
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Linux
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 3.16.0-44-generic
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: /usr/local/java/jdk1.8.0_40/jre
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_40-b26
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /home/kaustubh/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /var/local/apache-tomcat-8.0.21
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/home/kaustubh/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/var/local/apache-tomcat-8.0.21
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=/home/kaustubh/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/var/local/apache-tomcat-8.0.21/endorsed
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Aug 02, 2015 7:16:04 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Aug 02, 2015 7:16:04 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Aug 02, 2015 7:16:04 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Aug 02, 2015 7:16:04 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Aug 02, 2015 7:16:04 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 989 ms
Aug 02, 2015 7:16:04 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Aug 02, 2015 7:16:04 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.21
Aug 02, 2015 7:16:06 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Aug 02, 2015 7:16:06 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Aug 02, 2015 7:16:07 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher-servlet'
Aug 02, 2015 7:16:07 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'dispatcher-servlet': initialization started
Aug 02, 2015 7:16:07 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'dispatcher-servlet-servlet': startup date [Sun Aug 02 19:16:07 IST 2015]; root of context hierarchy
Aug 02, 2015 7:16:07 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/servlet-context.xml]
Aug 02, 2015 7:16:08 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFO: Mapped "{[/twenty-eight/index],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView controllers.HomePageController.homePage(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
Aug 02, 2015 7:16:09 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for #ControllerAdvice: WebApplicationContext for namespace 'dispatcher-servlet-servlet': startup date [Sun Aug 02 19:16:07 IST 2015]; root of context hierarchy
Aug 02, 2015 7:16:09 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for #ControllerAdvice: WebApplicationContext for namespace 'dispatcher-servlet-servlet': startup date [Sun Aug 02 19:16:07 IST 2015]; root of context hierarchy
Aug 02, 2015 7:16:09 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'dispatcher-servlet': initialization completed in 1772 ms
Aug 02, 2015 7:16:09 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Aug 02, 2015 7:16:09 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Aug 02, 2015 7:16:09 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4680 ms
Project Structure
https://drive.google.com/open?id=0B2s3KIDgKxy8RlVqZmdneW9WV1U

Categories

Resources