exception: javax.xml.namespace.QName cannot be cast to class clojure.lang.Named
{:clojure.main/message
"Execution error (ClassCastException) at antq.upgrade.pom/target-dependency? (pom.clj:31).\nclass javax.xml.namespace.QName cannot be cast to class clojure.lang.Named (javax.xml.namespace.QName is in module java.xml of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')\n",
:clojure.main/triage
{:clojure.error/class java.lang.ClassCastException,
:clojure.error/line 31,
:clojure.error/cause
"class javax.xml.namespace.QName cannot be cast to class clojure.lang.Named (javax.xml.namespace.QName is in module java.xml of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')",
:clojure.error/symbol antq.upgrade.pom/target-dependency?,
:clojure.error/source "pom.clj",
:clojure.error/phase :execution},
:clojure.main/trace
{:via
[{:type java.lang.ClassCastException,
:message
"class javax.xml.namespace.QName cannot be cast to class clojure.lang.Named (javax.xml.namespace.QName is in module java.xml of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')",
:at [clojure.core$name invokeStatic "core.clj" 1610]}],
:trace
[[clojure.core$name invokeStatic "core.clj" 1610]
[clojure.core$name invoke "core.clj" 1604]
[antq.upgrade.pom$target_dependency_QMARK_
invokeStatic
"pom.clj"
31]
[antq.upgrade.pom$target_dependency_QMARK_ invoke "pom.clj" 24]
[antq.upgrade.pom$upgrade_dep invokeStatic "pom.clj" 85]
[antq.upgrade.pom$upgrade_dep invoke "pom.clj" 75]
[antq.upgrade.pom$eval18654$fn__18655 invoke "pom.clj" 122]
[clojure.lang.MultiFn invoke "MultiFn.java" 229]
[antq.upgrade$upgrade_BANG_$fn__15630 invoke "upgrade.clj" 73]
[clojure.core$group_by$fn__8627 invoke "core.clj" 7304]
[clojure.core.protocols$fn__8275 invokeStatic "protocols.clj" 167]
[clojure.core.protocols$fn__8275 invoke "protocols.clj" 123]
[clojure.core.protocols$fn__8229$G__8224__8238
invoke
"protocols.clj"
19]
[clojure.core.protocols$seq_reduce invokeStatic "protocols.clj" 31]
[clojure.core.protocols$fn__8262 invokeStatic "protocols.clj" 74]
[clojure.core.protocols$fn__8262 invoke "protocols.clj" 74]
[clojure.core.protocols$fn__8203$G__8198__8216
invoke
"protocols.clj"
13]
[clojure.core$reduce invokeStatic "core.clj" 6965]
[clojure.core$group_by invokeStatic "core.clj" 7294]
[clojure.core$group_by invoke "core.clj" 7294]
[antq.upgrade$upgrade_BANG_ invokeStatic "upgrade.clj" 70]
[antq.upgrade$upgrade_BANG_ invoke "upgrade.clj" 56]
[antq.core$main_STAR_ invokeStatic "core.clj" 355]
[antq.core$main_STAR_ invoke "core.clj" 334]
[antq.core$_main invokeStatic "core.clj" 375]
[antq.core$_main doInvoke "core.clj" 368]
[clojure.lang.RestFn applyTo "RestFn.java" 140]
[clojure.lang.Var applyTo "Var.java" 707]
[clojure.core$apply invokeStatic "core.clj" 667]
[clojure.main$main_opt invokeStatic "main.clj" 515]
[clojure.main$main_opt invoke "main.clj" 511]
[clojure.main$main invokeStatic "main.clj" 665]
[clojure.main$main doInvoke "main.clj" 617]
[clojure.lang.RestFn applyTo "RestFn.java" 140]
[clojure.lang.Var applyTo "Var.java" 707]
[clojure.main main "main.java" 40]],
:cause
"class javax.xml.namespace.QName cannot be cast to class clojure.lang.Named (javax.xml.namespace.QName is in module java.xml of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')"}}
@kirked Sorry for late response. Could you tell me steps to reproduce?
Sorry, yes using org.clojure/data.xml {:mvn/version "0.1.0-beta2"}. Newer versions don't behave well with certain namespacing behaviors (known issue), so this is the most stable version of data.xml.
Usage was just clojure -M:lint which invokes antq without any special configuration.
@kirked Thank you!
First, I checked using the following steps.
$ cat deps.edn
{:deps {org.clojure/data.xml {:mvn/version "0.1.0-beta2"}}}
$ clojure -Sdeps '{:deps {com.github.liquidz/antq {:mvn/version "RELEASE"}}}' -M -m antq.core
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[##################################################] 1/1
| :file | :name | :current | :latest |
|----------|----------------------|-------------|--------------|
| deps.edn | org.clojure/data.xml | 0.1.0-beta2 | 0.2.0-alpha9 |
Available changes:
- https://github.com/clojure/data.xml/blob/v0.2.0-alpha9/CHANGES.md
"Execution error (ClassCastException) at antq.upgrade.pom/target-dependency? (pom.clj:31).\nclass javax.xml.namespace.QName cannot be cast to class clojure.lang.Named (javax.xml.namespace.QName is in module java.xml of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')\n",
Next, since the error message seemed to suggest that dependencies in pom.xml were being upgraded, I also checked the following just in case, but was unable to reproduce the issue.
$ cat pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<groupId>com.github.liquidz</groupId>
<artifactId>example</artifactId>
<version>0.1.1</version>
<name>example</name>
<dependencies>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>data.xml</artifactId>
<version>0.1.0-beta2</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
</build>
<repositories>
<repository>
<id>clojars</id>
<url>https://repo.clojars.org/</url>
</repository>
</repositories>
</project>
$ clojure -Sdeps '{:deps {com.github.liquidz/antq {:mvn/version "RELEASE"}}}' -M -m antq.core --upgrade --force
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[##################################################] 1/1
| :file | :name | :current | :latest |
|---------|----------------------|-------------|--------------|
| pom.xml | org.clojure/data.xml | 0.1.0-beta2 | 0.2.0-alpha9 |
Available changes:
- https://github.com/clojure/data.xml/blob/v0.2.0-alpha9/CHANGES.md
Upgraded org.clojure/data.xml '0.1.0-beta2' to '0.2.0-alpha9' in pom.xml.
$ diff pom.xml.org pom.xml
13c13
< <version>0.1.0-beta2</version>
---
> <version>0.2.0-alpha9</version>
If possible, could you tell me the concrete steps to reproduce the problem?
I think most likely I used leiningen to publish/deploy a library, which created the pom.xml for the project. (This project currently requires lein to build, but we're in process of switching to tools.deps).
We don't usually keep those pom files around, so it was errant of me to say to upgrade it, but my normal command line for using antq is clojure -M:outdated --upgrade, where the :outdated alias points to antq as in the README. However, in this case it could also have been used as a leiningen plugin.
Aside: a nice enhancement might be to group/present potential upgrades by target file.