Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring boot +jpa 打包成功后启动成功,但是访问接口时报错 #18

Closed
yaakua opened this issue Apr 15, 2019 · 3 comments
Closed

Comments

@yaakua
Copy link

yaakua commented Apr 15, 2019

项目情况

程序能加密后能正常启动成功,但是一旦访问首页或者接口就会报。
项目框架采用spring boot 2+spring data jpa,已经使用agent做了代理启动。
启动命令: java -javaagent:xjar-agent-hibernate-v1.0.0.jar -jar admin-1.0.0-SNAPSHOT.xjar

报错信息如下:

  • 2019-04-15 21:07:55.865 [http-nio-7789-exec-4] ERROR o.a.c.c.C.[.[localhost].[/].[dispatcherServlet][182] -Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
    java.io.IOException: Skipped only 0 bytes out of 61093 required
    at org.springframework.util.StreamUtils.copyRange(StreamUtils.java:164)
    at org.springframework.http.converter.ResourceRegionHttpMessageConverter.writeResourceRegion(ResourceRegionHttpMessageConverter.java:158)

image

@core-lib
Copy link
Owner

静态资源加密时先忽略

@yaakua
Copy link
Author

yaakua commented Apr 15, 2019

确实如此,是因为加载了静态文件导致的。改了相应的配置如下,忽略了static目录。建议文档当中注明一下,免得后来人犯类似错误。毕竟spring boot应用包含静态文件这种方式还是很常见的。

<plugin> <groupId>com.github.core-lib</groupId> <artifactId>xjar-maven-plugin</artifactId> <version>v1.0.9</version> <executions> <execution> <goals> <goal>build</goal> </goals> <phase>package</phase> <configuration> <password>*****</password> <excludes> <exclude>BOOT-INF/classes/static/**</exclude> </excludes> </configuration> </execution> </executions> </plugin>

@yaakua yaakua closed this as completed Apr 15, 2019
@core-lib
Copy link
Owner

好的 谢谢建议

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants