Quantcast

LTW in websphere 7

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

LTW in websphere 7

zjtian
This post has NOT been accepted by the mailing list yet.
Hi,All Currently I have a requirement that I need to change the function of the 3th party jar and it will be deployed in then websphere 7. I study aspectj just now. Here i have the below question: Question1: i have read the document about ltw,but it doesn't tell us how to implement the classloader. how to write the custom classloader Can you help me? Thanks & Best Regards.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LTW in websphere 7

oroger
zjtian,

From what I understood, you need to intercept some method calls in a 3th party library used by your application.

I am not sure you need to bother with classloader for this kind of task. Simply add the javaagent as described in the LTW documentation. You could then register your aspect with an Around advice and change the code. You do not need to call proceed() if you simply need to replace the code with your own.

Hope this helps,

Olivier
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LTW in websphere 7

zjtian
This post has NOT been accepted by the mailing list yet.
oroger hi,oroger There is a mdb jar in my lib, the mdb jar from temenos company. I need to chanage the onMessage method, but i have the source.My server must be websphere 7 and and was will be install in aix. I think that java-agent is not enough facile. So do you guide me how to use the classloader way to solve the problem? I expect your help. Thans & best regards!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LTW in websphere 7

zjtian
This post has NOT been accepted by the mailing list yet.
i haven't the java soure of mdb jar.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LTW in websphere 7

zjtian
This post has NOT been accepted by the mailing list yet.
In reply to this post by oroger
I haven't the java source of mdb jar
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LTW in websphere 7

zjtian
This post has NOT been accepted by the mailing list yet.
In reply to this post by oroger
hi,oroger There is a mdb jar in my lib, the mdb jar from temenos company. I need to chanage the onMessage method, but i have the source.My server must be websphere 7 and and was will be install in aix. I think that java-agent is not enough facile. So do you guide me how to use the classloader way to solve the problem? I expect your help. Thans & best regards!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LTW in websphere 7

oroger
In reply to this post by zjtian
I have not use other method than the java-agent so I cannot really help you on this.
Concerning WebSphere however, this method worked nicely on Windows (have not tried AIX yet).

I simply added "-javaagent:C:\was-cluster\soliam-fo-home\ext\aspectjweaver.jar" to the JVM generic parameters. I also had to modify the %WAS%/java/jre/security/securty.policy file according to https://bugs.eclipse.org/bugs/show_bug.cgi?id=74246

Not having the source code does not matter as long as you know the signature of the method you need to intercept.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LTW in websphere 7

zjtian
This post has NOT been accepted by the mailing list yet.
hi,oroger
You say that you modified %WAS%/java/jre/security/securty.policy,but there is no the file securty in websphere7, and there are java.policy,java.security and javaws.policy files in the directory %was_home%\AppServer\java\jre\lib\security of was7.
Question 1: which file should be modify?


Question 2: Which file did you add  the  parameter "-javaagent:C:\was-cluster\soliam-fo-home\ext\aspectjweaver.jar  into?




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LTW in websphere 7

zjtian
This post has NOT been accepted by the mailing list yet.
In reply to this post by oroger
do add "-javaagent:C:\was-cluster\soliam-fo-home\ext\aspectjweaver.jar" to file jvm.cfg?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LTW in websphere 7

oroger
I am sorry I wrote that response a bit too quickly.

The file I was refernig to was java.policy.
Concerning the aspectjweaver.jar you should adapt the path to point to the location of the file on your file system.

-javaagent:<PATH>/aspectjweaver.jar

I used the web console to add it to the Generic JVM arguments (in Application servers >> <server name> >>  Java and Process Management >> Process definition >> Java Virtual Machine).
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LTW in websphere 7

oroger
In reply to this post by zjtian
It appears that the entry has been added to the

%WAS%\profiles\<profile>\config\cells\<cellName>\nodes\<nodeName>\servers\<serverName>\server.xml file.

    <jvmEntries xmi:id="JavaVirtualMachine_1311932541239" verboseModeClass="false" verboseModeGarbageCollection="false" verboseModeJNI="false" initialHeapSize="256" maximumHeapSize="1536" runHProf="true" hprofArguments="" debugMode="false" debugArgs="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7777" genericJvmArguments="-Dlog4j.debug=true -javaagent:C:\was-cluster\soliam-fo-home\ext\aspectjweaver.jar" executableJarFileName="" disableJIT="false">
      <systemProperties xmi:id="Property_1311932541249" name="com.ibm.security.jgss.debug" value="off" required="false"/>
      <systemProperties xmi:id="Property_1311932541250" name="com.ibm.security.krb5.Krb5Debug" value="off" required="false"/>
    </jvmEntries>
  </processDefinitions>

Hope this helps
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LTW in websphere 7

zjtian
This post has NOT been accepted by the mailing list yet.
In reply to this post by oroger
Ok,thank you very very much.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LTW in websphere 7

