[
https://issues.apache.org/jira/browse/AMQ-3853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281334#comment-13281334
]
Christian Posta commented on AMQ-3853:
--------------------------------------
Here's my research:
Indeed there were multiple changes in the maven-bundle-plugin to take advantage
of the newer versions of the bnd tool that underlies the maven-bundle-plugin,
but none of those changes were what cause this error.
The bnd tool will not add imports for packages it sees within the bundle. To
make it a short story, some transitive dependencies of the 5.6.0 activemq-core
were including the servlet-api (and thus were part of the bundle) which
explains why the bundle plugin wasn't adding the javax.servlet and
javax.servlet.http packages.
In the activemq-web-console's pom.xml file, you see the following:
{quote}
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
{quote}
And if you follow the dependency tree for
{quote}
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>activemq-core</artifactId>
</dependency>
{quote}
you'll see the two instances of the servlet spec within the transitive deps:
{quote}
mvn dependency:tree | grep servlet
{quote}
You'll see that although the geronimo servlet spec has "provided" scope, the
other two (transitives from fusemq-leveldb->hadoop-core) have "compile" scope
and will be included in the WEB-INF/lib directory of the bundle. Thus when bnd
tries to determine whether to add the appropriate packages, it decides not to
since they're already on the class path.
There are two options to fix:
1) add the javax.servlet and javax.servlet.http to the <Import-Package>
instructions to the bundle plugin. This just kinda glosses over the fact that
the servlet api is being included
or
2) exclude the servlet api from the activemq-core transitive dependencies.
I would suggest the second approach. I've added this patch.
Let me know if I didn't explain something clear.
Christian
Patch is attached.
> Missing import in activemq-web-console
> --------------------------------------
>
> Key: AMQ-3853
> URL: https://issues.apache.org/jira/browse/AMQ-3853
> Project: ActiveMQ
> Issue Type: Bug
> Affects Versions: 5.6.0
> Reporter: Chris Geer
>
> Running activemq-web-console in Karaf generates these errors:
> Caused by: java.lang.ClassNotFoundException:
> javax.servlet.ServletContextListener not found by
> org.apache.activemq.activemq-web-console [118]
> Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter not found
> by org.apache.activemq.activemq-web-console [118]
> Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet
> not found by org.apache.activemq.activemq-web-console [118]
> It looks like activemq-web-console imports the following servlet packages:
> javax.servlet.jsp;version="[2.1,3)",
> javax.servlet.jsp.el;version="[2.1,3)",
> javax.servlet.jsp.tagext;version="[2.1,3)",
> So it seems to be missing imports for:
> javax.servlet
> javax.servlet.http
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira