springboot集成seata报错Error creating bean with name ‘globalTransactionScanner‘

仔细看最后的错误,非法参数,applicationId: null,

解决:增加配置 sping.application.name=XXX,yml配置为:

spring:
  application:
    name: XXX

 

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'globalTransactionScanner' defined in class path resource [io/seata/spring/boot/autoconfigure/SeataAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: applicationId: null, txServiceGroup: my_test_tx_group
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:228) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:722) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
    at operation.OperApplication.main(OperApplication.java:12) [classes/:na]
Caused by: java.lang.IllegalArgumentException: applicationId: null, txServiceGroup: my_test_tx_group

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
可以使用JSP和Servlet来实现一个简单的笔记本功能。下面是一个简单的示例: 1. 首先,创建一个名为"index.jsp"的JSP文件,作为应用程序的入口点。在该文件中,你可以添加一个表单,用于用户输入笔记的标题和内容。例如: ```jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>笔记本</title> </head> <body> <h1>笔记本</h1> <form action="NoteServlet" method="post"> <label for="title">标题:</label> <input type="text" id="title" name="title"><br><br> <label for="content">内容:</label> <textarea id="content" name="content"></textarea><br><br> <input type="submit" value="保存"> </form> </body> </html> ``` 2. 创建一个名为"NoteServlet"的Java Servlet,用于处理表单的提交和笔记的保存。在该Servlet中,你可以使用一个ArrayList来保存笔记。例如: ```java import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class NoteServlet extends HttpServlet { private List<Note> notes = new ArrayList<>(); protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String title = request.getParameter("title"); String content = request.getParameter("content"); Note note = new Note(title, content); notes.add(note); response.sendRedirect("index.jsp"); } } ``` 3. 创建一个名为"Note"的Java类,用于表示笔记的标题和内容。例如: ```java public class Note { private String title; private String content; public Note() { } public Note(String title, String content) { this.title = title; this.content = content; } // getters and setters } ``` 这样,当用户在"index.jsp"页面填写笔记的标题和内容并点击保存按钮时,表单数据将会被提交到"NoteServlet",该Servlet会将笔记保存到"notes"列表中,并重定向回"index.jsp"页面。 请注意,这只是一个简单的实现示例,没有进行数据持久化和用户认证等功能。在实际应用中,你可能需要使用数据库来保存笔记,并添加用户认证和权限控制等功能。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值