迁移到Spring5后出现非法字符错误

pokxtpni  于 2021-07-23  发布在  Java
关注(0)|答案(0)|浏览(293)

我正在研究一些遗留代码。它已经在spring(springbootstarter父级0.5.0.m7)和java1.7下运行,但是迁移的时候到了。我决定迁移到spring5(springbootstarter父级2.4.5)和java1.8。我已经重构到代码编译时没有错误或警告的程度,但是当我尝试运行代码时,我得到:

  1. java.lang.reflect.InvocationTargetException
  2. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  3. at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  4. at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  5. at java.lang.reflect.Method.invoke(Unknown Source)
  6. at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
  7. at java.lang.Thread.run(Unknown Source)
  8. Caused by: java.lang.IllegalStateException: java.net.URISyntaxException: Illegal character in opaque part at index 11: jar:file:<my jarfile path redacted>!/
  9. at org.springframework.boot.loader.ExecutableArchiveLauncher.<init>(ExecutableArchiveLauncher.java:41)
  10. at org.springframework.boot.loader.JarLauncher.<init>(JarLauncher.java:30)
  11. at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:45)
  12. ... 6 more

我已经查看了procfile(在迁移过程中我没有更改),那里的路径似乎是正确的。该程序是一个web应用程序,我尝试使用与以前相同的命令运行它:

  1. java -jar target/<my jar file name> --server.port=8020

