I hope all goes well. It's too bad we couldn't meet last year at
Barbados. Maybe IJCAI or AAMAS this coming year?
I'm porting all of my TAMER code over to Java, and I'm having some
trouble with runtime errors; the JVM isn't able to find classes in my
weka.jar file that were found just fine during compilation. I believe
it has something to do with the classpath set in the build.xml file,
though I'm relatively inexperienced with ant. Do you have any
documentation on how to create a build.xml file that uses the xml
files in system/common/ant/? Or more specifically, how do I add
something to the classpath? Looking at the build.xml file for
MountainCar-Java-xxx (which I adapted for my own agent), it seems that
it's not as straightforward as in a standalone build.xml file, instead
requiring use of project.extra.classpath.
Thanks, and I appreciate any help you can give.
Cheers,
Brad
www.cs.utexas.edu/~bradknox
--
You received this message because you are subscribed to the Google Groups "rl-library" group.
To post to this group, send email to rl-li...@googlegroups.com.
To unsubscribe from this group, send email to rl-library+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rl-library?hl=en.
As of now, ant can find weka.jar during the build process, presumably
because it's in my CLASSPATH environment variable. When I try to do
what my interpretation of your sample-build.xml suggests, I get a new
runtime error that seems to come from not being able to find
RLVizLib.jar. The build.xml that seems incorrect but gets an earlier
error than the seemingly incorrect one contains:
<property name="jar.main.class"
value="edu.utexas.cs.tamer.agents.TamerAgent" />
<property name="jar.extra.classpath"
value="../system/common/libs/rl-viz/RLVizLib.jar" />
<path id="project.extra.classpath">
<fileset dir=".." >
<include name="weka.jar"/>
</fileset>
</path>
And the modified one that gets the earlier error contains the
following, changed only by adding another jar file after RLVizLib.jar:
<property name="jar.main.class"
value="edu.utexas.cs.tamer.agents.TamerAgent" />
<property name="jar.extra.classpath"
value="../system/common/libs/rl-viz/RLVizLib.jar:../tamerCommon/weka.jar"
/>
<path id="project.extra.classpath">
<fileset dir=".." >
<include name="weka.jar"/>
</fileset>
</path>
The actual runtime error begins with:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/rlcommunity/rlglue/codec/AgentInterface
Does something jump out at you here?
Thanks again.
- Brad
However, I think the first example is closer to what you want. I'm
unfortunately not a JAR or Ant expert (especially not anymore), but I
have been peeking at where these values are used:
http://code.google.com/p/rl-library/source/browse/trunk/system/common/ant/build-targets.xml
Looks like jar.extra.classpath is (intuitively), the classpath for the
jar in the manifest. Two things. First, it is not totally obvious
what the format of a classpath with multiple entries should be. Doing
some reading it looks like maybe there is no classpath separator...
just a space? Some info here:
http://download.oracle.com/javase/tutorial/deployment/jar/downman.html
You can probably take RLVizLib OUT of there for now if you want to,
and just use your WEKA jar to see if that works. The reason (if I
recall) that RLVizLib is there is simply for command-line loading, so
you can do java -jar myJar.jar to start your agent. Invoking this way
means that your agent's jar must have RLVizLib in the classpath so it
knows about AgentLoader at runtime. If you load your agent out of the
JAR from RLViz, then this isn't required (probably).
project.extra.classpath is used for compiling. So that's probably all fine.
So that gives you a direction to pursue I think.
The other way to proceed would be to leave jar.extra.classpath at its
default, and then comment out the include for the predefined build
targets, and just paste the build targets from the Octopus and
changing the jarname to your weka, so something like:
!-- <import file="${this.project.system.directory}/common/ant/predefined-target-aliases.xml"/>-->
<target name="build">
<unzip src="weka.jar" dest="build/classes/"/>
<antcall target="rl-jar" />
</target>
<target name="clean" depends="rl-clean"/>
<target name="debug" depends="rl-set-debug,build"/>
<target name="test" depends="rl-test"/>
<target name="javadoc" depends="rl-javadoc"/>
<target name="clean-build" depends="clean, build"/>
<target name="all" depends="clean, build, test, javadoc"/>
<target name="update-public" depends="build" >
<copy file="${result.jar}"
todir="${baseLibraryDir}/../public/system/environmentJars"/>
</target>
--
Brian Tanner
Ph.D Student
University of Alberta
br...@tannerpages.com
- Brad
AgentLoader run(class edu.utexas.cs.tamer.agents.TamerAgent) threw
Exception: java.lang.NullPointerException
java.lang.NullPointerException
at edu.utexas.cs.tamer.agents.TamerAgent.processLastTimeStep(Unknown Source)
at edu.utexas.cs.tamer.agents.TamerAgent.agent_step(Unknown Source)
at edu.utexas.cs.tamer.agents.TamerAgent.agent_start(Unknown Source)
at org.rlcommunity.rlglue.codec.network.ClientAgent.onAgentStart(ClientAgent.java:75)
at org.rlcommunity.rlglue.codec.network.ClientAgent.runAgentEventLoop(ClientAgent.java:193)
at org.rlcommunity.rlglue.codec.util.AgentLoader.run(AgentLoader.java:128)
at edu.utexas.cs.tamer.agents.TamerAgent.main(Unknown Source)
According to my interpretation of at least two websites (e.g.,
http://www.jguru.com/faq/view.jsp?EID=1122360), the solution should be
to add
debug="true" debuglevel="lines,vars,source"
to the last of the following lines in build-targets.xml:
<target name="rl-compile">
<mkdir dir="${classes.dir}"/>
<!-- make sure we get the resources -->
<copy todir="${classes.dir}">
<fileset dir="${src.dir}" excludes="**/*.java"/>
</copy>
<javac srcdir="${src.dir}" destdir="${classes.dir}"
debug="${build.debug}" target="1.5">
Doing so (or rather, only adding the debuglevel part that's missing)
does not fix the issue. There are still no line numbers for my source
in the error's stack trace.
Might I be putting this debug parameters in the wrong place? Or are
you aware of something else I should be doing differently?
- Brad
Well first off I'm not quite sure. I have run into similar issues
before. I'm trying to remember if the problem is you need debug mode
enabled in the Agent, or in RL-Viz, or both.
For the agent, you could test this by putting a runtime error in a
test class in your code and then invoking that code from outside of
RL-Viz just to make sure line numbers come up. You could even toggle
the debug thing to see if you can control it. Probably that'll work
fine and we'll need to look at RL-Viz.
For some reason I always compile RL-Viz without debug mode on. This
has bit me a few times and I've recompiled a special version of it
with debug mode on, solved a problem, then disabled debug mode.
Today, this seems stupid. Why not just have it on? Perhaps there is
a good reason that I cannot recall.
Looks like RLVizApp/VizLib/AgentShell/EnvShell have a debug target
called "debug-all":
http://code.google.com/p/rl-viz/source/browse/trunk/build.xml
It gets used here, similarly to what you are doing in your snippet:
http://code.google.com/p/rl-viz/source/browse/trunk/projects/rlVizLibJava/build.xml
Except I use: <property name="build.debug" value="on"/> while you use
"true". Try "on" and see if life is good. If not, perhaps I should
just push out a version of RLVizLib with debug on and make that the
default. Please tell me if you can think of why that might be bad.
Random Internet search says "debugging mode" is up to 10x slower than
without, but I don't necessarily think that's just having the debug
symbols not stripped. Not sure.
Anyway, digest this and let me know :)
<target name="rl-compile">
to
<target name="rl-compile" depends="rl-set-debug">
added line numbers to the error stack trace.
Thanks again for your help.