我正在尝试启动一个简单的spring应用程序
我有主管道。java文件就在这里:
package main;
import javafx.application.Application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
@ComponentScan
@EnableAutoConfiguration
public class Main {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
这是pom。xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>blog</groupId>
<artifactId>blog</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
最后一个错误是:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.0.0.BUILD-SNAPSHOT)
[2014-02-15 11:14:25.385] - 6116 INFO [main] --- main.Main: Starting Main on Vlad-PC with PID 6116 (C:\Users\Vlad\IdeaProjects\blog\target\classes started by Vlad)
[2014-02-15 11:14:25.473] - 6116 INFO [main] --- org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext: Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2ca76650: startup date [Sat Feb 15 11:14:25 GMT 2014]; root of context hierarchy
[2014-02-15 11:14:25.579] - 6116 INFO [main] --- org.springframework.boot.logging.ClasspathLoggingApplicationListener: Application failed to start with classpath: [file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/charsets.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/deploy.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/javaws.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/jce.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/jfr.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/jfxrt.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/jsse.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/management-agent.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/plugin.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/resources.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/rt.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/ext/access-bridge-64.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/ext/dnsns.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/ext/jaccess.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/ext/localedata.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/ext/sunec.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/ext/sunjce_provider.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/ext/sunmscapi.jar, file:/C:/Program%20Files/Java/jdk1.7.0_51/jre/lib/ext/zipfs.jar, file:/C:/Users/Vlad/IdeaProjects/blog/target/classes/, file:/C:/Users/Vlad/IdeaProjects/blog/lib/com.springsource.org.apache.tomcat.api-7.0.12.jar, file:/C:/Users/Vlad/IdeaProjects/blog/lib/javax.servlet-3.0.0.v201103241009.jar, file:/C:/Users/Vlad/.m2/repository/org/springframework/spring-web/4.0.0.RELEASE/spring-web-4.0.0.RELEASE.jar, file:/C:/Users/Vlad/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/C:/Users/Vlad/.m2/repository/org/springframework/spring-aop/4.0.0.RELEASE/spring-aop-4.0.0.RELEASE.jar, file:/C:/Users/Vlad/.m2/repository/org/springframework/spring-beans/4.0.0.RELEASE/spring-beans-4.0.0.RELEASE.jar, file:/C:/Users/Vlad/.m2/repository/org/springframework/spring-core/4.0.0.RELEASE/spring-core-4.0.0.RELEASE.jar, file:/C:/Users/Vlad/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar, file:/C:/Users/Vlad/.m2/repository/org/springframework/spring-context/4.0.0.RELEASE/spring-context-4.0.0.RELEASE.jar, file:/C:/Users/Vlad/.m2/repository/org/springframework/spring-expression/4.0.0.RELEASE/spring-expression-4.0.0.RELEASE.jar, file:/C:/Users/Vlad/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.0.0.BUILD-SNAPSHOT/spring-boot-autoconfigure-1.0.0.BUILD-SNAPSHOT.jar, file:/C:/Users/Vlad/.m2/repository/org/springframework/boot/spring-boot/1.0.0.BUILD-SNAPSHOT/spring-boot-1.0.0.BUILD-SNAPSHOT.jar, file:/C:/Program%20Files%20(x86)/JetBrains/IntelliJ%20IDEA%20Community%20Edition%2013.0.2/lib/idea_rt.jar]
Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:136)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:616)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:877)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:866)
at main.Main.main(Main.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:186)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:159)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
... 12 more
据我所知我少了一颗豆子?然而,看起来好像我有罐子春豆。
我现在也有同样的错误,我只是通过在构建中包含相同版本的Spring包来解决它。渐变文件:
buildscript {
ext {
springBootVersion = '1.1.6.RELEASE'
}
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-tomcat'
compile 'org.springframework.boot:spring-boot-starter-security'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-starter-aop'
compile 'org.springframework.boot:spring-boot-starter-data-mongodb'
例如,如果您更改了其中一个包,并添加了版本号以覆盖1.1.6的静态值。RELEASE,则会显示错误:
buildscript {
ext {
springBootVersion = '1.1.6.RELEASE'
}
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-tomcat'
compile 'org.springframework.boot:spring-boot-starter-security'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-starter-aop'
compile 'org.springframework.boot:spring-boot-starter-data-mongodb:1.2.5.RELEASE'
您需要添加注释:
@SpringBootApplication
public class Main {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Spring boot尝试启动web服务器,但在类路径中找不到任何。尝试添加此依赖项
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>I Dont know</version
</dependency>
</dependencies>
顺便说一句,你的pom看起来不像一个典型的Spring开机pom!与之相比http://projects.spring.io/spring-boot/docs/README.html
Maven build成功了,但当我尝试运行它时失败了: 我有带 一切似乎都准备就绪。发生了什么? pom.xml 更新1 使用IntelliJ构建jar工件时也是如此。 更新2 好的,我设法运行了它,但现在我有: 更新3 通过添加到应用程序使其正常工作。爪哇:
我有一个新的springboot应用程序,我试图开始。 我收到的错误是 src/main/Java/bubble shadow/root controller . Java src/test/java/test/RootControllerTest.java
我已经编写了一个使用Spring Boot的Spring批处理应用程序。当我试图在本地系统上使用命令行和类路径运行该应用程序时,它运行良好。然而,当我试图在linux服务器上运行它时,它给我以下异常 下面是我运行它的方式:
尝试设置一个简单的Web应用程序调度程序。这是我的配置: 我的课程如下所示 但是当我试图启动容器时我看到了异常 我尝试遵循Spring Boot测试:由于缺少EmbeddedServletContainerFactorybean,无法启动EmbeddedWebApplicationContext,但没有成功。 谢谢你的建议
问题内容: 我已经使用Spring Boot编写了Spring Batch应用程序。当我尝试在本地系统上使用命令行和类路径运行该应用程序时,它运行良好。但是,当我尝试在linux服务器上运行它时,出现以下异常 下面是我的运行方式: 问题答案: 可能你缺少Spring Boot入门类。
问题内容: 我收到以下异常: 应用程序入门类是这样的: 如你所见,main方法包含一个注释行。但是我无法运行ScheduledTasks应用程序,如下所示: 我使用Eclipse并将Application.java的主程序作为应用程序运行。有人可以帮我吗? 问题答案: 调度指南不是Web应用程序,因此REST指南中的pom.xml中可能包含一些发霉的东西?如果你严格按照说明进行操作,那么它应该可以