NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Setting javaagent in maven project for run action in IDE?

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
huima



Joined: 24 Feb 2010
Posts: 4

PostPosted: Sat Aug 21, 2010 5:48 pm    Post subject: Setting javaagent in maven project for run action in IDE? Reply with quote

Hi,

I tried to figure out how to set javaagent in maven project using spring for situations when I run one class from the IDE.

Same code which is run as an unit test works, as surefire-plugin has following configuration:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>pertest</forkMode>
<argLine>-javaagent:${settings.localRepository}/org/springframework/spring-instrument/${spring.version}/spring-instrument-${spring.version}.jar </argLine>
<useSystemClassloader>true</useSystemClassloader>
<encoding>UTF-8</encoding>
</systemProperties>
</configuration>
</plugin>

However while running same code inside main class from Netbeans ide fails with:

Caused by: java.lang.IllegalStateException: ClassLoader [sun.misc.Launcher$AppClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar


I have tried to find how to set javaagent for the exec, but no avail.

I tried to set export MAVEN_OPTS code to netbeans.conf in my own configuration directory and in Netbeans distribution, but that does not seem to help.

Unlike Eclipse, Netbeans does not have - or I don't know where it is - a dialog/menu where used environment variables would be listed to see whether the settings are in use.

How I tried to set the variables:

export MAVEN_OPTS="-noverify -javaagent:/Users/huima/.m2/repository/org/springframework/spring-instrument/3.0.3.RELEASE/spring-instrument-3.0.3.RELEASE.jar"

My environment is:

Product Version: NetBeans IDE 6.9 (Build 201006101454)
Java: 1.6.0_20; Java HotSpot(TM) 64-Bit Server VM 16.3-b01-279
System: Mac OS X version 10.6.4 running on x86_64; MacRoman; en_US (nb)
Userdir: /Users/huima/.netbeans/6.9


Any thoughts and help is appreciated.
Back to top
huima



Joined: 24 Feb 2010
Posts: 4

PostPosted: Sat Aug 21, 2010 5:57 pm    Post subject: Reply with quote

Actually if I run a simple test program, which prints out the environment variables, then MAVEN_OPTS show what they are supposed to show:

Environment Variables
TERM = xterm
JAVA_HOME = /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
SHLVL = 3
TERM_PROGRAM = iTerm.app
__CF_USER_TEXT_ENCODING = 0x1F5:0:0
MANPATH = /sw/share/man:/usr/share/man:/usr/local/share/man:/usr/local/git/share/man:/usr/X11/man:/sw/lib/perl5/5.10.0/man:/usr/X11R6/man
PWD = /Users/huima/NetBeansProjects/customerprojects/EtnofitnessAdminBackend
VERSIONER_PERL_PREFER_32_BIT = yes
LOGNAME = huima
J2D_PIXMAPS = shared
JAVA_MAIN_CLASS_93558 = org.codehaus.classworlds.Launcher
_ = /usr/bin/java
SSH_AUTH_SOCK = /tmp/launch-P9XTnL/Listeners
COLORFGBG = 0;15
SHELL = /bin/bash
APP_NAME_93184 = NetBeans
TMPDIR = /var/folders/wW/wW68cmK8FnG0nTMxskdTYE+++TI/-Tmp-/
MAVEN_OPTS = -noverify -javaagent:/Users/huima/.m2/repository/org/springframework/spring-instrument/3.0.3.RELEASE/spring-instrument-3.0.3.RELEASE.jar
APP_ICON_93184 = /Applications/NetBeans/NetBeans 6.9.app/Contents/MacOS/../Resources/NetBeans/bin/../nb/netbeans.icns
NB_EXEC_MAVEN_PROCESS_UUID = 76aab482-d052-4d8b-933d-3f9a2cc44691
JAVA_MAIN_CLASS_93184 = org.netbeans.Main
PATH = /sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/usr/X11R6/bin
COMMAND_MODE = unix2003
DISPLAY = /tmp/launch-97JJXW/org.x:0
USER = huima
HOME = /Users/huima
Apple_PubSub_Socket_Render = /tmp/launch-KqAEc1/Render
INFOPATH = /sw/share/info:/sw/info:/usr/share/info
PERL5LIB = /sw/lib/perl5:/sw/lib/perl5/darwin

Any thoughts what could cause that?
Back to top
Mikey2



Joined: 31 Jul 2011
Posts: 1

PostPosted: Sun Jul 31, 2011 9:21 pm    Post subject: Reply with quote

Did you ever fix this? If so please report the solution below so I will know it too Laughing
Back to top
jerry0503222



Joined: 01 Aug 2011
Posts: 14

PostPosted: Mon Aug 01, 2011 7:24 am    Post subject: Reply with quote

Did you ever fix this? If so please report the solution below so I will know it too Laughing






Coach Handbags,Office 2007,Office 2010
Back to top
jiangjiang



Joined: 06 Aug 2011
Posts: 3

PostPosted: Mon Aug 08, 2011 4:59 am    Post subject: DRESS Reply with quote

Wedding Dresses online

Therefore we view that there is a number of things that you must keep thoughts party dresses for womenonce you are trying for purchase junior clothesin larger sizes and given that you keep them in search and shops; you can in fact get an appropriate Mother Of The Bride Dressesclothes for them who really should wear full figured garments and they'll look stylish just
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo