Fix JavaAgent to work with both java6 and java7

Fix components name to work with Java6 and Java7.
Add if statements to properly find AppContext.