我克隆项目https://github.com/marshallpierce/jersey-file-upload-test并在pom.xml文件中添加一个打包部分,用于生成一体化文件。 (我的仓库中的新代码:https://github.com/lamuguo/jersey-file-upload-test)
在项目中,我可以通过
成功运行它
mvn exec:java -Dexec.mainClass=com.palominolabs.jersey.JerseyUploadMain
,
但是因为我跑了" mvn package"并在目标/中获得一个大的jar文件,
我不能通过" java -jar target / jerseyupload-jar-with-dependencies.jar"来执行它。像往常一样。错误如下:
03:05:56.650 [main] ERROR com.sun.jersey.spi.inject.Errors - The following errors and warnings have been detected with resource and/or provider classes:
SEVERE: Missing dependency for method public java.lang.String com.palominolabs.jersey.UploadResource.upload(com.sun.jersey.multipart.FormDataBodyPart)
throws java.security.NoSuchAlgorithmException,java.io.IOException at parameter at index 0
SEVERE: Method, public java.lang.String com.palominolabs.jersey.UploadResource.upload(com.sun.jersey.multipart.FormDataBodyPart) throws java.security.N
oSuchAlgorithmException,java.io.IOException, annotated with POST of resource, class com.palominolabs.jersey.UploadResource, is not recognized as valid re
source method.
03:05:56.653 [main] WARN o.e.j.u.component.AbstractLifeCycle - FAILED com.google.inject.servlet.GuiceFilter-1004095028: com.sun.jersey.spi.inject.Errors
$ErrorMessagesException
com.sun.jersey.spi.inject.Errors$ErrorMessagesException: null
at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170) ~[jerseyupload-jar-with-dependencies.jar:na]
at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136) ~[jerseyupload-jar-with-dependencies.jar:na]
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199) ~[jerseyupload-jar-with-dependencies.jar:na]
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:770) ~[jerseyupload-jar-with-dependencies.jar:na]
at com.sun.jersey.guice.spi.container.servlet.GuiceContainer.initiate(GuiceContainer.java:121) ~[jerseyupload-jar-with-dependencies.jar:na]
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:319) ~[jerseyupload-jar-with-depende
ncies.jar:na]
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605) ~[jerseyupload-jar-with-dependencies.jar:na]
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210) ~[jerseyupload-jar-with-dependencies.jar:na]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374) ~[jerseyupload-jar-with-dependencies.jar:na]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:557) ~[jerseyupload-jar-with-dependencies.jar:na]
at javax.servlet.GenericServlet.init(GenericServlet.java:241) ~[jerseyupload-jar-with-dependencies.jar:na]
有什么建议吗?