I am using the Spring Boot + Jersey project, resolved the previous essay in the FileNotFoundException, and then reported a filenotfoundexception, but the error message is different
The error message is as follows:
ERROR O.a.c.c.c.[tomcat]. [localhost]. [/]-standardwrapper.throwable org.glassfish.hk2.api.multiexception:a multiexception has 1 exceptions. They are:1. Org.glassfish.jersey.server.internal.scanning.ResourceFinderException:java.io.FileNotFoundException:/home/ Vincent/mycomponent/spring-boot/yishi-service/target/yishi-service-0.5.0.war!/web-inf/classes (No such file or directory) at Org.jvnet.hk2.internal.Utilities.justCreate (utilities.java:1007) at Org.jvnet.hk2.internal.ServiceLocatorImpl.create (servicelocatorimpl.java:962) at Org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize (servicelocatorimpl.java:1054) at Org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize (servicelocatorimpl.java:1046) at Org.glassfish.jersey.server.ApplicationHandler.createApplication (applicationhandler.java:385) at Org.glassfish.jersey.server.applicationhandler.<init> (applicationhandler.java:342) 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)
This problem is caused by jersey not being able to scan packages in the war package because my ResourceConfig is as follows:
public class WebApplication extends ResourceConfig {public webapplication () { System.out.println (" WebApplication init ... ");
This causes packages ("Com.jiajian.yishi.rest"); Property (Serverproperties.tracing, "all"); Freemarker Property (Mvcfeature.template_base_path, "/web-inf/fm/"); Register (mvcfeature.class); Register (freemarkermvcfeature.class); Pageviewbehavior Register (pageviewcontainerrequestfilter.class); Register (pageviewcontainerresponsefilter.class);} }
There is no good solution at the moment,
If you want to use jersey, you can do it via register (Resource.class)
Alternatively, the resource class is composed of a separate module and is unpacked at startup.
<build> <plugins> <plugin> <groupid>org.springframework.boot</groupid > <artifactId>spring-boot-maven-plugin</artifactId> <configuration> < requiresunpack> <dependency> <groupId> your resource groupid</groupid> < Artifactid> your resource's artifactid</artifactid> </dependency> </requiresUnpack> </configuration> </plugin> </plugins></build>
Spring Boot + jersey occurs filenotfoundexception (No such file or directory)