服务器Mysql:log(2020-1-19 18:33:25)并且发布SSM项目至服务器.或者本地运行测试.

MySQL [(none)]> create database github;
Query OK, 1 row affected (0.01 sec)

MySQL [(none)]> source /root/sql.sql
Database changed
ERROR 1051 (42S02): Unknown table 'github.user'
Query OK, 0 rows affected (0.04 sec)

Query OK, 0 rows affected (0.02 sec)

Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.02 sec)

ERROR 1215 (HY000): Cannot add foreign key constraint
ERROR 1215 (HY000): Cannot add foreign key constraint
ERROR 1215 (HY000): Cannot add foreign key constraint
ERROR 1215 (HY000): Cannot add foreign key constraint
Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.02 sec)

Query OK, 0 rows affected (0.02 sec)

Query OK, 1 row affected (0.00 sec)

有错误?重新执行.

MySQL [github]> source /root/sql.sql
Database changed
ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
ERROR 1050 (42S01): Table 'user' already exists
ERROR 1050 (42S01): Table 'appointment' already exists
ERROR 1061 (42000): Duplicate key name 'idx_appoint_time'
ERROR 1050 (42S01): Table 'book' already exists
ERROR 1050 (42S01): Table 'identity' already exists
ERROR 1215 (HY000): Cannot add foreign key constraint
Query OK, 0 rows affected (0.02 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.02 sec)

ERROR 1050 (42S01): Table 'species' already exists
ERROR 1050 (42S01): Table 'store' already exists
ERROR 1050 (42S01): Table 'storeregistration' already exists
ERROR 1062 (23000): Duplicate entry 'xxx' for key 'PRIMARY'
MySQL [github]> source /root/sql.sql
Database changed
ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
ERROR 1050 (42S01): Table 'user' already exists
ERROR 1050 (42S01): Table 'appointment' already exists
ERROR 1061 (42000): Duplicate key name 'idx_appoint_time'
ERROR 1050 (42S01): Table 'book' already exists
ERROR 1050 (42S01): Table 'identity' already exists
Query OK, 0 rows affected (0.01 sec)

ERROR 1050 (42S01): Table 'petrelease' already exists
ERROR 1050 (42S01): Table 'pettrading' already exists
ERROR 1050 (42S01): Table 'pettradinglist' already exists
ERROR 1050 (42S01): Table 'species' already exists
ERROR 1050 (42S01): Table 'store' already exists
ERROR 1050 (42S01): Table 'storeregistration' already exists
ERROR 1062 (23000): Duplicate entry 'xxx' for key 'PRIMARY'

执行三次.

MySQL [github]> source /root/sql.sql
Database changed
ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
ERROR 1050 (42S01): Table 'user' already exists
ERROR 1050 (42S01): Table 'appointment' already exists
ERROR 1061 (42000): Duplicate key name 'idx_appoint_time'
ERROR 1050 (42S01): Table 'book' already exists
ERROR 1050 (42S01): Table 'identity' already exists
ERROR 1050 (42S01): Table 'petdetails' already exists
ERROR 1050 (42S01): Table 'petrelease' already exists
ERROR 1050 (42S01): Table 'pettrading' already exists
ERROR 1050 (42S01): Table 'pettradinglist' already exists
ERROR 1050 (42S01): Table 'species' already exists
ERROR 1050 (42S01): Table 'store' already exists
ERROR 1050 (42S01): Table 'storeregistration' already exists
ERROR 1062 (23000): Duplicate entry 'xxx' for key 'PRIMARY'

执行四次.
第五次.同第四次.应该完全执行了.
(2020-1-19 18:38:44)
在这里插入图片描述

Results :

