[MAGNOLIA-2716] Invalid JDOM/JAXEN distribution included Created: 06/May/09  Updated: 27/Nov/13  Resolved: 07/Oct/13

Status: Closed
Project: Magnolia
Component/s: build
Affects Version/s: 4.0.1
Fix Version/s: 4.0.4

Type: Bug Priority: Major
Reporter: Egor Kolesnikov Assignee: Magnolia International
Resolution: Outdated Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

ubuntu 9.04, JBoss 5.0.1, MySQL 5.0


Attachments: Text File server.txt    
Issue Links:
relation
is related to MAGNOLIA-2727 xml libraries: update to jdom 1.1 ver... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

After changing DERBY repository to MYSQL one, the following error appears while deploying to JBoss 5.0.1:

java.lang.NoSuchMethodError: org.jdom.Element.getParent()Lorg/jdom/Element;
at org.jaxen.jdom.DocumentNavigator.getParentAxisIterator(DocumentNavigator.java:252)
at org.jaxen.expr.iter.IterableParentAxis.iterator(IterableParentAxis.java:82)
at org.jaxen.expr.DefaultStep.axisIterator(DefaultStep.java:139)
at org.jaxen.expr.DefaultLocationPath.evaluate(DefaultLocationPath.java:188)

However, after replacing WEB-INF/lib/jaxen-1.0-FCS.jar and WEB-INF/lib/jdom-1.0.jar with jdom.jar, jaxen-core.jar and jaxen-jdom.jar from JDOM1.0 distribution obtained from jdom.org, everything started working properly.



 Comments   
Comment by Magnolia International [ 06/May/09 ]

Did this really only start happening after changing the repo config? I'm probably missing something, but I don't really see the connection ...

Could you also please attach a more complete stacktrace ?

Comment by Magnolia International [ 06/May/09 ]

Note that the jdom-1.0.jar we bundle (from central maven repo) is identical to the jdom.jar found in the jdom distrib.
But there's indeed something fishy with Jaxen: from the JDom 1.0 distrib:

$ cat ./lib/jaxen.readme
The Jaxen libraries included here are based on Jaxen 1.0-FCS.  Jaxen 1.0-FCS
was written against JDOM Beta 9, and for Jaxen to support JDOM Beta 10+, we
had to make the following change to org.jaxen.jdom.DocumentNavigator.  The
jaxen-jdom.jar provided here includes this change, and it's the only
difference between the JARs here and the Jaxen 1.0-FCS JARs.
Comment by Egor Kolesnikov [ 06/May/09 ]

Exactly. Steps to reproduce issue:

1. unpack magnolia-4.0.1 to m.war (or whatever);
2. deploy m.war to JBOSS5_0_1_HOME/server/default/deploy;
3. start jboss;
4. run magnolia install/update routine (at localhost:8080/m), start up Magnolia;
5. install STK-1.0, restart webapp (touch web.xml) or jboss;
6. run magnolia install/update routine (at localhost:8080/m), start up Magnolia;
7. stop jboss;
8. reconfigure magnolia to use mysql:
8.1. update config/default/magnolia.properties to use jackrabbit-bundle-mysql-search.xml;
8.2. update jackrabbit-bundle-mysql-search.xml to use local mysql 5 db;
8.3. delete repositories/magnolia;
8.4. add mysql-connector to jboss/server/default/lib);
9. create empty mysql database;
10. start jboss;
11. ???
12. PROFIT!

<code>
java.lang.NoSuchMethodError: org.jdom.Element.getParent()Lorg/jdom/Element;
<------>at org.jaxen.jdom.DocumentNavigator.getParentAxisIterator(DocumentNavigator.java:252)
<------>at org.jaxen.DefaultNavigator.getParentNode(DefaultNavigator.java:275)
<------>at org.jaxen.expr.NodeComparator.getDepth(NodeComparator.java:164)
<------>at org.jaxen.expr.NodeComparator.compare(NodeComparator.java:107)
<------>at java.util.Arrays.mergeSort(Arrays.java:1270)
<------>at java.util.Arrays.sort(Arrays.java:1210)
<------>at java.util.Collections.sort(Collections.java:159)
<------>at org.jaxen.expr.DefaultLocationPath.evaluate(DefaultLocationPath.java:162)
<------>at org.jaxen.expr.DefaultAbsoluteLocationPath.evaluate(DefaultAbsoluteLocationPath.java:121)
<------>at org.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:112)
<------>at org.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:688)
<------>at org.jaxen.BaseXPath.selectNodes(BaseXPath.java:227)
<------>at org.jdom.xpath.JaxenXPath.selectNodes(JaxenXPath.java:122)
<------>at info.magnolia.cms.util.WebXmlUtil.getElementsFromXPath(WebXmlUtil.java:180)
<------>at info.magnolia.cms.util.WebXmlUtil.checkFilterDispatchersConfiguration(WebXmlUtil.java:144)
<------>at info.magnolia.module.delta.WebXmlConditionsUtil.filterMustBeRegisteredWithCorrectDispatchers(WebXmlConditionsUtil.java:98)
<------>at info.magnolia.setup.CoreModuleVersionHandler.getInstallConditions(CoreModuleVersionHandler.java:143)
<------>at info.magnolia.module.AbstractModuleVersionHandler.getInstall(AbstractModuleVersionHandler.java:169)
<------>at info.magnolia.module.AbstractModuleVersionHandler.getDeltas(AbstractModuleVersionHandler.java:116)
<------>at info.magnolia.module.ModuleManagerImpl.checkForInstallOrUpdates(ModuleManagerImpl.java:158)
<------>at info.magnolia.cms.beans.config.ConfigLoader.load(ConfigLoader.java:107)
<------>at info.magnolia.cms.servlets.MgnlServletContextListener$2.exec(MgnlServletContextListener.java:177)
<------>at info.magnolia.context.MgnlContext.doInSystemContext(MgnlContext.java:377)
<------>at info.magnolia.cms.servlets.MgnlServletContextListener.startServer(MgnlServletContextListener.java:175)
<------>at info.magnolia.cms.servlets.MgnlServletContextListener.contextInitialized(MgnlServletContextListener.java:171)
<------>at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)

