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。为什么还报找不到。
<?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
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
<?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文件,你可以对比一下
<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>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</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.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<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>
然后再次运行你的命令:
mvn exec:java -Dexec.classpathScope=compile -Dexec.mainClass="com.xiinnn.commonly.POJOJackson"
补充
使用 LoaderClassPath 方法,确保 javassist 使用当前线程的类加载器来查找类路径,这样可以更好地处理依赖关系。以下是具体的代码示例:
ClassPool classPool = ClassPool.getDefault();
classPool.appendClassPath(new LoaderClassPath(Thread.currentThread().getContextClassLoader()));
CtClass ctClass = classPool.get("com.fasterxml.jackson.databind.node.BaseJsonNode");
可以将这段代码添加到你项目的主类或需要使用 javassist 的类中。假设你有一个主类 Main,你可以在 main 方法中添加这段代码。
这个错误发生的原因可能是 jackson-databind
库没有被正确地加载或者类路径(classpath)中存在冲突。尽管 Maven 在调试输出中显示已经添加了 jackson-databind
到类路径中,但仍然出现了 javassist.NotFoundException
,这通常表示在运行时无法找到指定的类。
可能的解决方案包括:
jackson-databind
的版本:jackson-databind
版本与代码中引用的版本一致。有时候,如果项目中包含了多个版本的同一个库,可能会导致类加载问题。mvn dependency:tree
命令来查看项目的依赖树,检查是否有其他依赖间接引入了不同版本的 jackson-databind
。mvn clean install
。pom.xml
文件中的配置正确无误,特别是关于依赖和插件的部分。jackson-databind
类可以被正确加载。-e
和 -X
选项重新运行 Maven:mvn exec:java -Dexec.classpathScope=compile -Dexec.mainClass="com.xiinnn.commonly.POJOJackson" -e -X
通过这些步骤,你应该能够诊断并解决这个问题。如果问题仍然存在,可能需要更深入地检查代码和配置。
原本注释是要用的,但只要一打包就开始报错: Could not open requirements file: [Errno 2] No such file or directory: './requirements.txt' 报错很明确就是文件找不到,不过,文件是存在的,前面copy进去,为了确保文件存在: 如下强制修改成这样,用ls查看,文件存在 用一个相似结构的项目的dockerfile 结
问题内容: 我试图找出为什么我的报告停止工作后我添加了一个报表给它。我已经确认并尝试过所有类似的问题在这里,这里和这里。没有成功。子报表肯定位于同一目录中。定义看起来像: $ P {SUBREPORT_DIR}在哪里 而且仍然出现错误: 为什么?? 问题答案: 在第一条消息中 在哪里 是目录,但不是文件名。这是第一个错误。 第二个:有时jasper找不到子报表,即使路径正确也是如此。 解决此问题的
我正在用PHP开发一个jasper报表,我尝试了嵌入式jasper Library0.9d--phpJasperLibrary-master在修复了库中的部分代码后,工作正常,但不能显示对我开发jasper报表非常重要的表格格式,所以我放弃了这种方法,建立了一个jasper服务器。 我已经通过composer并使用以下链接中的示例代码安装了PHP客户端(V2.0) http://community
问题内容: 我有一个由Eclipse生成的.jar,我无法在其他计算机(与Windows XP)上运行。出现“找不到主类。程序将退出”消息。那台计算机可以在Netbeans生成的另一个.jar上正常运行,所以我想JRE并不是问题。我更新了JRE,但没有改变。问题是什么? 更新:我忘了提,我做了一个可运行的jar文件。在另外两台计算机上,它可以正常工作(win 7和XP),但在特定计算机上则不能。
问题内容: 所有, 我的类路径已设置为以下文件夹: 我所有的Java文件和类文件都在中列出的文件夹下。 但是在运行in 文件夹时出现以下错误: 谁能帮我理解这里的原因? 问题答案: 您在包装内。您应该坐在包根目录中。上一个文件夹。 然后使用重新执行它。 就是说,您不应该使用环境变量。您的当前也是无效的。未加引号的路径名中有空格。另外,该文件夹不应放在类路径中。只需使用like这样的参数(坐在包根文
似乎不知道为什么这个简单的程序在我的电脑上停止工作。我编译的程序直到视窗更新都很好,但是当我试图编译一个新程序时,我得到了以下信息。我附上了程序的图片和命令提示符错误信息。我检查了CLASSPATH,它看起来很好。 程序-HelloWorldApp。JAVA 执行javac HelloWorldApp。爪哇——一切都很好 执行java HelloWorldApp- 错误:在HelloWorldAp