通过Vaadin应用程序

时间:2016-01-15 13:17:02

标签: java rest spring-mvc spring-boot vaadin

我使用@RestController的一个类实现了Sping Boot Maven项目。我将此应用程序配置为使用端口9000,因为正常的Vaadin应用程序使用端口8082.我想要实现的是,通过一组Vaadin应用程序项目启动REST应用程序项目。 Spring应用程序的主类称为RestServiceApplication,包含注释@SpringBootApplication。不,我只是打电话

SpringApplication sa = new SpringApplication(SenAalRestServiceApplication.class);
    sa.run(args);

运行RESTful Web服务。

现在我的问题是,我无法调用REST服务中的任何方法。 Spring启动的日志输出只是说:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.3.1.RELEASE)

2016-01-15 14:10:30.907  INFO 7900 --- [nio-8082-exec-1] o.s.boot.SpringApplication               : Starting application on Kampfkeks with PID 7900 (C:\Users\Marcel\Desktop\ENTWICKLUNG_JAVA\java\workspaces\RaspAAL\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\SenAAL\WEB-INF\lib\spring-boot-1.3.1.RELEASE.jar started by Marcel in C:\Users\Marcel\Desktop\ENTWICKLUNG_JAVA\java\eclipse)
2016-01-15 14:10:30.913  INFO 7900 --- [nio-8082-exec-1] o.s.boot.SpringApplication               : No active profile set, falling back to default profiles: default
2016-01-15 14:10:31.020  INFO 7900 --- [nio-8082-exec-1] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1c9710d: startup date [Fri Jan 15 14:10:31 CET 2016]; root of context hierarchy
2016-01-15 14:10:34.320  INFO 7900 --- [nio-8082-exec-1] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2016-01-15 14:10:34.340  INFO 7900 --- [nio-8082-exec-1] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2016-01-15 14:10:34.540  INFO 7900 --- [nio-8082-exec-1] o.s.boot.SpringApplication               : Started application in 4.126 seconds (JVM running for 18.913)

编辑: 好的,我会更详细地解释一下: 我有两个应用程序: 1. Vaadin应用程序不是Spring驱动的,只是在NORMAL Tomcat容器(服务器)中运行。 2.包含主类和RestController的Spring Boot应用程序。

在项目中1.我有一个课程,只是调用上面提到的

SpringApplication sa = new SpringApplication(SenAalRestServiceApplication.class);
    sa.run(args);

启动Vaadin应用程序并调用此代码片段后,Spring Boot应用程序将启动,但它永远不会显示任何可用的REST服务。我认为目前Spring Boot应用程序的日志输出太少了。我玩了日志级别,但它仍然是相同的。

现在我所做的是,将项目2的依赖项移除到项目1.并将项目2的所有源代码复制到项目1.并尝试直接在项目1中运行Spring Boot应用程序。我的问题在这里是,无法启动嵌入式Tomcat服务器/容器。我收到以下错误。这有什么问题???我正在使用相同的代码片段在Vaadin应用程序中启动Spring Boot应用程序。

2016-01-16 11:59:29.025  WARN 1060 --- [nio-8080-exec-1] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "org/apache/catalina/Service"
2016-01-16 11:59:29.039 ERROR 1060 --- [nio-8080-exec-1] o.s.boot.SpringApplication               : Application startup failed

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "org/apache/catalina/Service"
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133) ~[EmbeddedWebApplicationContext.class:1.3.1.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[AbstractApplicationContext.class:4.2.4.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[EmbeddedWebApplicationContext.class:1.3.1.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764) ~[SpringApplication.class:1.3.1.RELEASE]
    at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) ~[SpringApplication.class:1.3.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) ~[SpringApplication.class:1.3.1.RELEASE]
    at de.hska.iwi.senaal.service.rest.SenAALRestCallback.<init>(SenAALRestCallback.java:24) [SenAALRestCallback.class:na]
    at de.hska.iwi.senaal.service.SenAALService.<init>(SenAALService.java:117) [SenAALService.class:na]
    at de.hska.iwi.senaal.factory.SenAALFactoryImpl.getSenAALService(SenAALFactoryImpl.java:56) [SenAALFactoryImpl.class:na]
    at de.hska.iwi.senaal.servlet.MainServlet.servletInitialized(MainServlet.java:43) [MainServlet.class:na]
    at com.vaadin.server.VaadinServlet.init(VaadinServlet.java:216) [VaadinServlet.class:7.6.0.alpha2]
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1241) [catalina.jar:8.0.14]
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1154) [catalina.jar:8.0.14]
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:827) [catalina.jar:8.0.14]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135) [catalina.jar:8.0.14]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [catalina.jar:8.0.14]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506) [catalina.jar:8.0.14]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) [catalina.jar:8.0.14]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:8.0.14]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) [catalina.jar:8.0.14]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.14]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537) [catalina.jar:8.0.14]
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081) [tomcat-coyote.jar:8.0.14]
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658) [tomcat-coyote.jar:8.0.14]
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) [tomcat-coyote.jar:8.0.14]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566) [tomcat-coyote.jar:8.0.14]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523) [tomcat-coyote.jar:8.0.14]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_31]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_31]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.14]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_31]

0 个答案:

没有答案