Re: Re: What's wrong?

"jianxiong pang" <[email protected]> Fri, 2 May 2003 16:06:41 +0100
Newsgroups gmane.comp.java.aspectwerkz
Message-ID <[email protected]>
thanks to Alex. I am able to run the caching example in offline mode now.

To help the new comer. (I am using a Win2K professional box)

before running the example.


be sure:

1. to create a folder named "_metaData " under your aspectwerkz home.(again,
thanks to Alex), this is a default folder for meta-data. Otherwise, you need
to specify a user-defined folder for this purpose.
2. all the class files (not source files) must in place. This is important,
because aspectwerkz will transform these classes one after another.Be
careful, It is the third command-line option that should point to those
class files. That's the weaving process. My command is as follow:

aspectwerkz -offline
c:\project\workspace\learning\src\samples\examples\aspects\aspectwerkz.xml
c:\project\workspace\learning\bin c:\project\workspace\learning\src

don't forget to let the package statement consistent with your deployment
file (i.e. the xml file), in my case, I have changed the statement from
"examples.caching" to "samples.examples.aspects" (for CachingAdvice.java)
and "samples.examples.core.TargetFea". below is the xml file.

<?xml version="1.0"?>

<aspectwerkz>

    <advice name="caching"
        advice="samples/examples/aspects/caching/CachingAdvice"
        deploymentModel="perJVM"/>

    <aspect class="samples.examples.core.targetFea.Target">
        <pointcut type="method" pattern="methodToCache">
                <advice-ref name="caching"/>
        </pointcut>
    </aspect>

</aspectwerkz>

3. After the transformation, you run the transformed class (with Main
method) as usual, remember to specify all the necessary jar files (some run
time liberary) in your classpath.


Good luck!


jianxiong


> create a _metaData dir in your aspectwerkz_home, even if you don't use
meta
> data features.
> (v 0.4, check source of aspectwerkz.definition.AspectWerkzDefinition )
>
> May be you can use another name, using a command line option.
>
> Alex
>
>
> "jianxiong pang" <[email protected]> wrote in message
> news:[email protected]...
> Can anybody in this community help me sort out the problems below?
> I have set ASPECTWERKZ_HOME.
>
> Cheers!
>
> Jianxiong
>
>
> C:\aspectwerkz>
>
C:\aspectwerkz>java -Daspectwerkz.definition.file=c:\aspectwerkz\src\samples
> \caching.xml
>                     -Daspectwerkz.src.dir=examples\caching\Target.class
>                     -Daspectwerkz.home=c:\aspectwerkz
>                     -Dorg.cs3.jmangler.initfile=c:\aspectwerkz\config\jman
gl
> er-order.config
>                     -cp .;c:\aspectwerkz\lib\aspectwerkz-0.4.jar;
>                         c:\aspectwerkz\lib\dom4j-1.3.jar;
>                         c:\aspectwerkz\lib\qdox-1.1.jar;
>                         c:\aspectwerkz\lib\concurrent-1.3.1.jar;
>                         c:\aspectwerkz\lib\trove-0.1.8.jar;
>                         c:\aspectwerkz\lib\jrexx-1.1.1.jar;
>                         c:\aspectwerkz\lib\prevayler2.00.000dev1.jar;
>
> c:\aspectwerkz\config;c:\aspectwerkz\lib\jmangler-core.jar;
>                         c:\aspectwerkz\lib\bcel.jar
>
>                     org.cs3.jmangler.offline.starter.Main
>
>                     --cp c:\aspectwerkz\dist\samples.jar
>                     --tcp c:\aspectwerkz\lib\aspectwerkz-0.4.jar
>                     --cf c:\aspectwerkz\config\aspectwerkz.conf
>
> Reading configuration...
> aspectwerkz.exception.DefinitionException: could not locate meta-data dir
>  at
>
aspectwerkz.definition.AspectWerkzDefinition.locateMetaDataDir(AspectWerkzDe
> finition.java:617)
>  at
>
aspectwerkz.definition.AspectWerkzDefinition.<init>(AspectWerkzDefinition.ja
> va:117)
>  at
>
aspectwerkz.definition.Dom4jXmlDefinitionParser.parseDocument(Dom4jXmlDefini
> tionParser.java:130)
>  at
>
aspectwerkz.definition.Dom4jXmlDefinitionParser.parse(Dom4jXmlDefinitionPars
> er.java:66)
>  at
>
aspectwerkz.transform.AdviseMemberMethodTransformer.<init>(AdviseMemberMetho
> dTransformer.java:62)
>  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>  at
>
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
> sorImpl.java:39)
>  at
>
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
> torAccessorImpl.java:27)
>  at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
>  at java.lang.Class.newInstance0(Class.java:308)
>  at java.lang.Class.newInstance(Class.java:261)
>  at
>
org.cs3.jmangler.bceltransformer.config.PropertyFileTrafoConfig.readFile(Pro
> pertyFileTrafoConfig.java:76)
>  at
>
org.cs3.jmangler.bceltransformer.config.EnhancedPropertyFileTrafoConfig.read
> File(EnhancedPropertyFileTrafoConfig.java:66)
>  at
>
org.cs3.jmangler.bceltransformer.config.PropertyFileTrafoConfig.<init>(Prope
> rtyFileTrafoConfig.java:54)
>  at
>
org.cs3.jmangler.bceltransformer.config.EnhancedPropertyFileTrafoConfig.<ini
> t>(EnhancedPropertyFileTrafoConfig.java:45)
>  at
>
org.cs3.jmangler.offline.OfflineTransformer.run(OfflineTransformer.java:59)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
>  at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
>  at java.lang.reflect.Method.invoke(Method.java:324)
>  at org.cs3.jmangler.offline.starter.Main.start(Main.java:92)
>  at org.cs3.jmangler.offline.starter.Main.main(Main.java:57)
> java.lang.reflect.InvocationTargetException
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
>  at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
>  at java.lang.reflect.Method.invoke(Method.java:324)
>  at org.cs3.jmangler.offline.starter.Main.start(Main.java:92)
>  at org.cs3.jmangler.offline.starter.Main.main(Main.java:57)
> Caused by: java.lang.Error: Error while reading configuration file
> 'c:\aspectwerkz\config\aspectwerkz.conf'.
>  at
>
org.cs3.jmangler.bceltransformer.config.PropertyFileTrafoConfig.readFile(Pro
> pertyFileTrafoConfig.java:121)
>  at
>
org.cs3.jmangler.bceltransformer.config.EnhancedPropertyFileTrafoConfig.read
> File(EnhancedPropertyFileTrafoConfig.java:66)
>  at
>
org.cs3.jmangler.bceltransformer.config.PropertyFileTrafoConfig.<init>(Prope
> rtyFileTrafoConfig.java:54)
>  at
>
org.cs3.jmangler.bceltransformer.config.EnhancedPropertyFileTrafoConfig.<ini
> t>(EnhancedPropertyFileTrafoConfig.java:45)
>  at
>
org.cs3.jmangler.offline.OfflineTransformer.run(OfflineTransformer.java:59)
>  ... 6 more
>
> C:\aspectwerkz>
>
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> aspectwerkz-developer mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/aspectwerkz-developer



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf