Re: Compile error
Bill Goldsworthy <[email protected]> Wed, 2 Feb 2005 20:57:23 -0600
| Newsgroups | gmane.comp.java.ozone.user |
|---|---|
| Message-ID | <[email protected]> |
Thank you for the replies, it seems I got it working this evening.
Your comments helped me eliminate some possibilities which helped me
get to the solution. I'll detail what I did here in case anyone finds
it helpful.
To recap:
Wanted to use Ozone embedded in a Java 1.5 project I'm developing in
the netBeans IDE.
This covers my attempts to get the simple sample from the Ozone 1.2 up
and running using the LocalClient as the main class.
Ozone installed at: c:\ozone-1.2
Simple sample project directory: c:\OzoneTest
c:\OzoneTest\src\
c:\OzoneTest\src\ozonetest\*.java (simple sample files in package 'ozonetest')
c:\OzoneTest\build\classes\
c:\OzoneTest\build\classes\ozonetest\*.class (ozonetest package files)
c:\OzoneTest\dist\ (will have project jar in it)
c:\OzoneTest\nbproject\ (netBeans project files)
Environment variables:
OZONE_HOME = c:\ozone-1.2
JAVA_HOME=C:\jdk1.5.0
PATH = PATH;%OZONE_HOME%\bin
In the build file generated by netBeans you can overload targets to
add additional tasks. I overloaded the one '-post-compile' and
inserted the build instructions from the 'proxies' target.
The first trick was to add the 'dir' paramter to the java tag so OPP
would be called in the correct directory (I think this is due to me
using packages). It also didn't like it when I assigned anything to
'build.dir' so I called mine 'mybuild.dir' for where I needed it.
Anyways, I've included what I added to the generated build.xml and
things worked great once I got it to call OPP in the correct
directory.
<code>
<property name="ozone.dir" value="c:/ozone-1.2"/>
<property name="project.dir" value="c:/OzoneTest"/>
<property name="src.dir" value="${project.dir}/src"/>
<property name="mybuild.dir" value="${project.dir}/build/classes"/>
<property name="opp.compiler" value="javac"/>
<property name="opp.options" value="-KS"/>
<echo>${build.dir}</echo>
<path id="run.classpath">
<fileset dir="${ozone.dir}/lib">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${mybuild.dir}"/>
<pathelement path="${mybuild.dir}/ozonetest"/>
<pathelement path="${java.class.path}"/>
</path>
<path id="build.classpath">
<fileset dir="${ozone.dir}/lib/">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${mybuild.dir}"/>
<pathelement path="${mybuild.dir}/ozonetest"/>
</path>
<target name="-post-compile">
<java classname="org.ozoneDB.tools.OPP.OPP"
fork="yes"
failonerror="yes"
classpathref="run.classpath"
dir="${src.dir}">
<arg line="${opp.options}"/>
<arg line="-o${src.dir}"/>
<arg line="ozonetest.AutoImpl"/>
<arg line="ozonetest.BusImpl"/>
<jvmarg line="-Dozone.javac=${opp.compiler}"/>
</java>
<javac srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="build.classpath"
includes="*_Proxy.java"
/>
</target>
</code>
Thanks again,
Bill
On Tue, 1 Feb 2005 20:09:45 +0100, Per Nyfelt
<[email protected]> wrote:
> I should probably add that the "recent" refactoring of OPP unfortunately
> changed the behavior a bit in the sense that the classpath to the tools.jar
> need to be explicitly available in the ant script. I think most samples are
> fixed in this regard but a couple of weeks ago this issue had to be fixed for
> the SimpleServlet sample so there might very well be so that not all samples
> work "out of the box". I do not think this is the case though. it looks more
> like the build directory is not in the OPP classpath and hence the *Impl
> classes cannot be found.
>
> Regards,
> Per
>
> tisdagen den 1 februari 2005 19.30 skrev Naaliel Mendes:
> > Hi Bill
> >
> > In reality, I saw the exception NoClassDefFoundError. I solved that
> > problem moving the build directory to the correct path. I used OO7
> > (ozone\sample\oo7) in my tests, for the correct operation I did:
> > Before:
> > ozone\sample\oo7\*.class
> > ozone\server\src\org\ozoneDB\*.class
> >
> > After
> > ozone\server\src\oo7\*.class
> > ozone\server\src\org\ozoneDB\*.class
> >
> > However, your case is different, because the ANT build script show an
> > error in the sense of Proxy files. As you know, Proxy files are
> > generated from Implementation class (*Impl). See Ozone Documentation
> > for more details.
> > Attention: *Impl class are inherited from Java Interface structure. As
> > a tip, in this line of investigation, confirm if there aren't errors
> > in your implementation.
> > Hey Bill, if possible, compile your files using OPP Ozone command. If
> > you have some question do not hesitate to send us a message.
> > Other tip:
> > At the moment of compilation, probabily, your build.xml do:
> > - Compile .java (.class generated)
> > - Use opp command to create from *Impl the proxy files (you see error
> > in this situation)
> > - Execute MainClass
> > Obviously, as first pass, start the Ozone server.
> >
> > We can to found a good solution togheter.
> > Sorry for the delay.
> >
> > Regards,
> >
> > Naaliel Mendes
> > [email protected]
> > ---------------------------------------------------------------------------
> >-- State University of Campinas (UNICAMP)
> > Superior Center of Technological Education (CESET)
> > www.ceset.unicamp.br
> >
> > On Sat, 29 Jan 2005 20:05:41 -0600, Bill Goldsworthy <[email protected]>
> wrote:
> > > Hi Naaliel,
> > >
> > > Here is what I currently have:
> > >
> > > CLASSPATH=C:\OzoneTest\build\classes\
> > > JAVA_HOME=C:\jdk1.5.0
> > > OZONE_HOME=C:\ozone-1.2
> > >
> > > My project directory:
> > >
> > > C:\OzoneTest\build.xml
> > > C:\OzoneTest\src\
> > > C:\OzoneTest\build\classes\
> > > C:\OzoneTest\build\dist\
> > >
> > > I'm pretty sure it's a classpath/JVM problem but I still can't seem to
> > > nail it down.
> > >
> > > Would love hear what you did to fix!
> > >
> > > Thanks for your help!
> > > Bill
> > >
> > > On Fri, 28 Jan 2005 11:01:22 -0200, Naaliel Mendes <[email protected]>
> wrote:
> > > > Hey Bill,
> > > > Tell me how is the CLASSPATH/JAVA_HOME/OZONE_HOME and your directory
> > > > structure (BUILD). In the last week, I saw a similar problem, but I
> > > > solved it with some configurations in CLASSPATH.
> > > > Regards,
> > > > Naaliel Mendes
> > > >
> > > > On Sat, 8 Jan 2005 00:03:04 -0600, Bill Goldsworthy <[email protected]>
> wrote:
> > > > > Hello,
> > > > >
> > > > > I'm going to be using Ozone embedded in a Java application I'm
> > > > > writing.
> > > > >
> > > > > Anyways, I'm working on compiling the simple sample in the netBeans
> > > > > 4.0 IDE RC2 (Java 1.5) wtih the ANT build file.
> > > > >
> > > > > Everything compiles fine but for some reason the proxies target in
> > > > > the ANT build file messes up. It's confusing to me because it seems
> > > > > to find the classes, but then it can't find them?
> > > > >
> > > > > I suspect it's a classpath problem but I've set the CLASSPATH with
> > > > > the build directory and set OZONE_HOME etc. Searched around the forum
> > > > > but haven't seemed to nailed it down. netBeans doesn't use the
> > > > > CLASSPATH as you might normally do, but I don't suspect this to be
> > > > > the problem since it's using ANT.
> > > > >
> > > > > Your advice greatly appreciated!
> > > > >
> > > > > prepare:
> > > > > classes:
> > > > > Compiling 5 source files to \Ozone_Example\build\classes
> > > > > proxies:
> > > > > Begin OPP...
> > > > > Processing class: BusImpl
> > > > > Begin Processing BusImpl...
> > > > > Begin Resolving update methods...
> > > > > End Resolving update methods
> > > > > End Processing BusImpl generated in 0.062 seconds.
> > > > > Generation completed with 0 warnings and 0 errors
> > > > > org.ozoneDB.tools.OPP.srcgen.BuilderException:
> > > > > org.ozoneDB.tools.OPP.srcgen.ResolverException: Could not resolve
> > > > > update methods (BusImpl). BusImpl
> > > > > at
> > > > > org.ozoneDB.tools.OPP.srcgen.direct.ReflectionClassDirector.build(Unk
> > > > >nown Source)
> > > > > at org.ozoneDB.tools.OPP.OPP.makeProxiesAndFactories(Unknown
> > > > > Source) at org.ozoneDB.tools.OPP.OPP.generate(Unknown Source)
> > > > > at org.ozoneDB.tools.OPP.OPP.main(Unknown Source)
> > > > > Caused by: org.ozoneDB.tools.OPP.srcgen.ResolverException: Could not
> > > > > resolve update methods (BusImpl). BusImpl
> > > > > at
> > > > > org.ozoneDB.tools.OPP.srcgen.resolve.SourceUpdateMethodResolver.resol
> > > > >veMethods(Unknown Source)
> > > > > at
> > > > > org.ozoneDB.tools.OPP.srcgen.resolve.CompositeMethodResolver.resolveM
> > > > >ethods(Unknown Source)
> > > > > ... 4 more
> > > > > Caused by: java.lang.ClassNotFoundException: BusImpl
> > > > > at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> > > > > at java.security.AccessController.doPrivileged(Native Method)
> > > > > at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> > > > > at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> > > > > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
> > > > > at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> > > > > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> > > > > at java.lang.Class.forName0(Native Method)
> > > > > at java.lang.Class.forName(Class.java:164)
> > > > > at
> > > > > org.ozoneDB.tools.OPP.srcgen.query.ReflectionClassQuery.isAssignable(
> > > > >Unknown Source)
> > > > > at
> > > > > org.ozoneDB.tools.OPP.srcgen.resolve.SourceUpdateMethodResolver.searc
> > > > >hUpdateMethods(Unknown Source)
> > > > > ... 6 more
> > > > > C:\Ozone_Example\src\ozone_example\build.xml:87: Java returned: 1
> > > > > BUILD FAILED (total time: 1 second)
> > > > >
> > > > > -------------------------------------------------------
> > > > > The SF.Net email is sponsored by: Beat the post-holiday blues
> > > > > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> > > > > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> > > > > _______________________________________________
> > > > > Ozone-users mailing list
> > > > > [email protected]
> > > > > https://lists.sourceforge.net/lists/listinfo/ozone-users
> > > >
> > > > -------------------------------------------------------
> > > > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> > > > Tool for open source databases. Create drag-&-drop reports. Save time
> > > > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> > > > Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> > > > _______________________________________________
> > > > Ozone-users mailing list
> > > > [email protected]
> > > > https://lists.sourceforge.net/lists/listinfo/ozone-users
> > >
> > > -------------------------------------------------------
> > > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> > > Tool for open source databases. Create drag-&-drop reports. Save time
> > > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> > > Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> > > _______________________________________________
> > > Ozone-users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/ozone-users
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> > Tool for open source databases. Create drag-&-drop reports. Save time
> > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> > Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> > _______________________________________________
> > Ozone-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/ozone-users
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Ozone-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ozone-users
>
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl