Spring HTTP 500错误(资源不能为空)

时间:2019-06-22 11:36:44

标签: spring oracle mybatis http-status-code-500

我已经使董事会需要使用Spring框架进行注册和登录。 但我不知道为什么会出现HTTP 500错误。 我真的是春天新手,我不知道该如何处理这个错误。

我正在使用spring / mvc / mybatis / oracle。

我创建了新的实例,例如: 测试A = new Test(); A.test();

围绕发生错误的代码。

但是我找不到什么具体值是空的。

错误(根本原因):

java.lang.IllegalArgumentException: Resource must not be null
    org.springframework.util.Assert.notNull(Assert.java:112)
    org.springframework.transaction.support.TransactionSynchronizationUtils.unwrapResourceIfNecessary(TransactionSynchronizationUtils.java:62)
    org.springframework.transaction.support.TransactionSynchronizationManager.getResource(TransactionSynchronizationManager.java:137)
    org.springframework.jdbc.datasource.DataSourceTransactionManager.doGetTransaction(DataSourceTransactionManager.java:182)
    org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:337)
    gu.board.MemberSvc.insertMember(MemberSvc.java:32)
    gu.board.BoardCtr.gojoinPro(BoardCtr.java:166)
    java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.base/java.lang.reflect.Method.invoke(Method.java:567)
    org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
    org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:781)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:721)
    org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

MemberSvc.java:32

@Service
public class MemberSvc {

    @Autowired
    private SqlSessionTemplate sqlSession;    
    @Autowired
    private DataSourceTransactionManager txManager = new DataSourceTransactionManager();

    /**
     * 회원정보 저장(회원가입)
     */
    public void insertMember(MemberVO param) {
        DefaultTransactionDefinition def = new DefaultTransactionDefinition();
        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
        TransactionStatus status = txManager.getTransaction(def);

        try {
            if (param.getId() == null || "".equals(param.getId())) {
                 sqlSession.insert("insertMember", param);
            } 
            txManager.commit(status);
        } catch (TransactionException ex) {
            txManager.rollback(status);
            System.out.println("데이터 저장 오류: " + ex.toString());
        }  
    }
}

BoardCtr.java:166

    /**
     * 회원 저장
     */
    @RequestMapping(value = "/gojoinPro")
    public String gojoinPro(HttpServletRequest request, MemberVO memberInfo) {
        memberSvc.insertMember(memberInfo);

        return "redirect:/boardList"; // 회원 가입 완료 페이지 만들기
    }

注册数据必须插入到oracleDB表中。 但是不能。

0 个答案:

没有答案