java 报错问题常见解决方案

2019年8月1日

** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.

-----------------------------

新建一个package,启动类放到里面。

 

2019年8月12日

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.cloud.netfli

--------------------------------------------------------

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

没有加这个依赖

 

2019年8月14日

: insert into enjoy_user ( passwd, username ) values ( ?, ? ) ### Cause: java.sql.SQLException: Field 'id' doesn't have a default value ; Field 'id' doesn't have a default value; nested exception is java.sql.SQLException: Field 'id' doesn't have a default value

---------------------------------------------------------------------------------------------------

打开navicat,右键表,设置id为自增长即可。

 

2019年8月17日

idea修改了工程名或项目名。

几个地方要跟着修改

1、pom文件

<groupId>com.tx</groupId>
    <artifactId>springboot_enjoy_02</artifactId>
    <version>1.0-SNAPSHOT</version>

2、.idea下面的compile.xml文件

    <annotationProcessing>
      <profile name="Maven default annotation processors profile" enabled="true">
        <sourceOutputDir name="target/generated-sources/annotations" />
        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
        <outputRelativeToContentRoot value="true" />
        <module name="springboot_enjoy_02" />
      </profile>
    </annotationProcessing>

3、File 下面的project Strucure

idea的 file→project structure 设置

2019年8月17日

---------------------------------------------------------------------------------------------------------------------

.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration.propertySourcesPlaceholderConfigurer、

 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <!--打包的时候可以不用包进去,别的设施会提供。事实上该依赖理论上可以参与编译,测试,运行等周期。
                相当于compile,但是打包阶段做了exclude操作-->
            <scope>provide修改为compile即可</scope>
        </dependency>

2019年8月19日

org.apache.catalina.LifecycleException: Protocol handler initialization failed

--------------------------------------------------------------------------------------------------------------------

bind被占用,关掉就好了

 

2019年8月24日

com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect

--------------------------------

eureka:
  instance: # eureak实例定义
    hostname: localhost # 定义 Eureka 实例所在的主机名称
  client:
    fetch-registry: false
    register-with-eureka: false

后面两个false,禁止自己注册自己,就解决了。

----------------------------------------------------------------------------------

日期2019年8月27日

Exception in thread "main" org.apache.ibatis.binding.BindingException: Type interface com.tx.pojo.EmployeeDAO is not known to the MapperRegistry.

--------------------

conf.xml 里面找   <mapper resource="mapping/EmployeeDAO.xml"/> ,然后再找 EmployeeDAO.xml

命名空间问题,dao下面com.tx.dao.EmployeeDAO"

<mapper namespace="com.tx.dao.EmployeeDAO">
  
  <select id="selectEmpById" resultType="com.tx.pojo.Employee">
    SELECT * FROM EMPLOYEE WHERE ID=#{id}
  </select>

 

日期2019年8月27日

 8; 与元素类型 "select" 相关联的属性名 "SELECT" 必须后跟 ' = ' 字符。

-------------------------------------------------------------------------------------------

解决方案:select 后面要加 括号>

 

日期2019年8月29日

Cause: org.apache.ibatis.binding.BindingException: Parameter 'id' not found. Available parameters are [0, 1, param1, param2]

------------------------------------------------------

解决方案:    public Employee selecttest(@Param("id")int id,@Param("lastName")String lastName);

 

2019年9月7日

validateJarFile(F:\apache-tomcat-7.0.94\webapps\ROOT\WEB-INF\lib\javaee-api-7.0.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
九月 07, 2019 9:27:46 上午 org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
信息: validateJarFile(F:\apache-tomcat-7.0.94\webapps\ROOT\WEB-INF\lib\jsp-api-2.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
九月 07, 2019 9:27:47 上午 org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
信息: validateJarFile(F:\apache-tomcat-7.0.94\webapps\ROOT\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class

--------------------------------------------------------------------------------------

直接删掉javaee-api-7.0.jar jsp-api-2.1.jar  servlet-api-2.5.jar 这几个jar包就好了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值