CTF-Java-Gadget-master>mvn exec:java -Dexec.classpathScope=compile -Dexec.mainClass="com.xiinnn.commonly.POJOJackson"
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.xiinnn:CTF-Java-Gadget >---------------------
[INFO] Building CTF-Java-Gadget 1.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec:3.5.0:java (default-cli) @ CTF-Java-Gadget ---
[WARNING]
javassist.NotFoundException: com.fasterxml.jackson.databind.node.BaseJsonNode
at javassist.ClassPool.get (ClassPool.java:430)
at com.xiinnn.commonly.POJOJackson.main (POJOJackson.java:32)
at org.codehaus.mojo.exec.ExecJavaMojo.doMain (ExecJavaMojo.java:375)
at org.codehaus.mojo.exec.ExecJavaMojo.doExec (ExecJavaMojo.java:364)
at org.codehaus.mojo.exec.ExecJavaMojo.lambda$execute$0 (ExecJavaMojo.java:286)
at java.lang.Thread.run (Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.476 s
[INFO] Finished at: 2024-11-17T23:17:10+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.5.0:java (default-cli) on project CTF-Java-Gadget: An exception occurred while executing the Java class. com.fasterxml.jackson.databind.node.BaseJsonNode -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
使用 -X 输出下详细信息
mvn-X exec:java -Dexec.classpathScope=compile -Dexec.mainClass="com.xiinnn.commonly.POJOJackson"
[DEBUG] (f) pluginDependencies = [org.codehaus.mojo:exec-maven-plugin:maven-plugin:3.5.0:, org.apache.maven.resolver:maven-resolver-util:jar:1.4.1:compile, org.apache.maven.resolver:maven-resolver-api:jar:1.4.1:compile, org.codehaus.plexus:plexus-utils:jar:4.0.2:compile, org.codehaus.plexus:plexus-xml:jar:3.0.1:compile, org.apache.commons:commons-exec:jar:1.4.0:compile, org.ow2.asm:asm:jar:9.7.1:compile, org.ow2.asm:asm-commons:jar:9.7.1:compile, org.ow2.asm:asm-tree:jar:9.7.1:compile]
[DEBUG] (f) preloadCommonPool = 0
[DEBUG] (f) project = MavenProject: com.xiinnn:CTF-Java-Gadget:1.0-SNAPSHOT @ D:\wgf\My Documents\GitHub\blog\text\docs\ctf\scripts\web\java\CTF-Java-Gadget-master\pom.xml
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@226b143b
[DEBUG] (f) skip = false
[DEBUG] (f) stopUnresponsiveDaemonThreads = false
[DEBUG] -- end configuration --
[DEBUG] Invoking : com.xiinnn.commonly.POJOJackson.main()
[DEBUG] Plugin Dependencies will be excluded.
[DEBUG] Project Dependencies will be included.
[DEBUG] Collected project artifacts [org.javassist:javassist:jar:3.27.0-GA:compile, com.fasterxml.jackson.core:jackson-databind:jar:2.14.1:compile, com.fasterxml.jackson.core:jackson-annotations:jar:2.14.1:compile, com.fasterxml.jackson.core:jackson-core:jar:2.14.1:compile, org.springframework:spring-aop:jar:5.3.24:compile, org.springframework:spring-beans:jar:5.3.24:compile, org.springframework:spring-core:jar:5.3.24:compile, org.springframework:spring-jcl:jar:5.3.24:compile, commons-collections:commons-collections:jar:3.2.1:compile, commons-beanutils:commons-beanutils:jar:1.9.3:compile, commons-logging:commons-logging:jar:1.2:compile, rome:rome:jar:1.0:compile, jdom:jdom:jar:1.0:compile, com.alibaba:fastjson:jar:1.2.80:compile, org.springframework:spring-webmvc:jar:5.3.24:compile, org.springframework:spring-context:jar:5.3.24:compile, org.springframework:spring-expression:jar:5.3.24:compile, org.springframework:spring-web:jar:5.3.24:compile, javax.servlet:javax.servlet-api:jar:4.0.1:compile, org.springframework:spring-tx:jar:3.1.0.RELEASE:compile, aopalliance:aopalliance:jar:1.0:compile, javax.transaction:jta:jar:1.1:compile]
[DEBUG] Collected project classpath [D:\wgf\My Documents\GitHub\blog\text\docs\ctf\scripts\web\java\CTF-Java-Gadget-master\target\classes]
[DEBUG] Adding to classpath : D:\wgf\My Documents\GitHub\blog\text\docs\ctf\scripts\web\java\CTF-Java-Gadget-master\target\classes
[DEBUG] Adding project dependency artifact: javassist to classpath
[DEBUG] Adding project dependency artifact: jackson-databind to classpath
[DEBUG] Adding project dependency artifact: jackson-annotations to classpath
[DEBUG] Adding project dependency artifact: jackson-core to classpath
[DEBUG] Adding project dependency artifact: spring-aop to classpath
[DEBUG] Adding project dependency artifact: spring-beans to classpath
[DEBUG] Adding project dependency artifact: spring-core to classpath
[DEBUG] Adding project dependency artifact: spring-jcl to classpath
[DEBUG] Adding project dependency artifact: commons-collections to classpath
[DEBUG] Adding project dependency artifact: commons-beanutils to classpath
[DEBUG] Adding project dependency artifact: commons-logging to classpath
[DEBUG] Adding project dependency artifact: rome to classpath
[DEBUG] Adding project dependency artifact: jdom to classpath
[DEBUG] Adding project dependency artifact: fastjson to classpath
[DEBUG] Adding project dependency artifact: spring-webmvc to classpath
[DEBUG] Adding project dependency artifact: spring-context to classpath
[DEBUG] Adding project dependency artifact: spring-expression to classpath
[DEBUG] Adding project dependency artifact: spring-web to classpath
[DEBUG] Adding project dependency artifact: javax.servlet-api to classpath
[DEBUG] Adding project dependency artifact: spring-tx to classpath
[DEBUG] Adding project dependency artifact: aopalliance to classpath
[DEBUG] Adding project dependency artifact: jta to classpath
[DEBUG] joining on thread Thread[com.xiinnn.commonly.POJOJackson.main(),5,com.xiinnn.commonly.POJOJackson]
[WARNING]
javassist.NotFoundException: com.fasterxml.jackson.databind.node.BaseJsonNode
at javassist.ClassPool.get (ClassPool.java:430)
at com.xiinnn.commonly.POJOJackson.main (POJOJackson.java:32)
at org.codehaus.mojo.exec.ExecJavaMojo.doMain (ExecJavaMojo.java:375)
at org.codehaus.mojo.exec.ExecJavaMojo.doExec (ExecJavaMojo.java:364)
at org.codehaus.mojo.exec.ExecJavaMojo.lambda$execute$0 (ExecJavaMojo.java:286)
at java.lang.Thread.run (Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.525 s
[INFO] Finished at: 2024-11-17T23:15:38+08:00
[INFO] ------------------------------------------------------------------------
我看这明细不是已经Adding project dependency artifact: jackson-databind to classpath。为什么还报找不到。
pom文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xiinnn</groupId>
<artifactId>CTF-Java-Gadget</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<!-- javassist用于更方面构造类-->
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.27.0-GA</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>5.3.24</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
<dependency>
<groupId>rome</groupId>
<artifactId>rome</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.80</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.3.24</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
<!-- JTAReadObject2JNDI -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</project>
手动执行命令正常
java -Dfile.encoding=UTF-8 -classpath "D:\Program Files\Java\jdk1.8.0_73\jre\lib\rt.jar;.;%userprofile%\.m2\repository\org\javassist\javassist\3.27.0-GA\javassist-3.27.0-GA.jar;%userprofile%\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.14.1\jackson-databind-2.14.1.jar;%userprofile%\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.14.1\jackson-annotations-2.14.1.jar;%userprofile%\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.14.1\jackson-core-2.14.1.jar;%userprofile%\.m2\repository\org\springframework\spring-aop\5.3.24\spring-aop-5.3.24.jar;%userprofile%\.m2\repository\org\springframework\spring-beans\5.3.24\spring-beans-5.3.24.jar;%userprofile%\.m2\repository\org\springframework\spring-core\5.3.24\spring-core-5.3.24.jar;%userprofile%\.m2\repository\org\springframework\spring-jcl\5.3.24\spring-jcl-5.3.24.jar;%userprofile%\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar;%userprofile%\.m2\repository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;%userprofile%\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;%userprofile%\.m2\repository\rome\rome\1.0\rome-1.0.jar;%userprofile%\.m2\repository\jdom\jdom\1.0\jdom-1.0.jar;%userprofile%\.m2\repository\com\alibaba\fastjson\1.2.80\fastjson-1.2.80.jar;%userprofile%\.m2\repository\org\springframework\spring-webmvc\5.3.24\spring-webmvc-5.3.24.jar;%userprofile%\.m2\repository\org\springframework\spring-context\5.3.24\spring-context-5.3.24.jar;%userprofile%\.m2\repository\org\springframework\spring-expression\5.3.24\spring-expression-5.3.24.jar;%userprofile%\.m2\repository\org\springframework\spring-web\5.3.24\spring-web-5.3.24.jar;%userprofile%\.m2\repository\javax\servlet\javax.servlet-api\4.0.1\javax.servlet-api-4.0.1.jar;%userprofile%\.m2\repository\org\springframework\spring-tx\3.1.0.RELEASE\spring-tx-3.1.0.RELEASE.jar;%userprofile%\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;%userprofile%\.m2\repository\javax\transaction\jta\1.1\jta-1.1.jar" com.xiinnn.commonly.POJOJackson
输出classpath 对比
mvn:
C:\Users\IBM\.m2\repository\org\javassist\javassist\3.27.0-GA\javassist-3.27.0-GA.jar
C:\Users\IBM\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.14.1\jackson-databind-2.14.1.jar
C:\Users\IBM\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.14.1\jackson-annotations-2.14.1.jar
C:\Users\IBM\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.14.1\jackson-core-2.14.1.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-aop\5.3.24\spring-aop-5.3.24.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-beans\5.3.24\spring-beans-5.3.24.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-core\5.3.24\spring-core-5.3.24.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-jcl\5.3.24\spring-jcl-5.3.24.jar
C:\Users\IBM\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar
C:\Users\IBM\.m2\repository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar
C:\Users\IBM\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar
C:\Users\IBM\.m2\repository\rome\rome\1.0\rome-1.0.jar
C:\Users\IBM\.m2\repository\jdom\jdom\1.0\jdom-1.0.jar
C:\Users\IBM\.m2\repository\com\alibaba\fastjson\1.2.80\fastjson-1.2.80.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-webmvc\5.3.24\spring-webmvc-5.3.24.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-context\5.3.24\spring-context-5.3.24.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-expression\5.3.24\spring-expression-5.3.24.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-web\5.3.24\spring-web-5.3.24.jar
C:\Users\IBM\.m2\repository\javax\servlet\javax.servlet-api\4.0.1\javax.servlet-api-4.0.1.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-tx\3.1.0.RELEASE\spring-tx-3.1.0.RELEASE.jar
C:\Users\IBM\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar
C:\Users\IBM\.m2\repository\javax\transaction\jta\1.1\jta-1.1.jar
idea
D:\Program Files\Java\jdk1.8.0_73\jre\lib\charsets.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\deploy.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\access-bridge-64.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\cldrdata.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\dnsns.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\jaccess.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\jfxrt.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\localedata.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\nashorn.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\sunec.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\sunjce_provider.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\sunmscapi.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\sunpkcs11.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\zipfs.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\javaws.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\jce.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\jfr.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\jfxswt.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\jsse.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\management-agent.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\plugin.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\resources.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\rt.jar
G:\f2\src3\target\classes
C:\Users\IBM\.m2\repository\org\javassist\javassist\3.27.0-GA\javassist-3.27.0-GA.jar
C:\Users\IBM\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.14.1\jackson-databind-2.14.1.jar
C:\Users\IBM\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.14.1\jackson-annotations-2.14.1.jar
C:\Users\IBM\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.14.1\jackson-core-2.14.1.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-aop\5.3.24\spring-aop-5.3.24.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-beans\5.3.24\spring-beans-5.3.24.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-core\5.3.24\spring-core-5.3.24.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-jcl\5.3.24\spring-jcl-5.3.24.jar
C:\Users\IBM\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar
C:\Users\IBM\.m2\repository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar
C:\Users\IBM\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar
C:\Users\IBM\.m2\repository\rome\rome\1.0\rome-1.0.jar
C:\Users\IBM\.m2\repository\jdom\jdom\1.0\jdom-1.0.jar
C:\Users\IBM\.m2\repository\com\alibaba\fastjson\1.2.80\fastjson-1.2.80.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-webmvc\5.3.24\spring-webmvc-5.3.24.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-context\5.3.24\spring-context-5.3.24.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-expression\5.3.24\spring-expression-5.3.24.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-web\5.3.24\spring-web-5.3.24.jar
C:\Users\IBM\.m2\repository\javax\servlet\javax.servlet-api\4.0.1\javax.servlet-api-4.0.1.jar
C:\Users\IBM\.m2\repository\org\springframework\spring-tx\3.1.0.RELEASE\spring-tx-3.1.0.RELEASE.jar
C:\Users\IBM\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar
C:\Users\IBM\.m2\repository\javax\transaction\jta\1.1\jta-1.1.jar
发现mvn缺少了以下路径
D:\Program Files\Java\jdk1.8.0_73\jre\lib\charsets.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\deploy.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\access-bridge-64.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\cldrdata.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\dnsns.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\jaccess.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\jfxrt.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\localedata.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\nashorn.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\sunec.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\sunjce_provider.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\sunmscapi.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\sunpkcs11.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\zipfs.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\javaws.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\jce.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\jfr.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\jfxswt.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\jsse.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\management-agent.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\plugin.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\resources.jar
D:\Program Files\Java\jdk1.8.0_73\jre\lib\rt.jar
G:\f2\src3\target\classes
2024年11月18日11:55:39 POM 文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xiinnn</groupId>
<artifactId>CTF-Java-Gadget</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<!-- javassist用于更方面构造类-->
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.27.0-GA</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>5.3.24</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
<dependency>
<groupId>rome</groupId>
<artifactId>rome</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.80</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.3.24</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
<!-- JTAReadObject2JNDI -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<mainClass>com.xiinnn.commonly.POJOJackson</mainClass>
<classpathScope>compile</classpathScope>
<!-- 确保使用项目的完整依赖路径 -->
<additionalClasspathElements>
<additionalClasspathElement>${project.build.sourceDirectory}</additionalClasspathElement>
<additionalClasspathElement>${project.build.outputDirectory}</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins>
</build>
</project>
我提供一下我的POM文件,你可以对比一下
POM文件
然后再次运行你的命令:
补充
使用 LoaderClassPath 方法,确保 javassist 使用当前线程的类加载器来查找类路径,这样可以更好地处理依赖关系。以下是具体的代码示例:
可以将这段代码添加到你项目的主类或需要使用 javassist 的类中。假设你有一个主类 Main,你可以在 main 方法中添加这段代码。