親バージョンが1.4.2.RELEASEであるSpring Bootプロジェクトをビルドし、Eclipseで正常に実行されますが、Java CLIで実行すると奇妙なエラーが発生し、コマンドmvn clean package
はjava -jar target/yishi-service-0.5.0.war
例外は次のとおりです。
[main] ERROR o.a.c.c.C.[Tomcat].[localhost].[/] - StandardWrapper.Throwable
org.glassfish.jersey.internal.ServiceConfigurationError: org.glassfish.jersey.internal.spi.AutoDiscoverable: : java.io.FileNotFoundException: JAR entry !/META-INF/services/org.glassfish.jersey.internal.spi.AutoDiscoverable not found in /tmp/jar_cache7985854176820315027.tmp
at org.glassfish.jersey.internal.ServiceFinder.fail(ServiceFinder.java:433)
at org.glassfish.jersey.internal.ServiceFinder.parse(ServiceFinder.java:512)
at org.glassfish.jersey.internal.ServiceFinder.access$400(ServiceFinder.java:155)
at org.glassfish.jersey.internal.ServiceFinder$AbstractLazyIterator.hasNext(ServiceFinder.java:572)
at org.glassfish.jersey.internal.ServiceFinder.toClassArray(ServiceFinder.java:418)
at org.glassfish.jersey.internal.ServiceFinderBinder.configure(ServiceFinderBinder.java:90)
at org.glassfish.hk2.utilities.binding.AbstractBinder.bind(AbstractBinder.java:172)
at org.glassfish.hk2.utilities.binding.AbstractBinder.install(AbstractBinder.java:342)
at org.glassfish.jersey.server.ServerBinder.configure(ServerBinder.java:94)
at org.glassfish.hk2.utilities.binding.AbstractBinder.bind(AbstractBinder.java:172)
at org.glassfish.jersey.internal.inject.Injections.bind(Injections.java:157)
at org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:147)
at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:123)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:330)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4913)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:78)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.startConnector(TomcatEmbeddedServletContainer.java:256)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:181)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175)
at com.jiajian.yishi.YishiServiceProjectApplication.main(YishiServiceProjectApplication.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59)
この組み込み Tomcat のバージョンは 8.5.6 です。
ご協力ありがとうございました!