Help with Compiling Sample Code.

View: New views
5 Messages — Rating Filter:   Alert me  

Help with Compiling Sample Code.

by Ian Ogilvie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying to leverage code I found here to work in my application.


I'm using eclipse ( version 3.4.0 ) and importing these


import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
import org.codehaus.stax2.XMLInputFactory2;
import org.codehaus.stax2.XMLStreamReader2;

The editor is fine with these in my build_path, meaning errors only show up when I do not have the right jar files in my build path.

But the compiler gives me these errors.
package org.codehaus.stax2 does not exist
    [javac] import org.codehaus.stax2.XMLInputFactory2;

package org.codehaus.stax2 does not exist
    [javac] import org.codehaus.stax2.XMLStreamReader2;

cannot find symbol
    [javac] symbol  : class XMLInputFactory2
    [javac] location: class com.windsor.node.plugin.odpx.SimpleOdpxRequestProcessor
    [javac]                         XMLInputFactory2 xmlif = null ;

In my buildl path I've tried just about every combination of every jar file  I can find that even hints it's relevant to stax or woodstox including the source package available on this page.

jsr173_api.jar
stax-api-1.0.1.jar
stax2-api-3.0.1.jar
woodstox-core-lgpl-4.0.4.jar
woodstox-msv-core-2.0.0.jar
wstx-lgpl-3.2.9.jar
sax2.jar

I'm on a Mac using jre 1.6.0. Again the source code in the editor looks fine and reports no errors. It's only when I build the project that I get errors.

Any suggestions on how to get past this?

Thanks!
Ian

Ian Ogilvie
Gulf of Maine Ocean Observing System (GoMOOS)

207-529-4442 (Phone)
207-380-0074 (Cell- NEW NUMBER as of 12/27/2007)
207-529-5899 (Fax)
iChat/AIM: ian74@...
jabber: iogilvie@...
Skype: iogilvie





Re: Help with Compiling Sample Code.

by Cowtowncoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, May 27, 2009 at 8:35 AM, Ian Ogilvie <ian@...> wrote:
> I'm trying to leverage code I found here to work in my application.
> http://www.vsj.co.uk/articles/display.asp?id=643
> I'm using eclipse ( version 3.4.0 ) and importing these

Ok.

> import javax.xml.stream.XMLStreamException;
> import javax.xml.stream.events.XMLEvent;
> import org.codehaus.stax2.XMLInputFactory2;
> import org.codehaus.stax2.XMLStreamReader2;
>
> The editor is fine with these in my build_path, meaning errors only show up
> when I do not have the right jar files in my build path.
> But the compiler gives me these errors.
...
> stax2-api-3.0.1.jar

   ^^^^

this is the jar that contains Stax2 API classes.

Is it possible that you might have another instance of stax2-api jar;
or possibly an earlier version of woodstox (3.x)? This could be a
class loader issue, since there have been changes between woodstox 3
and 4 (which correspond to Stax2 API versions 2 and 3).

I think some Eclipse plug-ins embed Woodstox, but that should not be
visible to code being compiled or run. So I hope those can not
conflict.

...
> I'm on a Mac using jre 1.6.0. Again the source code in the editor looks fine
> and reports no errors. It's only when I build the project that I get errors.
> Any suggestions on how to get past this?

I haven't heard of platform-specific problems, although my main dev
platform is linux so I can not verify with eclipse & macos. But I
don't think that should be a problem.

Hope this helps,

-+ Tatu +-

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Help with Compiling Sample Code.

by Cowtowncoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ah, forgot to mention one relevant thing:

> In my buildl path I've tried just about every combination of every jar file
>  I can find that even hints it's relevant to stax or woodstox including the
> source package available on this page.
> http://woodstox.codehaus.org/Download
> jsr173_api.jar
> stax-api-1.0.1.jar
> stax2-api-3.0.1.jar
> woodstox-core-lgpl-4.0.4.jar
> woodstox-msv-core-2.0.0.jar
> wstx-lgpl-3.2.9.jar
> sax2.jar

Of these, drop 'wstx-lgpl-3.2.9' (it contains older version of
woodstox as well as stax api -- there are 2 variants of woodstox-3
versions, and this one contains stax2 api too). I think this might
cause the problem.

Also: when running on JDK/JRE 1.6, stax-api (javax.xml.stream) is
included, leave that out. jsr173_api.jar actually contains same API
classes so drop that too. :)
And sax2 contains SAX API (org.xml.sax), likewise provided by JDKs 1.4
and above.  So it is not needed.

Removing these jars is a good idea just to ensure that JDK versions
are used both by editor and by runtime (JDK/JRE versions should have
precedence, but I'm not sure if Eclipse always honors that).

-+ Tatu +-

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Help with Compiling Sample Code.

by Ian Ogilvie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tatu,

Thanks for the reply!

I removed any extra jar's from my build path and now have just these ( plus lots of others not related I hope).

stax2-api-3.0.1.jar
woodstox-core-lgpl-4.0.4.jar
woodstox-msv-core-2.0.0.jar

I also moved them to the head of the "order" (above the JRE)  in the project build editor but that had no effect.

I still get compile errors...

73: package org.codehaus.stax2 does not exist
    [javac] import org.codehaus.stax2.XMLInputFactory2;

symbol  : class XMLInputFactory2
    [javac] location: class com.windsor.node.plugin.odpx.SimpleOdpxRequestProcessor
    [javac]                         XMLInputFactory2 xmlif = null ;

I of course don't know but it sure seems as if I'm missing something stax2 requires at compile time and that's why I get the "does not exist" message.

Any ideas are greatly appreciated but I know this is a tough problem to solve remotely!

Thanks again!

Ian

On May 27, 2009, at Wednesday, May 27, 20094:05 PM, Tatu Saloranta wrote:

Ah, forgot to mention one relevant thing:

In my buildl path I've tried just about every combination of every jar file
I can find that even hints it's relevant to stax or woodstox including the
source package available on this page.
http://woodstox.codehaus.org/Download
jsr173_api.jar
stax-api-1.0.1.jar
stax2-api-3.0.1.jar
woodstox-core-lgpl-4.0.4.jar
woodstox-msv-core-2.0.0.jar
wstx-lgpl-3.2.9.jar
sax2.jar

Of these, drop 'wstx-lgpl-3.2.9' (it contains older version of
woodstox as well as stax api -- there are 2 variants of woodstox-3
versions, and this one contains stax2 api too). I think this might
cause the problem.

Also: when running on JDK/JRE 1.6, stax-api (javax.xml.stream) is
included, leave that out. jsr173_api.jar actually contains same API
classes so drop that too. :)
And sax2 contains SAX API (org.xml.sax), likewise provided by JDKs 1.4
and above.  So it is not needed.

Removing these jars is a good idea just to ensure that JDK versions
are used both by editor and by runtime (JDK/JRE versions should have
precedence, but I'm not sure if Eclipse always honors that).

-+ Tatu +-

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Ian Ogilvie
Gulf of Maine Ocean Observing System (GoMOOS)

207-529-4442 (Phone)
207-380-0074 (Cell-Phone)
207-529-5899 (Fax)
iChat/AIM: ian74@...
jabber: iogilvie@...
Skype: iogilvie



Re: Help with Compiling Sample Code.

by Cowtowncoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, May 27, 2009 at 1:53 PM, Ian Ogilvie <ian@...> wrote:
> Tatu,
> Thanks for the reply!
> I removed any extra jar's from my build path and now have just these ( plus
> lots of others not related I hope).
>
> stax2-api-3.0.1.jar
> woodstox-core-lgpl-4.0.4.jar
> woodstox-msv-core-2.0.0.jar

Ok.

> I also moved them to the head of the "order" (above the JRE)  in the project
> build editor but that had no effect.
> I still get compile errors...
> 73: package org.codehaus.stax2 does not exist
>     [javac] import org.codehaus.stax2.XMLInputFactory2;
> symbol  : class XMLInputFactory2
>     [javac] location: class
> com.windsor.node.plugin.odpx.SimpleOdpxRequestProcessor
>     [javac]                         XMLInputFactory2 xmlif = null ;
> I of course don't know but it sure seems as if I'm missing something stax2
> requires at compile time and that's why I get the "does not exist" message.
> Any ideas are greatly appreciated but I know this is a tough problem to
> solve remotely!

Another guess: perhaps compilation is done using 1.6, but runtime uses 1.5?
If so, maybe you do need "stax-api-1.0.1" after all, since its
contents (javax.xml.stream) are only bundled with 1.6, not 1.5.
That's about the only thing stax2 api itself depends on, so that could be it?

-+ Tatu +-

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email