Results 1 to 3 of 3
Thread: Javassist with Maven
- 02-01-2011, 08:53 PM #1
Member
- Join Date
- Dec 2010
- Posts
- 8
- Rep Power
- 0
Javassist with Maven
I'm trying to do some byte code manipulation with Javassist using Maven. I keep getting a compilation error:
Java Code:[pathToTheFile]:[59,18] cannot access com.sun.jdi.connect.IllegalConnectorArgumentsException class file for com.sun.jdi.connect.IllegalConnectorArgumentsException not found HotSwapper hs = new HotSwapper(debugPort);
It's as if the JDK is missing a class file. I have the sun JDK installed and I know that maven is using it because when I do a mvn -v call it gives me this (I'm using Ubuntu by the way):
Java Code:Apache Maven 2.2.1 (rdebian-1) Java version: 1.6.0_22 Java home: /usr/lib/jvm/java-6-sun-1.6.0.22/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux" version: "2.6.31-22-generic" arch: "amd64" Family: "unix"
I have this as my pom file (this is currently just a test project to make sure that I can get everything set up correctly):
Java Code:<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>test-bytecode</groupId> <artifactId>test-bytecode</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>test-bytecode</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>javassist</groupId> <artifactId>javassist</artifactId> <version>3.9.0.GA</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.0</version> <configuration> <optimize>true</optimize> <source>6</source> <target>6</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.7.2</version> <configuration> <argLine>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</argLine> </configuration> </plugin> </plugins> </build> </project>
Any ideas on how to fix this problem?
- 02-01-2011, 09:38 PM #2
Member
- Join Date
- Dec 2010
- Posts
- 8
- Rep Power
- 0
Turns out it wasn't loading the tools.jar library in the jdk lib folder. I added this to the pom file and it worked:
Java Code:<dependency> <groupId>sun.jdk</groupId> <artifactId>tools</artifactId> <version>1.5.0</version> <scope>system</scope> <systemPath>${java.home}/../lib/tools.jar</systemPath> </dependency>
- 02-01-2011, 09:42 PM #3
Member
- Join Date
- Dec 2010
- Posts
- 8
- Rep Power
- 0
I should note that this solution apparently doesn't work on mac's. We've replaced the dependency with a profile instead:
Java Code:<profiles> <profile> <id>default-tools.jar</id> <activation> <property> <name>java.vendor</name> <value>Sun Microsystems Inc.</value> </property> </activation> <dependencies> <dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId> <version>1.5.0</version> <scope>system</scope> <systemPath>${java.home}/../lib/tools.jar</systemPath> </dependency> </dependencies> </profile> </profiles>
Similar Threads
-
Using Maven
By tascoa in forum New To JavaReplies: 0Last Post: 08-21-2009, 03:45 PM -
Maven plugin for eclipse + "Updating Maven Dependencies" problem??
By sbutt in forum EclipseReplies: 0Last Post: 04-20-2009, 06:26 PM -
Maven
By Java Tutorial in forum Java TutorialReplies: 0Last Post: 06-02-2008, 12:58 PM -
Maven or ANT
By goldhouse in forum Reviews / AdvertisingReplies: 0Last Post: 08-09-2007, 08:01 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks