相关疑难解决方法(0)

ApplicationContextException:由于缺少ServletWebServerFactory bean,无法启动ServletWebServerApplicationContext

我使用Spring启动编写了一个Spring批处理应用程序.当我尝试在本地系统上使用命令行和类路径运行该应用程序时,它运行正常.但是,当我试图在Linux服务器上运行它时,它给了我以下异常

Unable to start web server; nested exception is
org.springframework.context.ApplicationContextException: 
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
Run Code Online (Sandbox Code Playgroud)

以下是我运行它的方式:

java -cp jarFileName.jar; lib\* -Dlogging.level.org.springframework=DEBUG -Dspring.profiles.active=dev -Dspring.batch.job.names=abcBatchJob com.aa.bb.StartSpringBatch > somelogs.log
Run Code Online (Sandbox Code Playgroud)

spring spring-batch spring-boot

25
推荐指数
9
解决办法
6万
查看次数

Spring Boot应用程序可以通过Maven运行,但不能通过IDE Intellij IDEA运行

我有一个弹簧启动应用程序,通过Maven的mvn spring-boot:run命令运行良好.但是,当我尝试通过IDE(在我的情况下是Intellij IDEA 2017.2.1)中运行它时,它失败了,因为它不能@Autowire是数据源.

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in com.myApp.Application required a bean of type 'javax.sql.DataSource' that could not be found.


Action:

Consider defining a bean of type 'javax.sql.DataSource' in your configuration.
Run Code Online (Sandbox Code Playgroud)

这个代码库的原始作者有主类,它启动应用程序,接受数据源的构造函数参数,这是我不熟悉的方法,因为我习惯于通过application.properties文件执行它并让Spring Boot连接它自己的数据源.

@EnableTransactionManagement
@SpringBootApplication
@EnableCaching
public class Application extends JpaBaseConfiguration {


    protected Application(DataSource dataSource, JpaProperties properties,
            ObjectProvider<JtaTransactionManager> jtaTransactionManagerProvider,
            ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
        super(dataSource, properties, jtaTransactionManagerProvider, transactionManagerCustomizers);
    }
Run Code Online (Sandbox Code Playgroud)

在IDEA中,我注意到这个构造函数datasourceproperties参数和红色下划线.对于datasourceIDE的抱怨两个豆存在,它不知道这之间自动装配XADataSourceAutoConfiguration.class和 …

spring intellij-idea maven spring-boot

1
推荐指数
1
解决办法
750
查看次数

标签 统计

spring ×2

spring-boot ×2

intellij-idea ×1

maven ×1

spring-batch ×1