You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Joel <re...@ddcom.co.jp> on 2004/07/14 12:24:47 UTC

problems compiling (and running) the examples

Okay, here's what I get trying to compile example1 with Java 1.4 and
TC4:

> D:\Program_Files\apache\xindice-1.1b4\java\examples>ant
> Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\j2re1.4.2_05\lib\tools.jar

Why it is looking on the C: drive, I couldn't even begin to guess.

(Stupid MSWindows.)

> Buildfile: build.xml
> 
> init:
> 
> addressbook-init:
>     [mkdir] Created dir: D:\Program_Files\apache\xindice-1.1b4\build\addressbook-classes
> 
> addressbook-build:
>     [javac] Compiling 10 source files to D:\Program_Files\apache\xindice-1.1b4\build\addressbook-classes
> 
> BUILD FAILED
> D:\Program_Files\apache\xindice-1.1b4\java\examples\build.xml:97: Unable to find a javac compiler;
> com.sun.tools.javac.Main is not on the classpath.

I suppose I should try setting a class path, even though I am under the
impression that it will be overridden anyway, and I'm not really sure
what to salt it with.

Okay, 

> D:\Program_Files\apache\xindice-1.1b4\java\examples>set CLASSPATH="D:\Program_Files\Java\j2sdk1.4.2_05\lib\tools.jar"

and 

> D:\Program_Files\apache\xindice-1.1b4\java\examples>ant
> Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\j2re1.4.2_05\lib\tools.jar
> Buildfile: build.xml

(Stupic MSWindows.) 

But,

> init:
> 
> addressbook-init:
> 
> addressbook-build:
>     [javac] Compiling 10 source files to D:\Program_Files\apache\xindice-1.1b4\build\addressbook-classes
> 
> addressbook-release:
>       [war] Building war: D:\Program_Files\apache\xindice-1.1b4\dist\addressbook.war
> 
> guide-init:
>     [mkdir] Created dir: D:\Program_Files\apache\xindice-1.1b4\build\guide-classes
> 
> guide-build:
>     [javac] Compiling 8 source files to D:\Program_Files\apache\xindice-1.1b4\build\guide-classes
> 
> guide-release:
>       [jar] Building jar: D:\Program_Files\apache\xindice-1.1b4\dist\xindice-guide.jar
> 
> release:
> 
> BUILD SUCCESSFUL
> Total time: 6 seconds

Hmm. Okay, so the examples that don't run when I do this:

> D:\Program_Files\apache\xindice-1.1b4\java\examples>cd guide
> 
> D:\Program_Files\apache\xindice-1.1b4\java\examples\guide>.\run org.apache.xindice.examples.Example1
> D:\Program_Files\apache\xindice-1.1b4
> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xindice/examples/Example1

are all under the build subdirectory, under the addressbook-classes and
guide-classes directories. 

Well, you know what I'm going to do, I'm going to drop that
addressbook.war into TC. My, that was fast. And I try to look at the
list of contacts on http://localhost and xindice wants to read from port
8888. And I've left xindice on port 8080 because I'm lazy. Arrgghhh. 

Great. This is turning into a novel. Sorry, I'll disconnect for a bit.

-- 
Joel <re...@ddcom.co.jp>


Re: problems compiling (and running) the examples

Posted by Joel <re...@ddcom.co.jp>.
I'm not trying to be different or anything, and I know that it's a
common problem, but please check back over the thread.

Specifically,

> >>>> <>D:\Program_Files\apache\xindice-1.1b4\java\examples>ant
> >>>> Unable to locate tools.jar. Expected to find it in C:\Program 
> >>>> Files\Java\j2re1.4.2_05\lib\tools.jar
> >>>
> >>JAVA_HOME should point 
> >>to j2se SDK installation. In your case, this is j2se RE
> >
> >Not so. 
> 
> See, directory in path above is "j2re1.4.2_05", which means "Java2 RE 
> 1.4.2". You need "Java2 SDK", directory will be "j2sdk1.4.2", and it 
> will have tools.jar.

But look what %JAVA_HOME% is set to:

    C:\Documents and Settings\Rees>echo %JAVA_HOME%
    D:\Program_Files\Java\j2sdk1.4.2_05

As I was attempting to point out last night before I went home, I
succeeded in compiling both Tomcat and Xindice. I'm running Tomcat out
of 

    C:\Documents and Settings\Rees>echo %CATALINA_HOME%
    D:\Program_Files\apache\jakarta-tomcat-5.0.25-src\jakarta-tomcat-5\build

which seems a little strange, but I didn't see anything that said to
move the build product. After building Xindice, I dropped xindice.war
into Tomcat, as you can see here (sorry about the Japanese):

-----------------------------------------------------------
C:\Documents and Settings\Rees>dir %CATALINA_HOME%\webapps
 ドライブ D のボリューム ラベルは ボリューム です
 ボリューム シリアル番号は xxxx-xxxx です

 D:\Program_Files\apache\jakarta-tomcat-5.0.25-src\jakarta-tomcat-5\build\webapps のディレクトリ

2004/07/14  19:18    <DIR>          .
2004/07/14  19:18    <DIR>          ..
2004/07/14  19:18    <DIR>          addressbook
2004/07/14  18:53         4,269,255 addressbook.war
2004/07/09  14:52    <DIR>          balancer
2004/07/09  14:52    <DIR>          jsp-examples
2004/07/09  14:53    <DIR>          ROOT
2004/07/09  14:52    <DIR>          servlets-examples
2004/07/09  14:53    <DIR>          tomcat-docs
2004/07/09  14:52    <DIR>          webdav
2004/07/09  20:38    <DIR>          xindice
2004/07/09  20:10         4,305,828 xindice.war
               2 個のファイル           8,575,083 バイト
              10 個のディレクトリ  27,427,053,568 バイトの空き領域
-----------------------------------------------------------

And, incidentally, here are the build and dist directories from
compiling xindice:

-----------------------------------------------------------
C:\Documents and Settings\Rees>dir %XINDICE_HOME%\build
 ドライブ D のボリューム ラベルは ボリューム です
 ボリューム シリアル番号は xxxx-xxxx です

 D:\Program_Files\apache\xindice-1.1b4\build のディレクトリ

2004/07/14  18:53    <DIR>          .
2004/07/14  18:53    <DIR>          ..
2004/07/14  18:53    <DIR>          addressbook-classes
2004/07/09  20:10    <DIR>          classes
2004/07/09  20:10    <DIR>          classes-tests
2004/07/14  18:53    <DIR>          guide-classes
2004/07/09  20:10    <DIR>          test-results
2004/07/09  20:10    <DIR>          war-bin
               0 個のファイル                   0 バイト
               8 個のディレクトリ  27,427,053,568 バイトの空き領域

C:\Documents and Settings\Rees>dir %XINDICE_HOME%\dist
 ドライブ D のボリューム ラベルは ボリューム です
 ボリューム シリアル番号は xxxx-xxxx です

 D:\Program_Files\apache\xindice-1.1b4\dist のディレクトリ

2004/07/14  18:53    <DIR>          .
2004/07/14  18:53    <DIR>          ..
2004/07/14  18:53         4,269,255 addressbook.war
2004/07/09  20:10           461,825 xindice-1.1b4.jar
2004/07/09  20:10         4,305,828 xindice-1.1b4.war
2004/07/09  20:10             1,543 xindice-1.1b4.xml
2004/07/14  18:53            10,490 xindice-guide.jar
               5 個のファイル           9,048,941 バイト
               2 個のディレクトリ  27,427,053,568 バイトの空き領域
-----------------------------------------------------------

Now, the reason I was compiling the examples by themselves was that I am
clueless, and didn't think to look in the build directory for the build
products. The build messages clued me in.

I don't remember getting complaints about tools.jar when compiling the
entire xindice. So I thought maybe it was just that the build file for
the examples wasn't getting environment variables set. 

Which is why I tried pre-defining CLASSPATH to point to tools.jar, and
that allows the examples to be built by themselves, in spite of the
complaint about not being able to find tools.jar on the C: drive (where
they are not, of course).

I'd like to work out some patches for the build files, but I'll have to
negotiate with the boss about the time first.

-- 
Joel <re...@ddcom.co.jp>


Re: problems compiling (and running) the examples

Posted by Joel <re...@ddcom.co.jp>.
> ...
> > It is looking for tools.jar in %JAVA_HOME%\lib. JAVA_HOME should point 
> > to j2se SDK installation. In your case, this is j2se RE - which does not 
> > have tools.jar.
> 
> Not so. 
> 
> Else I doubt I would have succeeded in compiling Tomcat.

I should point out that I did not have these messages when I built the
entire xindice project. It just took trying to build the examples by
themselves for me to figure out that the build product was in the build
directory.

I'm a bit slow about these sorts of things.

> ...

-- 
Joel <re...@ddcom.co.jp>


Re: problems compiling (and running) the examples

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Joel wrote:

>On Wed, 14 Jul 2004 06:47:50 -0400
>Vadim Gritsenko <va...@reverycodes.com> wrote
>
>  
>
>>Joel wrote:
>>
>>    
>>
>>>> <>D:\Program_Files\apache\xindice-1.1b4\java\examples>ant
>>>> Unable to locate tools.jar. Expected to find it in C:\Program 
>>>> Files\Java\j2re1.4.2_05\lib\tools.jar
>>>
>>JAVA_HOME should point 
>>to j2se SDK installation. In your case, this is j2se RE
>>    
>>
>
>Not so. 
>  
>

See, directory in path above is "j2re1.4.2_05", which means "Java2 RE 
1.4.2". You need "Java2 SDK", directory will be "j2sdk1.4.2", and it 
will have tools.jar.

Vadim


Re: problems compiling (and running) the examples

Posted by Joel <re...@ddcom.co.jp>.
On Wed, 14 Jul 2004 06:47:50 -0400
Vadim Gritsenko <va...@reverycodes.com> wrote

> Joel wrote:
> 
> >Okay, here's what I get trying to compile example1 with Java 1.4 and
> >TC4:
> >
> >>D:\Program_Files\apache\xindice-1.1b4\java\examples>ant
> >>Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\j2re1.4.2_05\lib\tools.jar
> >
> >Why it is looking on the C: drive, I couldn't even begin to guess.
> 
> It is looking for tools.jar in %JAVA_HOME%\lib. JAVA_HOME should point 
> to j2se SDK installation. In your case, this is j2se RE - which does not 
> have tools.jar.

Not so. 

Else I doubt I would have succeeded in compiling Tomcat.

And I doubt I would have got a compile by just setting CLASSPATH. 

I mean, that was a surprise. The build script complained again, but the
compile succeed anyway after I pre-set the CLASSPATH in MSWindows to
point to lib\tools.jar:

> ...
> 
> >Okay, 
> >
> >>D:\Program_Files\apache\xindice-1.1b4\java\examples>set CLASSPATH="D:\Program_Files\Java\j2sdk1.4.2_05\lib\tools.jar"
> >
> >and 
> >
> >>D:\Program_Files\apache\xindice-1.1b4\java\examples>ant
> >>Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\j2re1.4.2_05\lib\tools.jar
> >>Buildfile: build.xml
> >
> >(Stupic MSWindows.) 
> >
> >But,
> >
> >>init:
> >>
> >>addressbook-init:
> >>
> >>addressbook-build:
> >>    [javac] Compiling 10 source files to D:\Program_Files\apache\xindice-1.1b4\build\addressbook-classes
> >>
> >>addressbook-release:
> >>      [war] Building war: D:\Program_Files\apache\xindice-1.1b4\dist\addressbook.war
> >>
> >>guide-init:
> >>    [mkdir] Created dir: D:\Program_Files\apache\xindice-1.1b4\build\guide-classes
> >>
> >>guide-build:
> >>    [javac] Compiling 8 source files to D:\Program_Files\apache\xindice-1.1b4\build\guide-classes
> >>
> >>guide-release:
> >>      [jar] Building jar: D:\Program_Files\apache\xindice-1.1b4\dist\xindice-guide.jar
> >>
> >>release:
> >>
> >>BUILD SUCCESSFUL
          ^^^^^^^^^^

> >>Total time: 6 seconds
> >>    
> >>
> >
> >Hmm. Okay, so the examples that don't run when I do this:
> >
> >  
> >
> >>D:\Program_Files\apache\xindice-1.1b4\java\examples>cd guide
> >>
> >>D:\Program_Files\apache\xindice-1.1b4\java\examples\guide>.\run org.apache.xindice.examples.Example1
> >>D:\Program_Files\apache\xindice-1.1b4
> >>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xindice/examples/Example1
> >>    
> >>
> >
> >are all under the build subdirectory, under the addressbook-classes and
> >guide-classes directories.
> >
> 
> run.bat is probably outdated. Check email archives, I've sent updated 
> run.bat to the list.

Okay, I'll see if I can find something more recent than what's in 1.1b4.

> >Well, you know what I'm going to do, I'm going to drop that
> >addressbook.war into TC. My, that was fast. And I try to look at the
> >list of contacts on http://localhost and xindice wants to read from port
> >8888. And I've left xindice on port 8080 because I'm lazy. Arrgghhh.
> >
> 
> You can set environment variable to let Xindice know which port to use. 
> See wiki.

Thanks. I thought I had seen something about that.

What I'd rather do is set the port in Tomcat, though. I'm working on
that, now. But I think I might try the environment variable first, so's
I can remember it maybe when I need it.


-- 
Joel <re...@ddcom.co.jp>


Re: moving xindice to 8888 on tomcat

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Joel wrote:

>>>Well, you know what I'm going to do, I'm going to drop that
>>>addressbook.war into TC. My, that was fast. And I try to look at the
>>>list of contacts on http://localhost and xindice wants to read from port
>>>8888. And I've left xindice on port 8080 because I'm lazy. Arrgghhh.
>>>
>>>      
>>>
>>You can set environment variable to let Xindice know which port to use. 
>>See wiki.
>>    
>>
>
>Haven't found this environment variable yet. I have been using the 
>
>    xindice <cmd> -c xmldb:xindice://localhost:8080/db
>
>for a while, and it works just fine for command-line queries.
>
>However, I just tried duplicating the main Connector declaration in
>tomcat's server.xml, but removing the redirectPort attribute:
>
>   <Connector port="8888"
>       maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
>       enableLookups="false" acceptCount="100"
>       debug="0" connectionTimeout="20000" 
>       disableUploadTimeout="true" />
>
>Restarted Tomcat, and now the addressbook example app works just peachy.
>

Nice.

After quick look into addressbook I found that it always look for 
xindice in default location: on the localhost, port 8888. This demo 
needs to be modified to add collection url configuration parameter.

Vadim


moving xindice to 8888 on tomcat

Posted by Joel <re...@ddcom.co.jp>.
> >Well, you know what I'm going to do, I'm going to drop that
> >addressbook.war into TC. My, that was fast. And I try to look at the
> >list of contacts on http://localhost and xindice wants to read from port
> >8888. And I've left xindice on port 8080 because I'm lazy. Arrgghhh.
> >
> 
> You can set environment variable to let Xindice know which port to use. 
> See wiki.

Haven't found this environment variable yet. I have been using the 

    xindice <cmd> -c xmldb:xindice://localhost:8080/db

for a while, and it works just fine for command-line queries.

However, I just tried duplicating the main Connector declaration in
tomcat's server.xml, but removing the redirectPort attribute:

   <Connector port="8888"
       maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
       enableLookups="false" acceptCount="100"
       debug="0" connectionTimeout="20000" 
       disableUploadTimeout="true" />

Restarted Tomcat, and now the addressbook example app works just peachy.

-- 
Joel <re...@ddcom.co.jp>


Re: problems compiling (and running) the examples

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Joel wrote:

>Okay, here's what I get trying to compile example1 with Java 1.4 and
>TC4:
>
>  
>
>>D:\Program_Files\apache\xindice-1.1b4\java\examples>ant
>>Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\j2re1.4.2_05\lib\tools.jar
>>    
>>
>
>Why it is looking on the C: drive, I couldn't even begin to guess.
>  
>

It is looking for tools.jar in %JAVA_HOME%\lib. JAVA_HOME should point 
to j2se SDK installation. In your case, this is j2se RE - which does not 
have tools.jar.


>(Stupid MSWindows.)
>
>  
>
>>Buildfile: build.xml
>>
>>init:
>>
>>addressbook-init:
>>    [mkdir] Created dir: D:\Program_Files\apache\xindice-1.1b4\build\addressbook-classes
>>
>>addressbook-build:
>>    [javac] Compiling 10 source files to D:\Program_Files\apache\xindice-1.1b4\build\addressbook-classes
>>
>>BUILD FAILED
>>D:\Program_Files\apache\xindice-1.1b4\java\examples\build.xml:97: Unable to find a javac compiler;
>>com.sun.tools.javac.Main is not on the classpath.
>>    
>>
>
>I suppose I should try setting a class path, even though I am under the
>impression that it will be overridden anyway, and I'm not really sure
>what to salt it with.
>  
>

See above: you need SDK, and JAVA_HOME pointing to SDK, not JRE.


>Okay, 
>
>  
>
>>D:\Program_Files\apache\xindice-1.1b4\java\examples>set CLASSPATH="D:\Program_Files\Java\j2sdk1.4.2_05\lib\tools.jar"
>>    
>>
>
>and 
>
>  
>
>>D:\Program_Files\apache\xindice-1.1b4\java\examples>ant
>>Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\j2re1.4.2_05\lib\tools.jar
>>Buildfile: build.xml
>>    
>>
>
>(Stupic MSWindows.) 
>
>But,
>
>  
>
>>init:
>>
>>addressbook-init:
>>
>>addressbook-build:
>>    [javac] Compiling 10 source files to D:\Program_Files\apache\xindice-1.1b4\build\addressbook-classes
>>
>>addressbook-release:
>>      [war] Building war: D:\Program_Files\apache\xindice-1.1b4\dist\addressbook.war
>>
>>guide-init:
>>    [mkdir] Created dir: D:\Program_Files\apache\xindice-1.1b4\build\guide-classes
>>
>>guide-build:
>>    [javac] Compiling 8 source files to D:\Program_Files\apache\xindice-1.1b4\build\guide-classes
>>
>>guide-release:
>>      [jar] Building jar: D:\Program_Files\apache\xindice-1.1b4\dist\xindice-guide.jar
>>
>>release:
>>
>>BUILD SUCCESSFUL
>>Total time: 6 seconds
>>    
>>
>
>Hmm. Okay, so the examples that don't run when I do this:
>
>  
>
>>D:\Program_Files\apache\xindice-1.1b4\java\examples>cd guide
>>
>>D:\Program_Files\apache\xindice-1.1b4\java\examples\guide>.\run org.apache.xindice.examples.Example1
>>D:\Program_Files\apache\xindice-1.1b4
>>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xindice/examples/Example1
>>    
>>
>
>are all under the build subdirectory, under the addressbook-classes and
>guide-classes directories.
>

run.bat is probably outdated. Check email archives, I've sent updated 
run.bat to the list.


>Well, you know what I'm going to do, I'm going to drop that
>addressbook.war into TC. My, that was fast. And I try to look at the
>list of contacts on http://localhost and xindice wants to read from port
>8888. And I've left xindice on port 8080 because I'm lazy. Arrgghhh.
>

You can set environment variable to let Xindice know which port to use. 
See wiki.

Vadim