我不清楚如何追查这个错误。我在Windows10下运行(迁移前和迁移后)。代码是使用maven构建的。运行mvn——版本返回3.5.0。
我的pom:

  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  3. <modelVersion>4.0.0</modelVersion>
  4. <groupId>org.conservationcenter</groupId>
  5. <artifactId><redacted></artifactId>
  6. <packaging>jar</packaging>
  7. <version>0.1</version>
  8. <name><redacted></name>
  9. <properties>
  10. <spring.version>4.0.0.RELEASE</spring.version>
  11. <hibernate.version>4.0.1.Final</hibernate.version>
  12. </properties>
  13. <parent>
  14. <groupId>org.springframework.boot</groupId>
  15. <artifactId>spring-boot-starter-parent</artifactId>
  16. <version>2.4.3</version>
  17. </parent>
  18. <dependencies>
  19. <dependency>
  20. <groupId>org.apache.pdfbox</groupId>
  21. <artifactId>pdfbox</artifactId>
  22. <version>2.0.4</version>
  23. </dependency>
  24. <dependency>
  25. <groupId>org.springframework.boot</groupId>
  26. <artifactId>spring-boot-starter-web</artifactId>
  27. </dependency>
  28. <dependency>
  29. <groupId>org.springframework.data</groupId>
  30. <artifactId>spring-data-jpa</artifactId>
  31. </dependency>
  32. <dependency>
  33. <groupId>org.springframework.boot</groupId>
  34. <artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>
  35. <dependency>
  36. <groupId>nz.net.ultraq.thymeleaf</groupId>
  37. <artifactId>thymeleaf-layout-dialect</artifactId></dependency>
  38. <dependency>
  39. <groupId>org.springframework.security</groupId>
  40. <artifactId>spring-security-web</artifactId>
  41. </dependency>
  42. <dependency>
  43. <groupId>org.springframework.security</groupId>
  44. <artifactId>spring-security-config</artifactId>
  45. </dependency>
  46. <dependency>
  47. <groupId>com.radiadesign.catalina.session</groupId>
  48. <artifactId>redis</artifactId>
  49. <version>0.1</version>
  50. </dependency>
  51. <!-- file upload -->
  52. <dependency>
  53. <groupId>commons-fileupload</groupId>
  54. <artifactId>commons-fileupload</artifactId>
  55. <version>1.3</version>
  56. </dependency>
  57. <dependency>
  58. <groupId>commons-io</groupId>
  59. <artifactId>commons-io</artifactId>
  60. <version>2.4</version>
  61. </dependency>
  62. <dependency>
  63. <groupId>redis.clients</groupId>
  64. <artifactId>jedis</artifactId>
  65. <version>2.1.0</version>
  66. </dependency>
  67. <dependency>
  68. <groupId>org.codehaus.jackson</groupId>
  69. <artifactId>jackson-mapper-asl</artifactId>
  70. <version>1.4.2</version>
  71. </dependency>
  72. <dependency>
  73. <groupId>com.sendgrid</groupId>
  74. <artifactId>sendgrid-java</artifactId>
  75. <version>4.7.2</version>
  76. </dependency>
  77. <dependency>
  78. <groupId>com.googlecode.json-simple</groupId>
  79. <artifactId>json-simple</artifactId>
  80. <version>1.1</version>
  81. </dependency>
  82. <dependency>
  83. <groupId>org.json</groupId>
  84. <artifactId>json</artifactId>
  85. <version>20080701</version>
  86. </dependency>
  87. <!-- DB/ORM -->
  88. <dependency>
  89. <groupId>org.springframework</groupId>
  90. <artifactId>spring-orm</artifactId>
  91. <version>${spring.version}</version>
  92. </dependency>
  93. <dependency>
  94. <groupId>org.springframework</groupId>
  95. <artifactId>spring-jdbc</artifactId>
  96. <version>${spring.version}</version>
  97. </dependency>
  98. <dependency>
  99. <groupId>commons-dbcp</groupId>
  100. <artifactId>commons-dbcp</artifactId>
  101. <version>1.2.2</version>
  102. </dependency>
  103. <dependency>
  104. <groupId>org.postgresql</groupId>
  105. <artifactId>postgresql</artifactId>
  106. <version>42.2.1</version>
  107. </dependency>
  108. <dependency>
  109. <groupId>org.hibernate</groupId>
  110. <artifactId>hibernate-core</artifactId>
  111. <version>${hibernate.version}</version>
  112. </dependency>
  113. <dependency>
  114. <groupId>org.hibernate</groupId>
  115. <artifactId>hibernate-entitymanager</artifactId>
  116. <version>${hibernate.version}</version>
  117. </dependency>
  118. <dependency>
  119. <groupId>javax.validation</groupId>
  120. <artifactId>validation-api</artifactId>
  121. <version>1.1.0.Final</version>
  122. </dependency>
  123. <dependency>
  124. <groupId>org.hibernate</groupId>
  125. <artifactId>hibernate-validator</artifactId>
  126. <version>5.0.2.Final</version>
  127. </dependency>
  128. <dependency>
  129. <groupId>org.aspectj</groupId>
  130. <artifactId>aspectjtools</artifactId>
  131. <version>1.6.2</version>
  132. </dependency>
  133. <dependency>
  134. <groupId>org.apache.poi</groupId>
  135. <artifactId>poi</artifactId>
  136. <version>3.10-FINAL</version>
  137. </dependency>
  138. <dependency>
  139. <groupId>org.apache.poi</groupId>
  140. <artifactId>poi-ooxml</artifactId>
  141. <version>3.10-FINAL</version>
  142. </dependency>
  143. <!--Utilities-->
  144. <dependency>
  145. <groupId>joda-time</groupId>
  146. <artifactId>joda-time</artifactId>
  147. <version>2.3</version>
  148. </dependency>
  149. <dependency>
  150. <groupId>com.google.guava</groupId>
  151. <artifactId>guava</artifactId>
  152. <version>15.0</version>
  153. </dependency>
  154. <!--Migrations-->
  155. <dependency>
  156. <groupId>com.googlecode.flyway</groupId>
  157. <artifactId>flyway-maven-plugin</artifactId>
  158. <version>2.2.1</version>
  159. </dependency>
  160. <!-- Test -->
  161. <dependency>
  162. <groupId>org.springframework</groupId>
  163. <artifactId>spring-test</artifactId>
  164. <version>${spring.version}</version>
  165. <scope>test</scope>
  166. </dependency>
  167. <dependency>
  168. <groupId>com.jayway.jsonpath</groupId>
  169. <artifactId>json-path</artifactId>
  170. <version>0.8.1</version>
  171. <scope>test</scope>
  172. </dependency>
  173. <dependency>
  174. <groupId>com.jayway.jsonpath</groupId>
  175. <artifactId>json-path-assert</artifactId>
  176. <version>0.8.1</version>
  177. <scope>test</scope>
  178. </dependency>
  179. <dependency>
  180. <groupId>junit</groupId>
  181. <artifactId>junit</artifactId>
  182. <version>4.11</version>
  183. <type>jar</type>
  184. <scope>test</scope>
  185. <optional>true</optional>
  186. </dependency>
  187. <dependency>
  188. <groupId>org.hamcrest</groupId>
  189. <artifactId>hamcrest-core</artifactId>
  190. <version>1.3</version>
  191. <scope>test</scope>
  192. </dependency>
  193. <dependency>
  194. <groupId>org.hamcrest</groupId>
  195. <artifactId>hamcrest-library</artifactId>
  196. <version>1.3</version>
  197. <scope>test</scope></dependency>
  198. <dependency>
  199. <groupId>org.mockito</groupId>
  200. <artifactId>mockito-all</artifactId>
  201. <version>1.9.5</version>
  202. <scope>test</scope></dependency>
  203. <dependency>
  204. <groupId>org.fluentlenium</groupId>
  205. <artifactId>fluentlenium-core</artifactId>
  206. <version>0.9.2</version>
  207. <scope>test</scope>
  208. </dependency>
  209. <dependency>
  210. <groupId>xml-apis</groupId>
  211. <artifactId>xml-apis</artifactId>
  212. <version>1.4.01</version>
  213. <scope>test</scope>
  214. </dependency>
  215. </dependencies>
  216. <repositories>
  217. <repository>
  218. <id>spring-milestones</id>
  219. <name>Spring Milestones</name>
  220. <url>http://repo.spring.io/milestone</url>
  221. <snapshots>
  222. <enabled>false</enabled>
  223. </snapshots>
  224. </repository>
  225. <repository>
  226. <id>local-lib</id>
  227. <name>Local Lib Repository</name>
  228. <url>file://${basedir}/lib</url>
  229. </repository>
  230. </repositories>
  231. <pluginRepositories>
  232. <pluginRepository>
  233. <snapshots>
  234. <enabled>true</enabled>
  235. </snapshots>
  236. <id>spring-central</id>
  237. <name>repo</name>
  238. <url>http://repo.spring.io/repo</url>
  239. </pluginRepository>
  240. <pluginRepository>
  241. <id>central</id>
  242. <name>Maven Plugin Repository</name>
  243. <url>http://repo1.maven.org/maven2</url>
  244. <layout>default</layout>
  245. <snapshots>
  246. <enabled>false</enabled>
  247. </snapshots>
  248. <releases>
  249. <updatePolicy>never</updatePolicy>
  250. </releases>
  251. </pluginRepository>
  252. </pluginRepositories>
  253. <build>
  254. <finalName>crc-water</finalName>
  255. <plugins>
  256. <plugin>
  257. <artifactId>maven-compiler-plugin</artifactId>
  258. <configuration>
  259. <source>1.7</source>
  260. <target>1.7</target>
  261. </configuration>
  262. </plugin>
  263. <plugin>
  264. <groupId>org.springframework.boot</groupId>
  265. <artifactId>spring-boot-maven-plugin</artifactId>
  266. <version>1.0.0.RELEASE</version>
  267. <executions>
  268. <execution>
  269. <phase>install</phase>
  270. <goals>
  271. <goal>repackage</goal>
  272. </goals>
  273. </execution>
  274. </executions>
  275. </plugin>
  276. <plugin>
  277. <groupId>com.github.searls</groupId>
  278. <artifactId>jasmine-maven-plugin</artifactId>
  279. <version>1.3.1.3</version>
  280. <executions>
  281. <execution>
  282. <goals>
  283. <goal>test</goal>
  284. </goals>
  285. </execution>
  286. </executions>
  287. <configuration>
  288. <preloadSources>
  289. <source>${project.basedir}/src/main/webapp/resources/javascripts/vendor/jquery-1.10.1.min.js
  290. </source>
  291. <source>${project.basedir}/src/main/webapp/resources/javascripts/vendor/angular.min.js</source>
  292. <source>${project.basedir}/src/main/webapp/resources/javascripts/vendor/angular-route.min.js
  293. </source>
  294. <source>${project.basedir}/src/main/webapp/resources/javascripts/vendor/underscore-min.js
  295. </source>
  296. <source>${project.basedir}/src/main/webapp/resources/javascripts/vendor/angular-mocks.js
  297. </source>
  298. <source>${project.basedir}/src/main/webapp/resources/javascripts/vendor/moment.js
  299. </source>
  300. </preloadSources>
  301. <jsSrcDir>src/main/webapp/resources/javascripts</jsSrcDir>
  302. <jsTestSrcDir>src/test/webapp/resources/javascripts</jsTestSrcDir>
  303. <specIncludes>
  304. <include>*Spec.js</include>
  305. </specIncludes>
  306. </configuration>
  307. </plugin>
  308. <plugin>
  309. <artifactId>maven-surefire-plugin</artifactId>
  310. <configuration>
  311. <includes>
  312. <include>**/*Test.java</include>
  313. </includes>
  314. <environmentVariables>
  315. <DATABASE_URL>postgresql://<user redacted>:<password redacted>@localhost:5433/<redacted></DATABASE_URL>
  316. </environmentVariables>
  317. </configuration>
  318. </plugin>
  319. <plugin>
  320. <groupId>com.googlecode.flyway</groupId>
  321. <artifactId>flyway-maven-plugin</artifactId>
  322. <version>2.3</version>
  323. <configuration>
  324. <url>jdbc:postgresql://localhost:5433/<redacted></url>
  325. <user><redacted></user>
  326. <password><redacted></password>
  327. </configuration>
  328. </plugin>
  329. </plugins>
  330. </build>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题