Home >Java >javaTutorial >What should I do if there is an error when tomcat loads the war package?

What should I do if there is an error when tomcat loads the war package?

怪我咯
怪我咯Original
2017-06-25 10:13:002299browse

Try to use springmvc, mybatis, mysql as a tool platform.

It runs normally on the local mac laptop, but when I place the package on the server and start tomcat, an error is reported. Class not found.

File Directory:

Implementation requirements: Upload documents and record them in the database. Created the DocFile class by itself. Create the corresponding mapper file and write the sql statement.

The namespace in mapper.xml points to DocFileDao.

<mapper namespace="com.bbc_kit.operation.dao.DocFileDao"><!-- namespace 需要和dao层的"包名+接口名"一致 --><resultMap type="com.bbc_kit.operation.entities.DocFile" id="DocFileResult"><id property="docFileId" column="docFileId" jdbcType="VARCHAR"/><result property="docFileType" column="docFileType" jdbcType="VARCHAR"/><result property="docFileName" column="docFileName" jdbcType="VARCHAR"/><result property="docFilePath" column="docFilePath" jdbcType="VARCHAR"/><result property="created_by" column="created_by" jdbcType="VARCHAR"/><result property="date_created" column="date_created" jdbcType="DATE"/><result property="updated_by" column="updated_by" jdbcType="VARCHAR"/><result property="date_updated" column="date_updated" jdbcType="DATE"/><result property="valiable" column="valiable" jdbcType="VARCHAR"/></resultMap><select id="queryOptDocFile" parameterType="HashMap" resultMap="DocFileResult">select * from t_docfile where docFileType=#{docFileType}  and valiable='Y'</select><update id="updateInvalidDocFile" parameterType="String" >update t_docfile set valiable='N' where docFileId=#{docFileId}</update><select id="getDocFile" parameterType="String" resultType="DocFile">select * from t_docfile where  docFileId=#{docFileId}</select>

But after starting, it inexplicably reported that the DocFile class could not be found. And there is an exclamation mark after the war package in the prompted path.

Later I found out that I was careless in the class reference of the mapper file. I did not add

<select id="getDocFile" parameterType="String" resultType="DocFile">select * from t_docfile where  docFileId=#{docFileId}</select>

to the complete package path and changed it to

<select id="getDocFile" parameterType="String" resultType="com.bbc_kit.operation.entities.DocFile">select * from t_docfile where  docFileId=#{docFileId}</select>

It will be normal if you package and upload it and restart it. The reason why the local environment does not report an error is that some configurations within the environment are messed up and do not appear.

The above is the detailed content of What should I do if there is an error when tomcat loads the war package?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn