You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by Marshall Schor <ms...@schor.com> on 2010/01/04 20:00:18 UTC

digging into an issue with the Component Discriptor Editor (CDE) and RC8 with UIMA-AS components

A user has reported a CDE failure when editing a aggregate descriptor
that contains references to remote uima-as services.

The CDE attempts to acquire the remote services "metadata" to merge type
system information, and fails, because of a ClassCastException:

org.apache.activemq.ActiveMQConnectionFactory cannot be cast to
javax.jms.ConnectionFactory

In looking into this, I've come across the project:

    uimaj-as-osgi-runtime

and need to understand this project better.  I think it was added to
support the camel sandbox project.

This project is set up in its POM with a parent pom which is the common
superPom for all eclipse plugins. 

It's also put into the Eclipse plugin directory by the uima-as-distr
maven install step.

However, it is not included in the Eclipse update site building, and is
not part of any Uima Eclipse Feature.

So - first question: is this supposed to be an eclipse plugin? 

2nd question: does it need to be added to any "feature" set? if so,
which one?

This project builds a jar which contains two jars:
apache-activemq-4.1.1.jar and geronimo-jms_1.1_spec-1.0.jar, both of
which have versions of the javax.jms.ConnectionFactory.

3rd question: how to resolve this so that identical class names here
don't cause issues?

(I'm not yet sure if this is the real issue, so these may not be quite
the right questions, but I want to start somewhere :-)  )

-Marshall



Re: digging into an issue with the Component Discriptor Editor (CDE) and RC8 with UIMA-AS components

Posted by Marshall Schor <ms...@schor.com>.
More digging.  The previous post is a tangent to the real issue, but I
still want to learn if we're missing something with the osgi packaging
for uima-as.

Back to the original problem.  Instrumenting things shows that:

-

- the CDE is making lots of instances of ResourceManager -
classloaders.  The javadoc comment in fact says to make a new one
anytime one is needed in the CDE, to pick up any changes the user might
have made to the project's class path.  The use case comes from the
following kind of sequence:

user is trying to add an import of a delegate by name, and discovers
they forgot to add it to the class path; they fix the project build
path, and try to add it again (this time should work).

- The uima resources that are loaded via the Resource manager are loaded
with a class loader that does not first delegate.  Therefore, one should
not have things in the UIMA classpath which are core uima classes.  The
classpath loader builder in the CDE in fact filters the core uima
framework classes it uses, out of the classpath it builds.  But this
filter doesn't work for "custom resource specifiers" - which can be any
user defined class.

- The uima-as design for supporting uima-as services as remote delegates
makes use of these custom resource specifiers.  If we filtered these
out, then custom resource specifiers would generate a class-not-found
exception. 

Therefore, I think we cannot filter these; I think we just need to make
these work. The reason it is not working I traced to this bit of code in
uima-as:

The exception occurs in this code:

    public void create() throws Exception {
      ConnectionFactory connectionFactory =
        (ConnectionFactory)jndiContext.lookup("ConnectionFactory");

The jndiContext.lookup is returning the same object every time it is
called. JNDI appears to "cache" the ActiveMQ connection Factory - but
this doesn't work properly here, because the interface changes each time
a new resource manager is used to load it (it's the same class,
javax.jms.ConnectionFactory, but it is loaded each time from a different
class loader, making Casts not work). 

Is there a reason we're using JNDI to cache this object, rather than
just using Class.forName(...) to get the factory?


- We probably ought to implement fix to speed things up for this case in
the CDE (because it's quite slow to open one of these descriptors): by
being more intelligent about reusing resource managers, and just
creating new ones if the classpath changes.


-Marshall


Marshall Schor wrote:
> A user has reported a CDE failure when editing a aggregate descriptor
> that contains references to remote uima-as services.
>
> The CDE attempts to acquire the remote services "metadata" to merge type
> system information, and fails, because of a ClassCastException:
>
> org.apache.activemq.ActiveMQConnectionFactory cannot be cast to
> javax.jms.ConnectionFactory
>
> In looking into this, I've come across the project:
>
>     uimaj-as-osgi-runtime
>
> and need to understand this project better.  I think it was added to
> support the camel sandbox project.
>
> This project is set up in its POM with a parent pom which is the common
> superPom for all eclipse plugins. 
>
> It's also put into the Eclipse plugin directory by the uima-as-distr
> maven install step.
>
> However, it is not included in the Eclipse update site building, and is
> not part of any Uima Eclipse Feature.
>
> So - first question: is this supposed to be an eclipse plugin? 
>
> 2nd question: does it need to be added to any "feature" set? if so,
> which one?
>
> This project builds a jar which contains two jars:
> apache-activemq-4.1.1.jar and geronimo-jms_1.1_spec-1.0.jar, both of
> which have versions of the javax.jms.ConnectionFactory.
>
> 3rd question: how to resolve this so that identical class names here
> don't cause issues?
>
> (I'm not yet sure if this is the real issue, so these may not be quite
> the right questions, but I want to start somewhere :-)  )
>
> -Marshall
>
>
>
>
>   

Re: digging into an issue with the Component Discriptor Editor (CDE) and RC8 with UIMA-AS components

Posted by Marshall Schor <ms...@schor.com>.

Marshall Schor wrote:
> A user has reported a CDE failure when editing a aggregate descriptor
> that contains references to remote uima-as services.
>
> The CDE attempts to acquire the remote services "metadata" to merge type
> system information, and fails, because of a ClassCastException:
>
> org.apache.activemq.ActiveMQConnectionFactory cannot be cast to
> javax.jms.ConnectionFactory
>
> In looking into this, I've come across the project:
>
>     uimaj-as-osgi-runtime
>
> and need to understand this project better.  I think it was added to
> support the camel sandbox project.
>
> This project is set up in its POM with a parent pom which is the common
> superPom for all eclipse plugins. 
>
> It's also put into the Eclipse plugin directory by the uima-as-distr
> maven install step.
>
> However, it is not included in the Eclipse update site building, and is
> not part of any Uima Eclipse Feature.
>
> So - first question: is this supposed to be an eclipse plugin? 
>   

I'm concluding that it is not an Eclipse plugin - If I recall correctly,
it is an "osgi" bundle intended to be used as such, not within the
Eclipse environment.
> 2nd question: does it need to be added to any "feature" set? if so,
> which one?
>   

Because it's not part of Eclipse plugins, it doesn't need to be added to
any Eclipse feature, as far as I can determine.
> This project builds a jar which contains two jars:
> apache-activemq-4.1.1.jar and geronimo-jms_1.1_spec-1.0.jar, both of
> which have versions of the javax.jms.ConnectionFactory.
>
>   

I don't think it actually builds a jar containing both of these. 
Instead, it appears to "flatten" all the jars so no "jars" appear inside
of the main Jar, just all the classes.  This is done using the felix
maven bundle directive
<Embed-Dependency>*;scope=compile;inline=true</Embed-Dependency>.  If
you remove the inline=true, then it does build a Jar containing the 3
uima-as jars plus the apache-activemq-4.1.1 jar and the spring-2.0.6
jar.   (Caution: I'm not totally 100% sure that's what's happening,
because I've been fiddling with the POM and haven't restored it to its
original state - please post if this is incorrect)

> 3rd question: how to resolve this so that identical class names here
> don't cause issues?
>
>   

No need to resolve as far as I know.

-Marshall