Tests in error: 
  initializationError(com.manager.BaseTest): No runnable methods
  testSelectAllByStoreid(com.manager.dao.PetreleaseMapperTest): Failed to load ApplicationContext
  testInsertSelective(com.manager.dao.PetreleaseMapperTest): Failed to load ApplicationContext
  testSelectBySearch(com.manager.dao.PetreleaseMapperTest): Failed to load ApplicationContext
  testGetAllBystoreid(com.manager.dao.PetshowMapperTest): Failed to load ApplicationContext
  testSelectAllNotBuy(com.manager.dao.PettradingMapperTest): Failed to load ApplicationContext
  testSelectByName(com.manager.dao.SpeciesMapperTest): Failed to load ApplicationContext
  testSelectAll(com.manager.dao.SpeciesMapperTest): Failed to load ApplicationContext
  testgetallstore(com.manager.dao.StoreMapperTest): Failed to load ApplicationContext
  testinsert(com.manager.dao.StoreRegistrationMapperTest)
  testinsert(com.manager.dao.UserMapperTest)
  testselectByPrimaryKey(com.manager.dao.UserMapperTest)
  testDeteleaction(com.manager.service.impl.PetServiceImplTest): Failed to load ApplicationContext
  testGetPetInfoByPetid(com.manager.service.impl.PetServiceImplTest): Failed to load ApplicationContext
  testGetAllPetInfoNotBuy(com.manager.service.impl.PetServiceImplTest): Failed to load ApplicationContext
  petreleaseaction(com.manager.service.impl.PetServiceImplTest): Failed to load ApplicationContext
  testGetAllPetInfoByStoreid(com.manager.service.impl.PetServiceImplTest): Failed to load ApplicationContext
  register(com.manager.service.impl.StoreServiceImplTest): Failed to load ApplicationContext
  testGetStoreidByUserid(com.manager.service.impl.StoreServiceImplTest): Failed to load ApplicationContext
  verify(com.manager.service.impl.UserServiceImplTest): Failed to load ApplicationContext
  testregister(com.manager.service.impl.UserServiceImplTest): Failed to load ApplicationContext
  testGetAll(com.manager.service.SpeciesServiceTest): Failed to load ApplicationContext
  mystore(com.manager.web.StoreControllerTest): Failed to load ApplicationContext

Tests run: 24, Failures: 0, Errors: 23, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.910 s
[INFO] Finished at: 2020-01-19T18:40:14+08:00
[INFO] Final Memory: 24M/84M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project ssm: There are test failures.
[ERROR] 
[ERROR] Please refer to E:\AllProjects\GitProjects\Java\git项目\github\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] Maven execution terminated abnormally (exit code 1)

大概都是测试的错误.?

testGetAllPetInfoNotBuy(com.manager.service.impl.PetServiceImplTest)  Time elapsed: 0 sec  <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext

也有这种没错的?

Running com.manager.entity.PetshowTest
Petshow(petid=1, storeid=�ҵĵ�, petdetails=com.manager.entity.Petdetails@b2f4ece, petrelease=com.manager.entity.Petrelease@7e1f584d, pettrading=com.manager.entity.Pettrading@7dff6d05)
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
Running com.manager.service.impl.PetServiceImplTest
Running com.manager.dao.StoreRegistrationMapperTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec <<< FAILURE!
testinsert(com.manager.dao.StoreRegistrationMapperTest)  Time elapsed: 0 sec  <<< ERROR!
java.lang.NullPointerException

空指针异常.?

1�� 19, 2020 6:40:10 ���� org.springframework.context.support.GenericApplicationContext refresh
����: Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring/spring-dao.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\AllProjects\GitProjects\Java\git��Ŀ\github\target\classes\mapper\pettradinglistMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.soecode.lyf.dao.pettradinglistMapper.BaseResultMap

最上面的错误?

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.manager.BaseTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.19 sec <<< FAILURE!
initializationError(com.manager.BaseTest)  Time elapsed: 0.008 sec  <<< ERROR!
java.lang.Exception: No runnable methods
	at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:169)
	at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:104)
	at org.junit.runners.ParentRunner.validate(ParentRunner.java:355)
	at org.junit.runners.ParentRunner.<init>(ParentRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:57)	
"D:\Program Files\Java\jdk-11.0.2\bin\java.exe" -Dmaven.multiModuleProjectDirectory=E:\AllProjects\GitProjects\Java\git项目\github "-Dmaven.home=D:\Program Files\JetBrains\IntelliJ IDEA 2018.3.4\plugins\maven\lib\maven3" "-Dclassworlds.conf=D:\Program Files\JetBrains\IntelliJ IDEA 2018.3.4\plugins\maven\lib\maven3\bin\m2.conf" -Dfile.encoding=UTF-8 -classpath "D:\Program Files\JetBrains\IntelliJ IDEA 2018.3.4\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2018.3.4 clean install

和错误有关?
(2020-1-19 19:04:17)