zjtian
This post has NOT been accepted by the mailing list yet.
In reply to this post by oroger
hi,oroger
I added "-javaagent:D:\aspectj1.6\lib\aspectjweaver.jar" to %WAS%\profiles\<profile>\config\cells\<cellName>\nodes\<nodeName>\servers\<serverName>\server.xml file. The relational code like the fellowing:
<jvmEntries xmi:id="JavaVirtualMachine_1183122130078" verboseModeClass="false" verboseModeGarbageCollection="false" verboseModeJNI="false" runHProf="false" hprofArguments="" debugMode="false" debugArgs="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7777" genericJvmArguments="-Xquickstart <b>-javaagent:D:\aspectj1.6\lib\aspectjweaver.jar" executableJarFileName="" disableJIT="false">


But the was7 stard failly.

************* End Display Current Environment *************
线程 "main" 中发生异常java.lang.NoClassDefFoundError: javaagent:D:\aspectj1.6\lib\aspectjweaver.jar
Caused by: java.lang.ClassNotFoundException: javaagent:D:\aspectj1.6\lib\aspectjweaver.jar
        at java.net.URLClassLoader.findClass(URLClassLoader.java:421)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:652)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:346)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:618)
Could not find the main class: javaagent:D:\aspectj1.6\lib\aspectjweaver.jar.  Program will exit.
---- AspectJ Properties ---
AspectJ Compiler 1.6.11 built on Tuesday Mar 15, 2011 at 15:31:04 GMT
---- Dump Properties ---
Dump file: Unknown
Dump reason: java.security.AccessControlException
Dump on exception: true
Dump at exit condition: abort
---- Exception Information ---
java.security.AccessControlException: Access denied (java.util.PropertyPermission aj.weaving.verbose read)
        at java.security.AccessController.checkPermission(AccessController.java:108)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:533)
        at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1286)
        at java.lang.System.getProperty(System.java:383)
        at java.lang.System.getProperty(System.java:367)
        at java.lang.Boolean.getBoolean(Boolean.java:233)
        at org.aspectj.weaver.tools.WeavingAdaptor.getVerbose(WeavingAdaptor.java:158)
        at org.aspectj.weaver.tools.WeavingAdaptor.<init>(WeavingAdaptor.java:78)
        at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.<init>(ClassLoaderWeavingAdaptor.java:96)
        at org.aspectj.weaver.loadtime.Aj$WeaverContainer.getWeaver(Aj.java:248)
        at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:90)
        at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:54)
        at sun.instrument.TransformerManager.transform(TransformerManager.java:181)
        at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:377)
        at java.lang.ClassLoader.defineClassImpl(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:274)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:69)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:521)
        at java.net.URLClassLoader.access$300(URLClassLoader.java:66)
        at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:985)
        at java.security.AccessController.doPrivileged(AccessController.java:284)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:416)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:652)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:618)
        at org.eclipse.core.launcher.Main.invokeFramework(Main.java:337)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
        at org.eclipse.core.launcher.Main.run(Main.java:981)
        at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:340)
        at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:110)


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



 E org.aspectj.weaver.tools.Jdk14Trace error com/ibm/ejs/ras/RasHelper$3
                                 java.security.AccessControlException: Access denied (java.util.PropertyPermission aj.weaving.verbose read)
        at java.security.AccessController.checkPermission(AccessController.java:108)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:533)
        at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1286)
        at java.lang.System.getProperty(System.java:383)
        at java.lang.System.getProperty(System.java:367)
        at java.lang.Boolean.getBoolean(Boolean.java:233)
        at org.aspectj.weaver.tools.WeavingAdaptor.getVerbose(WeavingAdaptor.java:158)
        at org.aspectj.weaver.tools.WeavingAdaptor.<init>(WeavingAdaptor.java:78)
        at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.<init>(ClassLoaderWeavingAdaptor.java:96)
        at org.aspectj.weaver.loadtime.Aj$WeaverContainer.getWeaver(Aj.java:248)
        at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:90)
        at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:54)
        at sun.instrument.TransformerManager.transform(TransformerManager.java:181)
        at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:377)
        at java.lang.ClassLoader.defineClassImpl(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:274)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:160)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:550)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:520)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:451)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassName(ClasspathManager.java:430)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:417)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:188)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:334)
        at org.eclipse.osgi.framework.internal.core.SingleSourcePackage.loadClass(SingleSourcePackage.java:37)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:374)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:347)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:618)
        at com.ibm.ejs.ras.RasHelper.setSystemOut(RasHelper.java:1093)
        at com.ibm.ejs.ras.SystemOutStream.replaceSystemOutStream(SystemOutStream.java:193)
        at com.ibm.ws.runtime.WsServerImpl.redirectStream(WsServerImpl.java:428)
        at com.ibm.ws.runtime.WsServerImpl.bootLoggingServices(WsServerImpl.java:374)
        at com.ibm.ws.runtime.WsServerImpl.start(WsServerImpl.java:190)
        at com.ibm.ws.runtime.WsServerImpl.main(WsServerImpl.java:666)
        at com.ibm.ws.runtime.WsServer.main(WsServer.java:59)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:600)
        at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:213)
        at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:93)
        at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:74)
        at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:600)
        at org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
        at org.eclipse.core.launcher.Main.run(Main.java:981)
        at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:340)
        at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:110)



what is the reason?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: LTW in websphere 7

oroger
There are probably missing some permissions in java.policy.

I used the configuration described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=74246
Loading...