[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I fix an InvocationTargetException in my Maven build?

Posted on 2005-05-03
2
Medium Priority
?
355 Views
Last Modified: 2009-12-16
Hi,

   I'm trying to build my project and I keep getting an InvocationTargetException.  I have included the stacktrace below.  I also have Xerces, Xalan, JAXP and XML APIs in my dependency list so I don't have the same problem as the solution expressed in other online forums.

-------------

C:\eclipse\workspace\DirectoryChangeNotifier-BO\maven>maven build -Denv=QA -Dver
=0_0_0_1 -Drel=0_0_0_1
 __  __
|  \/  |__ _Apache__ ___
| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
|_|  |_\__,_|\_/\___|_||_|  v. 1.0.2

[MethodExpression] Cannot evaluate expression
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.commons.betwixt.expression.MethodExpression.evaluate(Metho
dExpression.java:96)
        at org.apache.commons.betwixt.io.AbstractBeanWriter.writeContent(Abstrac
tBeanWriter.java:658)
        at org.apache.commons.betwixt.io.AbstractBeanWriter.writeRestOfElement(A
bstractBeanWriter.java:539)
        at org.apache.commons.betwixt.io.AbstractBeanWriter.write(AbstractBeanWr
iter.java:481)
        at org.apache.commons.betwixt.io.AbstractBeanWriter.writeContent(Abstrac
tBeanWriter.java:643)
        at org.apache.commons.betwixt.io.AbstractBeanWriter.writeRestOfElement(A
bstractBeanWriter.java:539)
        at org.apache.commons.betwixt.io.AbstractBeanWriter.write(AbstractBeanWr
iter.java:513)
        at org.apache.commons.betwixt.io.AbstractBeanWriter.write(AbstractBeanWr
iter.java:233)
        at org.apache.commons.betwixt.io.AbstractBeanWriter.write(AbstractBeanWr
iter.java:162)
        at org.apache.commons.betwixt.io.BeanWriter.write(BeanWriter.java:217)
        at org.apache.maven.MavenUtils.getProjectString(MavenUtils.java:432)
        at org.apache.maven.MavenUtils.getInterpolatedPOM(MavenUtils.java:383)
        at org.apache.maven.MavenUtils.getJellyProject(MavenUtils.java:360)
        at org.apache.maven.MavenUtils.getProject(MavenUtils.java:144)
        at org.apache.maven.MavenUtils.getProject(MavenUtils.java:122)
        at org.apache.maven.MavenSession.initializeRootProject(MavenSession.java
:232)
        at org.apache.maven.MavenSession.initialize(MavenSession.java:172)
        at org.apache.maven.cli.App.doMain(App.java:475)
        at org.apache.maven.cli.App.main(App.java:1239)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at com.werken.forehead.Forehead.run(Forehead.java:551)
        at com.werken.forehead.Forehead.main(Forehead.java:581)
Caused by: java.lang.NumberFormatException: For input string: "4.0.0"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.
java:48)
        at java.lang.Integer.parseInt(Integer.java:477)
        at java.lang.Integer.parseInt(Integer.java:518)
        at org.apache.maven.project.Project.isPomCurrent(Project.java:1143)
        ... 29 more
build:start:

build:
    [echo] Performing a clean
clean:clean:
    [delete] Deleting directory C:\maven\builds\DirectoryChangeNotifier-BO

clean:

    [echo] Updating source from repository and placing in: c:/eclipse/workspace/

get-code:
    [echo] performing cvs
    [cvs] cvs checkout: cwd=C:\eclipse\workspace ,current=C:\eclipse\workspace
    [cvs] ? DirectoryChangeNotifier-BO/package/DirectoryChangeNotifier-BO.sar/ME
TA-INF
    [cvs] ? DirectoryChangeNotifier-BO/package/DirectoryChangeNotifier-BO.sar/co