[INFO] --- mybatis-generator-maven-plugin:1.3.5:generate (Generate MyBatis Artifacts) @ ssm ---
[INFO] Connecting to the Database
[INFO] Introspecting table pettradinglist
[INFO] Generating Record class for table pettradinglist
[INFO] Generating Mapper Interface for table pettradinglist
[INFO] Generating SQL Map for table pettradinglist
[INFO] Saving file pettradinglistMapper.xml
[INFO] Saving file pettradinglist.java
[INFO] Saving file pettradinglistMapper.java
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ ssm ---
[INFO] Surefire report directory: E:\AllProjects\GitProjects\Java\git项目\github\target\surefire-reports

这个?
测试结果文档.?分文件.?
(2020-1-19 19:07:24)
那么.如何跳过测试.?
todo(2020-1-19 19:08:32)

报错相关的一段代码.
(2020-1-19 19:10:46)

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="configLocation" value="classpath:mybatis-config.xml" />
		<property name="typeAliasesPackage" value="com.manager.entity" />
		<property name="mapperLocations" value="classpath:mapper/*.xml" />
		<property name="plugins">
			<array>
				<bean class="com.github.pagehelper.PageInterceptor">
					<property name="properties">
						<value>
							params=value1
						</value>
					</property>
				</bean>
			</array>
		</property>
	</bean>
1�� 19, 2020 6:40:07 ���� org.springframework.context.support.GenericApplicationContext refresh
����: Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring/spring-dao.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\AllProjects\GitProjects\Java\git��Ŀ\github\target\classes\mapper\pettradinglistMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.soecode.lyf.dao.pettradinglistMapper.BaseResultMap

pettradinglistMapper.xml

扫描二维码关注公众号,回复: 8831657 查看本文章

相关文件?(2020-1-19 19:12:36)

原因的最下层.

Result Maps collection already contains value for com.soecode.lyf.dao.pettradinglistMapper.BaseResultMap

找到了项目模板源文件.

李奕锋博客

todo如何让项目运行.不执行Test方法.

不进行测试.(2020-1-19 19:17:06)
需要对项目.重新研究.解构.重新花时间.(2020-1-19 19:18:29)

第二种方法:Upload File

(2020-1-19 19:20:43)

[INFO] Deployment File is Uploading...
[ERROR] Upload Deployment File to OSS Failed
file not exist.path:E:\AllProjects\GitProjects\Java\git项目\github\target\ssm.war
open terminal

在这里插入图片描述
target下面都是这个.(2020-1-19 19:22:17)?
解压缩版的?

删除target重新build还是如此.
(2020-1-19 19:27:08)
可能是war exploded的原因?

exploded:爆炸了的;分解的;被破除的

在这里插入图片描述
使用这个.(2020-1-19 19:29:48)
好的.已经产生了.ssm.war文件.
上传.(2020-1-19 19:30:33)
上传成功.重启Tomcat.
(2020-1-19 19:31:46)

如何将新的Tomcat绑定到service以便使用service tomcat restart功能.

(2020-1-19 19:32:30)
在这里插入图片描述
似乎.不需要.已经自动解压.(2020-1-19 19:33:32)

浏览器访问,看到了一系列的错误.

(2020-1-19 19:35:35)

HTTP Status 500 – Internal Server Error
Type 异常报告

消息 Servlet.init() for servlet [mvc-dispatcher] threw exception

描述 服务器遇到一个意外的情况,阻止它完成请求。

Exception

javax.servlet.ServletException: Servlet.init() for servlet [mvc-dispatcher] threw exception
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
	org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598)
	org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.base/java.lang.Thread.run(Thread.java:834)
Root Cause

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring/spring-dao.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [/usr/local/apache-tomcat-9.0.30/webapps/ssm/WEB-INF/classes/mapper/pettradinglistMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.soecode.lyf.dao.pettradinglistMapper.BaseResultMap
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:736)
	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
	org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:664)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:630)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:678)
	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:549)
	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:490)
	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
	javax.servlet.GenericServlet.init(GenericServlet.java:158)
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
	org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598)
	org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh

和刚才在IDEA中在这里插入图片描述运行错误差不多.
但是本机用IDEA启动的Tomcat可以运行.(2020-1-19 19:37:32)

重新打包之后.本地服务器.也出现了同样的错误.?(2020-1-19 19:54:12)
在这里插入图片描述
放弃.开始新的项目.
最简单的数据库+Springboot.(2020-1-19 19:54:42)

war和war exploded简单区别

(2020-1-19 19:59:56)

发布了65 篇原创文章 · 获赞 16 · 访问量 5038

猜你喜欢

转载自blog.csdn.net/gwdfff/article/details/104044053