</code>

(full log file attached)

Comment by Egor Kolesnikov [ 06/May/09 ]

By the way, it now seems to me like STK problem, because this exception does not happen if you either:

1) do not run jboss with derby config before changing repo to mysql;
2) do not install STK before changing repo to mysql;

in case (2), by the way, there are lot of "workspace invalid" exceptions, but everything looks like working:
1. unpack magnolia-4.0.1 to m.war (or whatever);
2. deploy m.war to JBOSS5_0_1_HOME/server/default/deploy;
3. start jboss;
4. run magnolia install/update routine (at localhost:8080/m), start up Magnolia;
5. stop jboss;
6. reconfigure magnolia to use mysql:
6.1. update config/default/magnolia.properties to use jackrabbit-bundle-mysql-search.xml;
6.2. update jackrabbit-bundle-mysql-search.xml to use local mysql 5 db;
6.3. delete repositories/magnolia;
6.4. add mysql-connector to jboss/server/default/lib);
7. create empty mysql database;
8. start jboss;
9. (A lot of exceptions here, but magnolia deploys successfully).

Additionally, it seems now that proposed workaround (replace JARs) does not work:
1. unpack magnolia-4.0.1 to m.war (or whatever);
2. deploy m.war to JBOSS5_0_1_HOME/server/default/deploy;
3. start jboss;
4. run magnolia install/update routine (at localhost:8080/m), start up Magnolia;
5. stop jboss;
6. reconfigure magnolia to use mysql:
6.1. update config/default/magnolia.properties to use jackrabbit-bundle-mysql-search.xml;
6.2. update jackrabbit-bundle-mysql-search.xml to use local mysql 5 db;
6.3. delete repositories/magnolia;
6.4. add mysql-connector to jboss/server/default/lib);
7. create empty mysql database;
8. replace WEB-INF/lib/jaxen-1.0-FCS.jar and WEB-INF/lib/jdom-1.0.jar with jdom.jar, jaxen-core.jar and jaxen-jdom.jar from JDOM1.0 distribution obtained from jdom.org
8. start jboss;
9. jboss hangs with 100% CPU load in process of deploying magnolia

Comment by Egor Kolesnikov [ 06/May/09 ]

full log file (wrong one has been attached initially)

Comment by Magnolia International [ 06/May/09 ]

Thanks.

From the stacktrace, I don't think it's related directly to stk.
If you have "workspace invalid" ... something else is wrong - can you attach those ?

Sounds to me like another instance of MAGNOLIA-2577. Could you list the contents of JBOSS5_0_1_HOME/lib and JBOSS5_0_1_HOME/lib/endorsed please ?

Comment by Egor Kolesnikov [ 06/May/09 ]

Checking JBoss classloaders was the first thing I've done Actually, there was jaxen.jar in lib/endorsed, but neither removing it nor replacing with magnolia's jaxen did not solve the problem.

At the moment, I've deployed both author and public instances by configuring mysql repository BEFORE first deployment of Magnolia.

I guess "workspace invalid" comes up because Magnolia tries to find some files in deleted repo. Will send you the stacktrace tomorrow, I'm out of the office now.

Comment by Philipp Bärfuss [ 07/May/09 ]

Side note: I have seen this exception several times I run magnolia directly in eclipse (tomcat).

Comment by Philipp Bärfuss [ 12/May/09 ]

Updating the dependencies to jdom 1.1 and jaxen 1.1.1 solves the issue but this is only an option for the new 4.1 release.

We could update the 4.0.1 jaxen dependency to the ones org.jdom provides.

    <dependency>
      <!-- This is a version of jaxen:jaxen:1.0-FCS patched by jdom, 
           which is provided in the jdom 1.0 distribution,
           and is NOT the same as jaxen:jaxen:1.0-FCS -->
      <groupId>org.jdom</groupId>
      <artifactId>jaxen-jdom</artifactId>
      <version>1.0-FCS</version>
    </dependency>
Comment by Philipp Bärfuss [ 12/May/09 ]

For Magnolia 4.1 the issue has been solved by MAGNOLIA-2727

Comment by Magnolia International [ 02/Jul/09 ]

Unfortunately, the org.jdom:jaxen-jdom:1.0-FCS jar only provides the 3 classes that have been patched for JDom 1.0. These classes are also present in the jaxen:jaxen:1.0-FCS jar.

Since, afaik, we can't enforce classpath order, the only way to solve this would be to either repackage jaxen ourselves (unless someone has done it? .. or to update to JDom 1.1 and Jaxen 1.1.1, which is what we did for Magnolia 4.1

As far as I can tell, we currently only need Jaxen for xpath in WebXmlUtil. Hopefully, if we do a 4.0.x release after 4.0.2, we'll have time to investigate and potentially fix this. In the meantime, one could update jdom/jaxen in case of issues, or add the jaxen-jdom jar and pray for the classloader to load it first.

Generated at Mon Feb 12 03:39:24 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.