I am trying to do the example in the Spring in Action 3ed book on p.33 section 2.1.2. I can't get the sample code to output "JUGGLING 3 BEANBAGS".
The book says on p.34 a quarter of the way down, "To give Duke a try, you can load the Spring application context using the following code: "
ApplicationContext ctx = new ClassPathXmlApplicationContext("com/springinaction/springidol/spring-idol.xml");
Performer performer = (Performer) ctx.getBean("duke");
performer.perform();
I added the code snippet above to the main method that I created inside of the Juggler.class. I got an error message. Can someone tell me what I'm doing wrong here? Thank you.
Here is the spring-idol.xml configuration file that is given to us:
Here is the parent class Performer:
Here is the child class Juggler:
Here is the error message:
cd C:\Users\MSC\Documents\sia3code\springidol; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.7.0_40" "\"C:\\Program Files\\NetBeans 7.3.1\\java\\maven\\bin\\mvn.bat\"" "-Dexec.args=-classpath %classpath com.springinaction.springidol.Test" "-Dexec.executable=C:\\Program Files\\Java\\jdk1.7.0_40\\bin\\java.exe" process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
Scanning for projects...
Some problems were encountered while building the effective model for com.springinaction:springidol:jar:3.0.0
'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ com.springinaction:example-code:3.0.0, C:\Users\MSC\Documents\sia3code\pom.xml, line 23, column 15
It is highly recommended to fix these problems because they threaten the stability of your build.
For this reason, future
Maven versions might no longer support building such malformed projects.
------------------------------------------------------------------------
Building Spring in Action Spring Idol 3.0.0
------------------------------------------------------------------------
[resources:resources]
[debug] execute contextualize
Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
Copying 2 resources
[compiler:compile]
File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
Compiling 1 source file to C:\Users\MSC\Documents\sia3code\springidol\target\classes
[exec:exec]
Error: Could not find or load main class com.springinaction.springidol.Test
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1.700s
Finished at: Mon Sep 16 17:55:40 EDT 2013
Final Memory: 11M/108M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project springidol: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException