Home » Eclipse Projects » Eclipse Platform » Conflict in antlr versions.
|
Re: Conflict in antlr versions. [message #318422 is a reply to message #318407] |
Sat, 28 July 2007 21:47 |
Eclipse User |
|
|
|
Originally posted by: jacek.pospychala.pl.ibm.com
Franck,
I would try to separate the plugin in two:
one that depends on ant, but doesn't export this dependency.
other that has antlr jar.
Of course they coudn't then communicate using any classes that require
antlr to avoid trouble with incompatible classes of the same names.
Franck Dubé wrote:
> Hi,
>
> We're currently trying to use antlr inside of our plug-in. We got the
> newest version from their web site (I believe it's 2.7.6) but it seems
> that there is a conflict with some other antlr library (the ones in
> ant) since we also need to use the ant dependencies in our plug-in.
> We really want to be using the newest versions of antlr and were
> wondering if there was any way of dealing with it.
>
> Thanks,
>
> Franck Dubé
|
|
| |
Re: Conflict in antlr versions. [message #318465 is a reply to message #318455] |
Mon, 30 July 2007 15:22 |
Franck Dubé Messages: 32 Registered: July 2009 |
Member |
|
|
Hi,
Just an update. We decided to try out splitting into two plug-ins even
though this would be kind of unclean and all just to give it a shot. It
seems that even though the other plug-in doesn't use ant, we still
encounter the same problem. So basically here's what we do.
We are developing a plug-in that uses the ANTLR plug-in to generate a
parser that is used to analyze some strings. So the plug-in uses a
dependency to the ANTLR libraries (so it can use classes like
TokenBuffer and all). Everything builds fine and seems to be working
right until the ANTLR classes are used. When this happens, the
execution is interrupted and in the Eclipse log, we get this error :
java.lang.NoClassDefFoundError: antlr/TokenStream
The weird thing is that this class is included in the ANTLR dependency
and that everything builds fine. Also, we somehow cannot catch this
exception even if we use try{}catch(Exception e){} or any other thing.
And so the execution cannot go on and the parser cannot be used.
This happens whether or not the plug-in uses ant. Also, if we use the
exact same code in a dummy project that isn't a plug-in, everything
works great. So we're guessing there are some conflicts in the base
libraries of the PDE or something.
Is there any way to fix this problem?
Thanks everyone.
Franck Dubé wrote:
> I'm afraid that won't be possible. The classes that use ant and the
> ones that use antlr are too tightly coupled and a loose coupling would
> be extremely hard to create.
>
> Any other ideas?
>
> Jacek Pospychala wrote:
>> Franck,
>> I would try to separate the plugin in two:
>> one that depends on ant, but doesn't export this dependency.
>> other that has antlr jar.
>>
>> Of course they coudn't then communicate using any classes that require
>> antlr to avoid trouble with incompatible classes of the same names.
>>
>> Franck Dubé wrote:
>>> Hi,
>>>
>>> We're currently trying to use antlr inside of our plug-in. We got
>>> the newest version from their web site (I believe it's 2.7.6) but it
>>> seems that there is a conflict with some other antlr library (the
>>> ones in ant) since we also need to use the ant dependencies in our
>>> plug-in. We really want to be using the newest versions of antlr and
>>> were wondering if there was any way of dealing with it.
>>>
>>> Thanks,
>>>
>>> Franck Dubé
|
|
|
Re: Conflict in antlr versions. [message #318486 is a reply to message #318465] |
Mon, 30 July 2007 22:19 |
Eclipse User |
|
|
|
Originally posted by: jacek.pospychala.pl.ibm.com
Franck,
first, I'll go back to your previous question. I just realised, that
bundles can declare versions for exported packages. And second, you can
add either whole bundles to dependencies as well as single java packages
with certain version. So maybe if you created bundle with latest antlr
and marked all exported ANTLR classes with higher version, than they are
in ant bundle, then you could probably easily declare dependency on
those packages in your own plug-in. You could get more details on this
at eclipse.technology.equinox
Regarding NoClassDefFoundError, just to verify, your plugin in runtime
(1) generaes a parser and then you (2) run this parser, right?
And NoClassDefFoundError is thrown in step (2), correct?
I wonder how are you compiling generated parser to class files and how
are you launching it? By loading generated classes directly by
classloader, or calling somehow externally? From error it seems, that
ANTLR is not found on parser classpath, and this classpath depends on
how you launch the parser.
Franck Dubé wrote:
> Hi,
>
> Just an update. We decided to try out splitting into two plug-ins
> even though this would be kind of unclean and all just to give it a
> shot. It seems that even though the other plug-in doesn't use ant, we
> still encounter the same problem. So basically here's what we do.
>
> We are developing a plug-in that uses the ANTLR plug-in to generate a
> parser that is used to analyze some strings. So the plug-in uses a
> dependency to the ANTLR libraries (so it can use classes like
> TokenBuffer and all). Everything builds fine and seems to be working
> right until the ANTLR classes are used. When this happens, the
> execution is interrupted and in the Eclipse log, we get this error :
>
> java.lang.NoClassDefFoundError: antlr/TokenStream
>
> The weird thing is that this class is included in the ANTLR dependency
> and that everything builds fine. Also, we somehow cannot catch this
> exception even if we use try{}catch(Exception e){} or any other thing.
> And so the execution cannot go on and the parser cannot be used.
>
> This happens whether or not the plug-in uses ant. Also, if we use the
> exact same code in a dummy project that isn't a plug-in, everything
> works great. So we're guessing there are some conflicts in the base
> libraries of the PDE or something.
>
> Is there any way to fix this problem?
> Thanks everyone.
>
>
> Franck Dubé wrote:
>> I'm afraid that won't be possible. The classes that use ant and the
>> ones that use antlr are too tightly coupled and a loose coupling
>> would be extremely hard to create.
>>
>> Any other ideas?
>>
>> Jacek Pospychala wrote:
>>> Franck,
>>> I would try to separate the plugin in two:
>>> one that depends on ant, but doesn't export this dependency.
>>> other that has antlr jar.
>>>
>>> Of course they coudn't then communicate using any classes that
>>> require antlr to avoid trouble with incompatible classes of the same
>>> names.
>>>
>>> Franck Dubé wrote:
>>>> Hi,
>>>>
>>>> We're currently trying to use antlr inside of our plug-in. We got
>>>> the newest version from their web site (I believe it's 2.7.6) but
>>>> it seems that there is a conflict with some other antlr library
>>>> (the ones in ant) since we also need to use the ant dependencies in
>>>> our plug-in. We really want to be using the newest versions of
>>>> antlr and were wondering if there was any way of dealing with it.
>>>>
>>>> Thanks,
>>>>
>>>> Franck Dubé
|
|
|
Re: Conflict in antlr versions. [message #318536 is a reply to message #318486] |
Tue, 31 July 2007 16:10 |
Franck Dubé Messages: 32 Registered: July 2009 |
Member |
|
|
Hi,
Well it seems that the problem runs deeper than I thought. I don't know
if this is actually a bug. Since I don't know how to fill in a bug
report, I'd be very grateful if someone did. So here's the thing! It
seem that I can't create a dependency at all :P
It seems that whenever we try to add a dependency to something else, we
get the java.lang.NoClassDefFoundError exception. We did a simple
example. Basically we have a DummyProject, containing a DummyClass with
a static dummyMethod that prints "Yay!" in System.out. We then add the
project to our plug-in's Java Build Path. Then, in on of the plug-in's
actions, we call the dummyMethod. And there we go, exception. We tried
the same with a compiled jar, same results.
Are we doing something wrong?
Jacek Pospychala wrote:
> Franck,
> first, I'll go back to your previous question. I just realised, that
> bundles can declare versions for exported packages. And second, you can
> add either whole bundles to dependencies as well as single java packages
> with certain version. So maybe if you created bundle with latest antlr
> and marked all exported ANTLR classes with higher version, than they are
> in ant bundle, then you could probably easily declare dependency on
> those packages in your own plug-in. You could get more details on this
> at eclipse.technology.equinox
>
> Regarding NoClassDefFoundError, just to verify, your plugin in runtime
> (1) generaes a parser and then you (2) run this parser, right?
> And NoClassDefFoundError is thrown in step (2), correct?
>
> I wonder how are you compiling generated parser to class files and how
> are you launching it? By loading generated classes directly by
> classloader, or calling somehow externally? From error it seems, that
> ANTLR is not found on parser classpath, and this classpath depends on
> how you launch the parser.
>
>
> Franck Dubé wrote:
>> Hi,
>>
>> Just an update. We decided to try out splitting into two plug-ins
>> even though this would be kind of unclean and all just to give it a
>> shot. It seems that even though the other plug-in doesn't use ant, we
>> still encounter the same problem. So basically here's what we do.
>>
>> We are developing a plug-in that uses the ANTLR plug-in to generate a
>> parser that is used to analyze some strings. So the plug-in uses a
>> dependency to the ANTLR libraries (so it can use classes like
>> TokenBuffer and all). Everything builds fine and seems to be working
>> right until the ANTLR classes are used. When this happens, the
>> execution is interrupted and in the Eclipse log, we get this error :
>>
>> java.lang.NoClassDefFoundError: antlr/TokenStream
>>
>> The weird thing is that this class is included in the ANTLR dependency
>> and that everything builds fine. Also, we somehow cannot catch this
>> exception even if we use try{}catch(Exception e){} or any other thing.
>> And so the execution cannot go on and the parser cannot be used.
>>
>> This happens whether or not the plug-in uses ant. Also, if we use the
>> exact same code in a dummy project that isn't a plug-in, everything
>> works great. So we're guessing there are some conflicts in the base
>> libraries of the PDE or something.
>>
>> Is there any way to fix this problem?
>> Thanks everyone.
>>
>>
>> Franck Dubé wrote:
>>> I'm afraid that won't be possible. The classes that use ant and the
>>> ones that use antlr are too tightly coupled and a loose coupling
>>> would be extremely hard to create.
>>>
>>> Any other ideas?
>>>
>>> Jacek Pospychala wrote:
>>>> Franck,
>>>> I would try to separate the plugin in two:
>>>> one that depends on ant, but doesn't export this dependency.
>>>> other that has antlr jar.
>>>>
>>>> Of course they coudn't then communicate using any classes that
>>>> require antlr to avoid trouble with incompatible classes of the same
>>>> names.
>>>>
>>>> Franck Dubé wrote:
>>>>> Hi,
>>>>>
>>>>> We're currently trying to use antlr inside of our plug-in. We got
>>>>> the newest version from their web site (I believe it's 2.7.6) but
>>>>> it seems that there is a conflict with some other antlr library
>>>>> (the ones in ant) since we also need to use the ant dependencies in
>>>>> our plug-in. We really want to be using the newest versions of
>>>>> antlr and were wondering if there was any way of dealing with it.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Franck Dubé
|
|
|
Re: Conflict in antlr versions. [message #318555 is a reply to message #318536] |
Tue, 31 July 2007 18:27 |
Eclipse User |
|
|
|
Originally posted by: mlavigne.adacel.com
Hi Franck
When you're using an external Jar library in Eclipse Plugin, you need to
add this library to the classpath using plugin.xml->Runtime tab->Classpath.
So I guess that if you add the antlr library to the classpath, you
should not see NoClassDefFoundError anymore
This should do the work :)
Mott
Franck Dubé wrote:
> Hi,
>
> Well it seems that the problem runs deeper than I thought. I don't know
> if this is actually a bug. Since I don't know how to fill in a bug
> report, I'd be very grateful if someone did. So here's the thing! It
> seem that I can't create a dependency at all :P
> It seems that whenever we try to add a dependency to something else, we
> get the java.lang.NoClassDefFoundError exception. We did a simple
> example. Basically we have a DummyProject, containing a DummyClass with
> a static dummyMethod that prints "Yay!" in System.out. We then add the
> project to our plug-in's Java Build Path. Then, in on of the plug-in's
> actions, we call the dummyMethod. And there we go, exception. We tried
> the same with a compiled jar, same results.
> Are we doing something wrong?
>
>
> Jacek Pospychala wrote:
>> Franck,
>> first, I'll go back to your previous question. I just realised, that
>> bundles can declare versions for exported packages. And second, you
>> can add either whole bundles to dependencies as well as single java
>> packages with certain version. So maybe if you created bundle with
>> latest antlr and marked all exported ANTLR classes with higher
>> version, than they are in ant bundle, then you could probably easily
>> declare dependency on those packages in your own plug-in. You could
>> get more details on this at eclipse.technology.equinox
>>
>> Regarding NoClassDefFoundError, just to verify, your plugin in runtime
>> (1) generaes a parser and then you (2) run this parser, right?
>> And NoClassDefFoundError is thrown in step (2), correct?
>>
>> I wonder how are you compiling generated parser to class files and how
>> are you launching it? By loading generated classes directly by
>> classloader, or calling somehow externally? From error it seems, that
>> ANTLR is not found on parser classpath, and this classpath depends on
>> how you launch the parser.
>>
>>
>> Franck Dubé wrote:
>>> Hi,
>>>
>>> Just an update. We decided to try out splitting into two plug-ins
>>> even though this would be kind of unclean and all just to give it a
>>> shot. It seems that even though the other plug-in doesn't use ant,
>>> we still encounter the same problem. So basically here's what we do.
>>>
>>> We are developing a plug-in that uses the ANTLR plug-in to generate a
>>> parser that is used to analyze some strings. So the plug-in uses a
>>> dependency to the ANTLR libraries (so it can use classes like
>>> TokenBuffer and all). Everything builds fine and seems to be working
>>> right until the ANTLR classes are used. When this happens, the
>>> execution is interrupted and in the Eclipse log, we get this error :
>>>
>>> java.lang.NoClassDefFoundError: antlr/TokenStream
>>>
>>> The weird thing is that this class is included in the ANTLR
>>> dependency and that everything builds fine. Also, we somehow cannot
>>> catch this exception even if we use try{}catch(Exception e){} or any
>>> other thing. And so the execution cannot go on and the parser cannot
>>> be used.
>>>
>>> This happens whether or not the plug-in uses ant. Also, if we use
>>> the exact same code in a dummy project that isn't a plug-in,
>>> everything works great. So we're guessing there are some conflicts
>>> in the base libraries of the PDE or something.
>>>
>>> Is there any way to fix this problem?
>>> Thanks everyone.
>>>
>>>
>>> Franck Dubé wrote:
>>>> I'm afraid that won't be possible. The classes that use ant and the
>>>> ones that use antlr are too tightly coupled and a loose coupling
>>>> would be extremely hard to create.
>>>>
>>>> Any other ideas?
>>>>
>>>> Jacek Pospychala wrote:
>>>>> Franck,
>>>>> I would try to separate the plugin in two:
>>>>> one that depends on ant, but doesn't export this dependency.
>>>>> other that has antlr jar.
>>>>>
>>>>> Of course they coudn't then communicate using any classes that
>>>>> require antlr to avoid trouble with incompatible classes of the
>>>>> same names.
>>>>>
>>>>> Franck Dubé wrote:
>>>>>> Hi,
>>>>>>
>>>>>> We're currently trying to use antlr inside of our plug-in. We got
>>>>>> the newest version from their web site (I believe it's 2.7.6) but
>>>>>> it seems that there is a conflict with some other antlr library
>>>>>> (the ones in ant) since we also need to use the ant dependencies
>>>>>> in our plug-in. We really want to be using the newest versions of
>>>>>> antlr and were wondering if there was any way of dealing with it.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Franck Dubé
|
|
|
Re: Conflict in antlr versions. [message #318559 is a reply to message #318555] |
Tue, 31 July 2007 18:46 |
Franck Dubé Messages: 32 Registered: July 2009 |
Member |
|
|
OMG!
That was it? We just spent a whole lot of time trying to find what was
the problem...
In-f*in-credible...this actually works. Can't believe it.
Well thanks a lot! To all who helped!
Marc-André Lavigne wrote:
> Hi Franck
>
> When you're using an external Jar library in Eclipse Plugin, you need to
> add this library to the classpath using plugin.xml->Runtime tab->Classpath.
>
> So I guess that if you add the antlr library to the classpath, you
> should not see NoClassDefFoundError anymore
>
> This should do the work :)
>
> Mott
>
>
> Franck Dubé wrote:
>> Hi,
>>
>> Well it seems that the problem runs deeper than I thought. I don't
>> know if this is actually a bug. Since I don't know how to fill in a
>> bug report, I'd be very grateful if someone did. So here's the
>> thing! It seem that I can't create a dependency at all :P
>> It seems that whenever we try to add a dependency to something else,
>> we get the java.lang.NoClassDefFoundError exception. We did a simple
>> example. Basically we have a DummyProject, containing a DummyClass
>> with a static dummyMethod that prints "Yay!" in System.out. We then
>> add the project to our plug-in's Java Build Path. Then, in on of the
>> plug-in's actions, we call the dummyMethod. And there we go,
>> exception. We tried the same with a compiled jar, same results.
>> Are we doing something wrong?
>>
>>
>> Jacek Pospychala wrote:
>>> Franck,
>>> first, I'll go back to your previous question. I just realised, that
>>> bundles can declare versions for exported packages. And second, you
>>> can add either whole bundles to dependencies as well as single java
>>> packages with certain version. So maybe if you created bundle with
>>> latest antlr and marked all exported ANTLR classes with higher
>>> version, than they are in ant bundle, then you could probably easily
>>> declare dependency on those packages in your own plug-in. You could
>>> get more details on this at eclipse.technology.equinox
>>>
>>> Regarding NoClassDefFoundError, just to verify, your plugin in
>>> runtime (1) generaes a parser and then you (2) run this parser, right?
>>> And NoClassDefFoundError is thrown in step (2), correct?
>>>
>>> I wonder how are you compiling generated parser to class files and
>>> how are you launching it? By loading generated classes directly by
>>> classloader, or calling somehow externally? From error it seems, that
>>> ANTLR is not found on parser classpath, and this classpath depends on
>>> how you launch the parser.
>>>
>>>
>>> Franck Dubé wrote:
>>>> Hi,
>>>>
>>>> Just an update. We decided to try out splitting into two plug-ins
>>>> even though this would be kind of unclean and all just to give it a
>>>> shot. It seems that even though the other plug-in doesn't use ant,
>>>> we still encounter the same problem. So basically here's what we do.
>>>>
>>>> We are developing a plug-in that uses the ANTLR plug-in to generate
>>>> a parser that is used to analyze some strings. So the plug-in uses
>>>> a dependency to the ANTLR libraries (so it can use classes like
>>>> TokenBuffer and all). Everything builds fine and seems to be
>>>> working right until the ANTLR classes are used. When this happens,
>>>> the execution is interrupted and in the Eclipse log, we get this
>>>> error :
>>>>
>>>> java.lang.NoClassDefFoundError: antlr/TokenStream
>>>>
>>>> The weird thing is that this class is included in the ANTLR
>>>> dependency and that everything builds fine. Also, we somehow cannot
>>>> catch this exception even if we use try{}catch(Exception e){} or any
>>>> other thing. And so the execution cannot go on and the parser cannot
>>>> be used.
>>>>
>>>> This happens whether or not the plug-in uses ant. Also, if we use
>>>> the exact same code in a dummy project that isn't a plug-in,
>>>> everything works great. So we're guessing there are some conflicts
>>>> in the base libraries of the PDE or something.
>>>>
>>>> Is there any way to fix this problem?
>>>> Thanks everyone.
>>>>
>>>>
>>>> Franck Dubé wrote:
>>>>> I'm afraid that won't be possible. The classes that use ant and
>>>>> the ones that use antlr are too tightly coupled and a loose
>>>>> coupling would be extremely hard to create.
>>>>>
>>>>> Any other ideas?
>>>>>
>>>>> Jacek Pospychala wrote:
>>>>>> Franck,
>>>>>> I would try to separate the plugin in two:
>>>>>> one that depends on ant, but doesn't export this dependency.
>>>>>> other that has antlr jar.
>>>>>>
>>>>>> Of course they coudn't then communicate using any classes that
>>>>>> require antlr to avoid trouble with incompatible classes of the
>>>>>> same names.
>>>>>>
>>>>>> Franck Dubé wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> We're currently trying to use antlr inside of our plug-in. We
>>>>>>> got the newest version from their web site (I believe it's 2.7.6)
>>>>>>> but it seems that there is a conflict with some other antlr
>>>>>>> library (the ones in ant) since we also need to use the ant
>>>>>>> dependencies in our plug-in. We really want to be using the
>>>>>>> newest versions of antlr and were wondering if there was any way
>>>>>>> of dealing with it.
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Franck Dubé
|
|
|
Goto Forum:
Current Time: Tue Jan 28 14:05:14 GMT 2025
Powered by FUDForum. Page generated in 0.04145 seconds
|