относительно новый для Spring, так что я полагаю, что я что-то делаю неправильно Я перевел старый мыльный сервис java на весну. Я могу запустить его локально на tomcat 8.5 и выше, но когда я запускаю его на tomcat 8.0.37 (на котором находится сервер, на котором я буду его развертывать), я получаю сообщение об ошибке ниже. Я столкнулся с этой ошибкой в другом проекте, но понял, что в другом проекте я без необходимости создавал сервлет, поэтому, как только я вырвал код сервлета, я был готов пойти. В этом случае мне нужно создать сервлет. Ошибка ищет «org / apache / coyote / UpgradeProtocol», которого нет в Tomcat 8.0.37. Не уверен, что в моем коде пытается использовать его. Любые предложения приветствуются, спасибо.
зависимости Tomcat в пом ...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.7.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
ошибка ...
2019-01-17 16: 05: 12,539 SEVERE Class = org.apache.catalina.core.ContainerBase Метод = addChildInternal Message = ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: не удалось запустить компонент [StandardEngine [Catalina] .StandardHost [localhost] .StandardContext [/ exampleServices]]
в org.apache.catalina.util.LifecycleBase.start (LifecycleBase.java:162)
в org.apache.catalina.core.ContainerBase.addChildInternal (ContainerBase.java:725)
в org.apache.catalina.core.ContainerBase.addChild (ContainerBase.java:701)
в org.apache.catalina.core.StandardHost.addChild (StandardHost.java:717)
в org.apache.catalina.startup.HostConfig.deployWAR (HostConfig.java:940)
в org.apache.catalina.startup.HostConfig $ DeployWar.run (HostConfig.java:1816)
в java.util.concurrent.Executors $ RunnableAdapter.call (Executors.java:511)
в java.util.concurrent.FutureTask.run (FutureTask.java:266)
в java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1142)
в java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:617)
на java.lang.Thread.run (Thread.java:745)
Вызвано: org.springframework.beans.factory.BeanCreationException: Ошибка при создании bean-компонента с именем 'containerFactory', определенным в ресурсе пути к классу [com / selected / exampleServices / exampleServicesConfiguration.class]: сбой создания экземпляра бина с помощью метода фабрики; вложенным исключением является org.springframework.beans.BeanInstantiationException: не удалось создать экземпляр [org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory]: метод фабрики «containerFactory» вызвал исключение; Вложенным исключением является java.lang.NoClassDefFoundError: org / apache / coyote / UpgradeProtocol
в org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod (ConstructorResolver.java:591)
в org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod (AbstractAutowireCapableBeanFactory.java:1246)
в org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance (AbstractAutowireCapableBeanFactory.java:1096)
в org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:535)
в org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:495)
в org.springframework.beans.factory.support.AbstractBeanFactory.lambda $ doGetBean $ 0 (AbstractBeanFactory.java:317)
в org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:222)
в org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:315)
в org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:199)
в org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons (DefaultListableBeanFactory.java:759)в org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:867)
в org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:548)
в org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh (ServletWebServerApplicationContext.java:142)
в org.springframework.boot.SpringApplication.refresh (SpringApplication.java:754)
в org.springframework.boot.SpringApplication.refreshContext (SpringApplication.java:386)
в org.springframework.boot.SpringApplication.run (SpringApplication.java:307)
в org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run (SpringBootServletInitializer.java:157)
в org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext (SpringBootServletInitializer.java:137)
в org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup (SpringBootServletInitializer.java:91)
в org.springframework.web.SpringServletContainerInitializer.onStartup (SpringServletContainerInitializer.java:172)
в org.apache.catalina.core.StandardContext.startInternal (StandardContext.java:5303)
в org.apache.catalina.util.LifecycleBase.start (LifecycleBase.java:145)
класс конфигурации ниже, я предполагаю, что проблема заключается в том, как я создаю свой TomcatServletWebServerFactory или мой ServletRegistrationBean
@ComponentScan({"com.example.exampleservices", "com.example.examplesoapservices"})
@Configuration
@EnableAWSF
public class exampleservicesConfiguration {
static {
// Statically initialize SystemImpl so it doesn't slow down first
// request
try {
SystemImpl.getInstance();
} catch (exampleException e) {
throw new RuntimeException(e);
}
}
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new WSSpringServlet(), "/exampleservicesSOAP/*", "/exampleservicesSOAPV3/*");
//ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new WSSpringServlet(), "/exampleservicesPort/*", "/exampleservicesPortV3/*");
servletRegistrationBean.setEnabled(true);
servletRegistrationBean.setLoadOnStartup(0);
return servletRegistrationBean;
}
@Bean
@SneakyThrows
public SpringBinding springBinding(exampleservicesSOAPImpl exampleservicesSOAPImpl, AWSFHandlers awsfHandlers) throws Exception {
SpringBinding springBinding = new SpringBinding();
springBinding.setUrl("/exampleservicesSOAP");
SpringService springService = new SpringService();
springService.setBean(exampleservicesSOAPImpl);
springService.setHandlers(awsfHandlers.getAwsfHandlers());
springBinding.setService(springService.getObject());
return springBinding;
}
@Bean
@SneakyThrows
public SpringBinding springBindingV3(exampleservicesSOAPV3Impl exampleservicesSOAPV3Impl, AWSFHandlers awsfHandlers) throws Exception {
SpringBinding springBinding = new SpringBinding();
springBinding.setUrl("/exampleservicesSOAPV3");
SpringService springService = new SpringService();
springService.setBean(exampleservicesSOAPV3Impl);
springService.setHandlers(awsfHandlers.getAwsfHandlers());
springBinding.setService(springService.getObject());
return springBinding;
}
@Bean
public Executor threadPoolTaskExecutor(){
return new ThreadPoolTaskExecutor();
}
@Bean
public TomcatServletWebServerFactory containerFactory() {
return new TomcatServletWebServerFactory () {
protected void customizeConnector(Connector connector) {
super.customizeConnector(connector);
}
};
}
@Bean
public Jaxb2Marshaller jaxb2Marshaller() {
Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
jaxb2Marshaller.setContextPath(exJAXBContext.JAXB_CONTEXT_PATH);
return jaxb2Marshaller;
}
@Bean
private static JAXBContext initContext() {
try {
return JAXBContext.newInstance(BasicServiceComponents.eesvcof.getClass().getPackage().getName() + ":" + BasicServiceComponents.eesvcofV3.getClass().getPackage().getName());
} catch (JAXBException e) {
e.printStackTrace();
return null;
}
}
private static final JAXBContext context = initContext();
@Bean
public Marshaller marshaller() {
Marshaller marshaller = null;
try {
marshaller = this.context.createMarshaller();
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//any setters
return marshaller;
}
@Bean
public Unmarshaller unmarshaller() {
Unmarshaller unmarshaller = null;
try {
unmarshaller = this.context.createUnmarshaller();
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//any setters
return unmarshaller;
}
}