m
    [cvs] ? DirectoryChangeNotifier-BO/package/DirectoryChangeNotifier-BO.sar/ma
ppings
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/bin
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/maven
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/package
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/package/DirectoryChang
eNotifier-BO.sar
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/src
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/src/META-INF
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/src/com
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/src/com/
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/src/com/
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/src/com/directorychangenotifier
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/src/com/directorychangenotifier/bo
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/src/com/directorychangenotifier/bo/base
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/src/com/directorychangenotifier/bo/dao
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/src/com/directorychangenotifier/bo/loader
    [cvs] cvs server: Updating DirectoryChangeNotifier-BO/src/mappings

    [echo] Beginning compile
java:prepare-filesystem:
    [mkdir] Created dir: C:\maven\builds\DirectoryChangeNotifier-BO\classes

java:compile:
    [echo] Compiling to c:/maven/builds/DirectoryChangeNotifier-BO/classes
    [echo]
==========================================================

  NOTE: Targetting JVM 1.4, classes
  will not run on earlier JVMs

==========================================================

    [javac] Compiling 61 source files to C:\maven\builds\DirectoryChangeNotifier
-BO\classes

    [echo] Packaging SAR
java:prepare-filesystem:

java:compile:
    [echo] Compiling to c:/maven/builds/DirectoryChangeNotifier-BO/classes
    [echo]
==========================================================

  NOTE: Targetting JVM 1.4, classes
  will not run on earlier JVMs

==========================================================


java:jar-resources:
Copying 11 files to c:\maven\builds\DirectoryChangeNotifier-BO\classes\mappings
Copying 1 file to c:\maven\builds\DirectoryChangeNotifier-BO\classes\META-INF

test:prepare-filesystem:
    [mkdir] Created dir: C:\maven\builds\DirectoryChangeNotifier-BO\test-classes

    [mkdir] Created dir: C:\maven\builds\DirectoryChangeNotifier-BO\test-reports


test:test-resources:

test:compile:
    [echo] No test source files to compile.

test:test:
    [echo] No tests to run.

jar:jar:
    [jar] Building jar: C:\maven\builds\DirectoryChangeNotifier-BO\DirectoryChan
geNotifier-BO-cvs.tag.jar

jar:

    [echo] Deploying to DirectoryChangeNotifier

BUILD FAILED
File...... C:\eclipse\workspace\DirectoryChangeNotifier-BO\maven\maven.xml
Element... ant:copy
Line...... 25
Column.... 156
Warning: Could not find file C:\maven\builds\DirectoryChangeNotifier-BO\Director
yChangeNotifier-BO-.sar to copy.
Total time: 11 seconds
Finished at: Tue May 03 16:08:07 EDT 2005
0
Comment
Question by:CircularReference
2 Comments
 

Author Comment

by:CircularReference
ID: 13921865
I fixed my own question.  Do I get 500 points?  Just kidding.  I think the answer might be valuable to others so I'm including it regardless.  

Maven is apparently not as stable yet as ANT.  Therefore, I was encountering an issue when I tried to append the $cvs.tag variable to the filename.  It was causing an InvocationTargetException in the standard <attainGoal name="jar">.  This exception didn't halt processing of the build file but later in my build file when the packaged SAR was supposed to be copied to another directory, it failed.  This is can be seen in the description I attached above.  

Narrowing it down to this possibility, I tried substituting a call to ant's JAR Task instead and this worked.  I've included the task below...

<ant:jar destfile="${maven.build.dir}/${cvsname}-${ver}.sar"/>

When in doubt with Maven, substitute in the Ant tasks.  Maven still has value for it's other features but calls to Ant for your build are not a bad idea.
0
 

Accepted Solution

by:
EE_AutoDeleter earned 0 total points
ID: 14099742
CircularReference,
Because you have presented a solution to your own problem which may be helpful to future searches, this question is now PAQed and your points have been refunded.

EE_AutoDeleter
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month19 days, 11 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question