主要跳转页面为404,控制台不报错。。
下面是index.jsp页面
点击链接跳转到404
控制台部分信息(我在service类和dao类中添加了”static{System.out.print("XX========")}“这句话所以控制台有显示)
二月 20, 2017 6:32:35 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息: Loading XML bean definitions from file [C:\Users\k570\NeonWorkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\SSH-1\WEB-INF\classes\applicationContext.beans.xml] 二月 20, 2017 6:32:35 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息: Loading XML bean definitions from file [C:\Users\k570\NeonWorkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\SSH-1\WEB-INF\classes\applicationContext.xml] 二月 20, 2017 6:32:36 下午 org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties 信息: Loading properties file from class path resource [db.properties] Dao==================================== 二月 20, 2017 6:32:36 下午 com.mchange.v2.log.MLog <clinit> 信息: MLog clients using java 1.4+ standard logging. 二月 20, 2017 6:32:36 下午 com.mchange.v2.c3p0.C3P0Registry banner 信息: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10] ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console... 二月 20, 2017 6:32:39 下午 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager 信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 2vsidn9mp9rw8y17kco88|5854e24c, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 2vsidn9mp9rw8y17kco88|5854e24c, idleConnectionTestPeriod -> 0, initialPoolSize -> 5, jdbcUrl -> jdbc:mysql:///ssh, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 10, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ] Mon Feb 20 18:32:40 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Mon Feb 20 18:32:40 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Mon Feb 20 18:32:40 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Mon Feb 20 18:32:40 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Mon Feb 20 18:32:40 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. service======================================== 二月 20, 2017 6:32:42 下午 org.springframework.web.context.ContextLoader initWebApplicationContext 信息: Root WebApplicationContext: initialization completed in 6972 ms 二月 20, 2017 6:32:44 下午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler [http-nio-8080] 二月 20, 2017 6:32:44 下午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler [ajp-nio-8009] 二月 20, 2017 6:32:44 下午 org.apache.catalina.startup.Catalina start 信息: Server startup in 12652 ms
下面是项目结构
以下按照一般流程贴代码---actions.EmployeeAction(我在这个类中初始化时向控制台打印一句话,方法中也添加了,然而控制台并没有打印这个类中的任何一句话)
package actions; import java.util.Map; import org.apache.struts2.interceptor.RequestAware; import com.opensymphony.xwork2.ActionSupport; import service.EmployeeService; public class EmployeeAction extends ActionSupport implements RequestAware{ static{ System.out.println("是否进入此类?-------------------------"); } private static final long serialVersionUID = 1L; private EmployeeService employeeService; public void setEmployeeService(EmployeeService employeeService) { this.employeeService = employeeService; } public String list() { request.put("employees", employeeService.getAll()); System.out.println("====================方法被执行==================="); return "list"; } private Map<String , Object> request; @Override public void setRequest(Map<String, Object> arg0) { this.request = arg0; } }
---service.EmployeeService
package service; import java.util.List; import dao.EmployeeDao; import entity.Employee; public class EmployeeService { static{ System.out.println("service========================================"); } private EmployeeDao employeeDao; public void setEmployeeDao(EmployeeDao employeeDao) { this.employeeDao = employeeDao; } public List<Employee> getAll() { return employeeDao.getAll(); } }
---dao.EmployeeDao
package dao; import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import entity.Employee; public class EmployeeDao { static{ System.out.println("Dao===================================="); } private SessionFactory sessionFactory; public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } /**获取session,因为包含事务所以选用getCurrentSession()方法来获取 * @return */ public Session getSession(){ return this.sessionFactory.getCurrentSession(); } public List<Employee> getAll() { String hql = "FROM Employee"; return getSession().createQuery(hql).list(); } } //提问中有字数限制所以在下面提问中补充相关配置文件代码。。。。。。。。。。。。。。。。。。。。。。。。。。。
qq_意犹未尽丶_04320300
124839
慕粉4075985
慕侠7578997
相关分类