使用 Hibernate Validator 的代码单元测试失败,无法初始化 'javax.el.ExpressionFactory'
Unit test of code using Hibernate Validator fails with Unable to initialize 'javax.el.ExpressionFactory'
我正在尝试在 API 网关框架中使用 Hibernate Validator。代码最终 运行s 在 Karaf 中,但我试图首先进行单元测试(而不是 PAX 测试)。我将使用 Mockito 进行模拟,但我认为这还不是问题。
我正在使用 "hibernate-validator" 和 "hibernate-validator-annotation-processor",版本 5.4。1.Final。
当我 运行 测试时,我得到以下信息:
HV000183: Unable to initialize 'javax.el.ExpressionFactory'. Check that you have the EL dependencies on the classpath, or use ParameterMessageInterpolator instead
根据其他情况,我得出结论,我必须添加 "org.glassfish:javax.el:3.0.0"。不幸的是,这没有效果。完全相同的异常。
更新:
我看到的一些建议说要删除 "javax.el-api" 工件。我发现在一个 POM 中引用了这个,所以我把它注释掉了。我还注意到 "cdi-api" 工件似乎可以传递地拉入它,所以我也将其注释掉了。
不幸的是,"mvn dependency:tree" 仍然显示 "javax.el-api" 的 2.2.5 版本,以及 glassfish "javax.el" 神器的 3.0.0 版本。
我该如何克服这个问题?
更新:
我现在已经更新了我的依赖项,所以我只有 "javax.el",版本 3.0.1-b08,没有 "api" 变体,但我仍然遇到错误。
这是我当前的依赖关系树:
[INFO] mygroupid:usl-fraudcheck-impl:bundle:2.5.0-SNAPSHOT
[INFO] +- mygroupid:usl-csi-jaxb-base:jar:2.5.0-SNAPSHOT:compile
[INFO] | +- mygroupid:usl-shared:jar:2.5.0-SNAPSHOT:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.xmlbeans:jar:2.5.0_1:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.xstream:jar:1.4.9_1:compile
[INFO] | | | +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] | | | \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.xmlpull:jar:1.1.3.1_2:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.javax.mail:jar:1.4.1_5:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-httpclient:jar:3.1_7:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-codec:jar:1.3_5:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-io:jar:1.4_3:compile
[INFO] | | +- javax.ejb:javax.ejb-api:jar:3.2:compile
[INFO] | | +- javax.jms:javax.jms-api:jar:2.0:compile
[INFO] | | +- mygroupid.csi:csi88:jar:88.0:compile
[INFO] | | +- mygroupid.csi:csi213:jar:213.0:compile
[INFO] | | +- javax.xml.rpc:com.springsource.javax.xml.rpc:jar:1.1.0.v20110517:compile
[INFO] | | +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] | | +- javax.interceptor:javax.interceptor-api:jar:1.2:compile
[INFO] | | \- org.apache.servicemix.bundles:org.apache.servicemix.bundles.javax-inject:jar:1_2:compile
[INFO] | +- mygroupid:usl-base:jar:2.5.0-SNAPSHOT:compile
[INFO] | | +- org.apache.xmlbeans:xmlbeans:jar:2.4.0:compile
[INFO] | | | \- stax:stax-api:jar:1.0.1:compile
[INFO] | | +- org.apache.axis:axis:jar:1.4:compile
[INFO] | | +- org.apache.neethi:neethi:jar:3.0.0:compile
[INFO] | | | \- wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO] | | +- org.apache.woden:woden-api:jar:1.0M9:compile
[INFO] | | +- org.apache.commons:com.springsource.org.apache.commons.net:jar:1.4.1:compile
[INFO] | | +- org.apache.woden:woden-impl-dom:jar:1.0M9:compile
[INFO] | | +- org.apache.woden:woden-impl-commons:jar:1.0M9:compile
[INFO] | | +- org.apache.ws.commons.schema:XmlSchema:jar:1.4.7:compile
[INFO] | | +- org.apache.httpcomponents:httpcore-osgi:jar:4.4:compile
[INFO] | | | +- org.apache.httpcomponents:httpcore:jar:4.4:compile
[INFO] | | | \- org.apache.httpcomponents:httpcore-nio:jar:4.4:compile
[INFO] | | +- org.apache.httpcomponents:httpclient-osgi:jar:4.5.2:compile
[INFO] | | | +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] | | | +- commons-codec:commons-codec:jar:1.10:compile
[INFO] | | | +- org.apache.httpcomponents:httpmime:jar:4.5.2:compile
[INFO] | | | +- org.apache.httpcomponents:httpclient-cache:jar:4.5.2:compile
[INFO] | | | \- org.apache.httpcomponents:fluent-hc:jar:4.5.2:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.wsdl4j:jar:1.6.2_5:compile
[INFO] | | +- org.apache.ws.commons.axiom:axiom-api:jar:1.2.5:compile
[INFO] | | | +- javax.mail:mail:jar:1.4:compile
[INFO] | | | | \- javax.activation:activation:jar:1.1:compile
[INFO] | | | \- xml-apis:xml-apis:jar:1.4.01:test
[INFO] | | +- org.apache.axiom:com.springsource.org.apache.axiom:jar:1.2.5:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.axiom-impl:jar:1.2.13_1:compile
[INFO] | | | +- org.apache.james:apache-mime4j-core:jar:0.7.2:compile
[INFO] | | | +- org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.1:compile
[INFO] | | | +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
[INFO] | | | +- org.codehaus.woodstox:wstx-asl:jar:3.2.9:compile
[INFO] | | | \- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:compile
[INFO] | | +- org.apache.axis:com.springsource.org.apache.axis:jar:1.4.0:compile
[INFO] | | | \- org.apache.commons:com.springsource.org.apache.commons.httpclient:jar:3.1.0:compile
[INFO] | | | \- org.apache.commons:com.springsource.org.apache.commons.codec:jar:1.3.0:compile
[INFO] | | +- org.apache.commons:com.springsource.org.apache.commons.discovery:jar:0.4.0:compile
[INFO] | | +- org.apache.commons:com.springsource.org.apache.commons.logging:jar:1.1.1:compile
[INFO] | | +- javax.jms:com.springsource.javax.jms:jar:1.1.0:compile
[INFO] | | +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] | | \- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
[INFO] | +- mygroupid.csi:csi-app:jar:1.0:compile
[INFO] | +- mygroupid.csi:csi97:jar:97.0:compile
[INFO] | +- mygroupid.csi:csi104:jar:104.0:compile
[INFO] | +- mygroupid.csi:csi106:jar:106.0:compile
[INFO] | +- mygroupid.csi:csi112:jar:112.1:compile
[INFO] | +- mygroupid.csi:csi109:jar:109.0:compile
[INFO] | +- mygroupid.csi:csi217:jar:217.0:compile
[INFO] | +- mygroupid.csi:csi116:jar:116:compile
[INFO] | +- mygroupid.csi.icas:csi116:jar:200.0:compile
[INFO] | +- mygroupid.csi.unifiedservices:csi116:jar:212.0:compile
[INFO] | +- mygroupid.csi.paom:csi112:jar:205.0:compile
[INFO] | +- mygroupid.csi.oneviewaddresslocationsystem:csi116:jar:203.0:compile
[INFO] | +- mygroupid.csi.orderandsubscriptionmanagementmobility:csi116:jar:206.0:compile
[INFO] | +- mygroupid.csi:csi121:jar:121:compile
[INFO] | \- mygroupid.csi.unifiedservices:csi121:jar:216.0:compile
[INFO] +- mygroupid:usl-fraudcheck-api:jar:2.5.0-SNAPSHOT:compile
[INFO] | \- mygroupid:usl-metrics:jar:2.5.0-SNAPSHOT:compile
[INFO] | +- mygroupid.oracle:ojdbc6:jar:11.2.0.3.0:compile
[INFO] | +- mygroupid.oracle:oracle.jdbc.OracleDriver:jar:12.1.0.1:compile
[INFO] | +- com.zaxxer:HikariCP:jar:2.6.1:compile
[INFO] | \- org.javassist:javassist:jar:3.18.2-GA:compile
[INFO] +- mygroupid.xmlsoap:xmlsoap:jar:11.0:compile
[INFO] +- mygroupid:usl-csi-jaxb-base:test-jar:tests:2.5.0-SNAPSHOT:test
[INFO] +- commons-beanutils:commons-beanutils:jar:1.9.3:compile
[INFO] +- org.hibernate:hibernate-validator:jar:5.4.1.Final:compile
[INFO] | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | \- com.fasterxml:classmate:jar:1.3.1:compile
[INFO] +- org.hibernate:hibernate-validator-annotation-processor:jar:5.4.1.Final:compile
[INFO] +- org.glassfish:javax.el:jar:3.0.1-b08:compile
[INFO] +- log4j:log4j:jar:1.2.16:provided
[INFO] +- org.codehaus.mojo:cobertura-maven-plugin:jar:2.6:compile
[INFO] | +- net.sourceforge.cobertura:cobertura:jar:2.0.3:compile
[INFO] | | +- org.ow2.asm:asm:jar:4.1:compile
[INFO] | | +- org.ow2.asm:asm-tree:jar:4.1:compile
[INFO] | | +- org.ow2.asm:asm-commons:jar:4.1:compile
[INFO] | | +- org.ow2.asm:asm-util:jar:4.1:compile
[INFO] | | +- org.ow2.asm:asm-analysis:jar:4.1:compile
[INFO] | | +- oro:oro:jar:2.0.8:compile
[INFO] | | +- jaxen:jaxen:jar:1.1-beta-8:compile
[INFO] | | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | | +- jdom:jdom:jar:1.0:compile
[INFO] | | | +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] | | | +- xerces:xercesImpl:jar:2.11.0:test
[INFO] | | | \- xom:xom:jar:1.0b3:compile
[INFO] | | | +- com.ibm.icu:icu4j:jar:2.6.1:compile
[INFO] | | | +- xalan:xalan:jar:2.7.2:compile
[INFO] | | | | \- xalan:serializer:jar:2.7.2:compile
[INFO] | | | \- org.ccil.cowan.tagsoup:tagsoup:jar:0.9.7:compile
[INFO] | | +- org.apache.ant:ant:jar:1.8.3:compile
[INFO] | | | \- org.apache.ant:ant-launcher:jar:1.8.3:compile
[INFO] | | +- org.mortbay.jetty:servlet-api-2.5:jar:6.1.14:compile
[INFO] | | +- org.mortbay.jetty:jetty:jar:6.1.14:compile
[INFO] | | +- org.mortbay.jetty:jetty-util:jar:6.1.14:compile
[INFO] | | \- com.sun:tools:jar:0:system
[INFO] | +- net.sourceforge.cobertura:cobertura-runtime:pom:2.0.3:compile
[INFO] | +- urbanophile:java-getopt:jar:1.0.9:compile
[INFO] | +- org.apache.maven:maven-core:jar:2.0.8:compile
[INFO] | | +- org.apache.maven:maven-settings:jar:2.0.8:compile
[INFO] | | +- org.apache.maven.wagon:wagon-file:jar:1.0-beta-2:runtime
[INFO] | | +- org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.8:compile
[INFO] | | +- org.apache.maven.wagon:wagon-http-lightweight:jar:1.0-beta-2:runtime
[INFO] | | | \- org.apache.maven.wagon:wagon-http-shared:jar:1.0-beta-2:runtime
[INFO] | | | \- jtidy:jtidy:jar:4aug2000r7-dev:runtime
[INFO] | | +- org.apache.maven:maven-profile:jar:2.0.8:compile
[INFO] | | +- org.apache.maven:maven-model:jar:2.0.8:compile
[INFO] | | +- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
[INFO] | | +- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[INFO] | | +- org.apache.maven:maven-repository-metadata:jar:2.0.8:compile
[INFO] | | +- org.apache.maven:maven-error-diagnostics:jar:2.0.8:compile
[INFO] | | +- commons-cli:commons-cli:jar:1.0:compile
[INFO] | | +- org.apache.maven.wagon:wagon-ssh-external:jar:1.0-beta-2:runtime
[INFO] | | | \- org.apache.maven.wagon:wagon-ssh-common:jar:1.0-beta-2:runtime
[INFO] | | +- org.apache.maven:maven-plugin-descriptor:jar:2.0.8:compile
[INFO] | | +- org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4:compile
[INFO] | | +- org.apache.maven:maven-artifact-manager:jar:2.0.8:compile
[INFO] | | +- org.apache.maven:maven-monitor:jar:2.0.8:compile
[INFO] | | +- org.apache.maven.wagon:wagon-ssh:jar:1.0-beta-2:runtime
[INFO] | | | \- com.jcraft:jsch:jar:0.1.27:runtime
[INFO] | | \- classworlds:classworlds:jar:1.1:compile
[INFO] | +- org.apache.maven:maven-artifact:jar:2.0.8:compile
[INFO] | +- org.apache.maven:maven-plugin-api:jar:2.0.8:compile
[INFO] | +- org.apache.maven.reporting:maven-reporting-api:jar:2.0.8:compile
[INFO] | | \- org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-9:compile
[INFO] | +- org.apache.maven:maven-project:jar:2.0.8:compile
[INFO] | | \- org.apache.maven:maven-plugin-registry:jar:2.0.8:compile
[INFO] | +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4.2:compile
[INFO] | | +- commons-validator:commons-validator:jar:1.2.0:compile
[INFO] | | | \- commons-digester:commons-digester:jar:1.6:compile
[INFO] | | +- org.apache.maven.doxia:doxia-core:jar:1.0:compile
[INFO] | | \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0:compile
[INFO] | | +- org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7:compile
[INFO] | | +- org.codehaus.plexus:plexus-velocity:jar:1.1.7:compile
[INFO] | | +- org.apache.velocity:velocity:jar:1.5:compile
[INFO] | | +- org.apache.maven.doxia:doxia-decoration-model:jar:1.0:compile
[INFO] | | +- org.apache.maven.doxia:doxia-module-apt:jar:1.0:compile
[INFO] | | +- org.apache.maven.doxia:doxia-module-fml:jar:1.0:compile
[INFO] | | +- org.apache.maven.doxia:doxia-module-xdoc:jar:1.0:compile
[INFO] | | \- org.apache.maven.doxia:doxia-module-xhtml:jar:1.0:compile
[INFO] | +- org.codehaus.plexus:plexus-utils:jar:2.0.2:compile
[INFO] | \- org.apache.maven.shared:maven-invoker:jar:2.0.11:compile
[INFO] +- org.osgi:org.osgi.core:jar:5.0.0:provided
[INFO] +- org.osgi:org.osgi.compendium:jar:5.0.0:provided
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | \- org.objenesis:objenesis:jar:2.1:test
[INFO] +- org.powermock:powermock-module-junit4:jar:1.6.6:test
[INFO] | \- org.powermock:powermock-module-junit4-common:jar:1.6.6:test
[INFO] | +- org.powermock:powermock-core:jar:1.6.6:test
[INFO] | \- org.powermock:powermock-reflect:jar:1.6.6:test
[INFO] +- org.powermock:powermock-api-mockito:jar:1.6.6:test
[INFO] | \- org.powermock:powermock-api-mockito-common:jar:1.6.6:test
[INFO] | \- org.powermock:powermock-api-support:jar:1.6.6:test
[INFO] +- org.slf4j:slf4j-api:jar:1.7.21:provided
[INFO] +- org.apache.aries.blueprint:org.apache.aries.blueprint.annotation.api:jar:1.0.0:provided
[INFO] +- org.ops4j.pax.exam:pax-exam-junit4:jar:4.9.1:test
[INFO] | +- org.ops4j.pax.exam:pax-exam-spi:jar:4.9.1:test
[INFO] | | \- org.ops4j.pax.tinybundles:tinybundles:jar:2.1.1:test
[INFO] | | \- biz.aQute.bnd:bndlib:jar:2.4.0:test
[INFO] | \- org.ops4j.base:ops4j-base-lang:jar:1.5.0:test
[INFO] +- org.ops4j.pax.exam:pax-exam-container-karaf:jar:4.9.1:test
[INFO] | +- org.ops4j.pax.exam:pax-exam-container-remote:jar:4.9.1:test
[INFO] | | +- org.ops4j.pax.exam:pax-exam-container-rbc-client:jar:4.9.1:test
[INFO] | | | \- org.ops4j.pax.exam:pax-exam-container-rbc:jar:4.9.1:test
[INFO] | | +- org.ops4j.pax.swissbox:pax-swissbox-core:jar:1.8.2:test
[INFO] | | | \- org.ops4j.pax.swissbox:pax-swissbox-lifecycle:jar:1.8.2:test
[INFO] | | \- org.ops4j.base:ops4j-base-net:jar:1.5.0:test
[INFO] | +- org.apache.commons:commons-compress:jar:1.4.1:test
[INFO] | | \- org.tukaani:xz:jar:1.0:test
[INFO] | +- org.ops4j.pax.swissbox:pax-swissbox-framework:jar:1.8.2:test
[INFO] | | +- org.ops4j.pax.swissbox:pax-swissbox-tracker:jar:1.8.2:test
[INFO] | | +- org.ops4j.base:ops4j-base-exec:jar:1.5.0:test
[INFO] | | +- org.ops4j.base:ops4j-base-io:jar:1.5.0:test
[INFO] | | \- org.ops4j.base:ops4j-base-monitors:jar:1.5.0:test
[INFO] | \- org.ops4j.base:ops4j-base-spi:jar:1.5.0:test
[INFO] +- org.apache.karaf:apache-karaf:zip:4.0.7:compile
[INFO] | +- org.apache.karaf.features:framework:kar:4.0.7:compile
[INFO] | | +- org.apache.karaf.features:base:jar:4.0.7:runtime
[INFO] | | +- org.apache.karaf:org.apache.karaf.main:jar:4.0.7:runtime
[INFO] | | | +- org.apache.karaf:org.apache.karaf.util:jar:4.0.7:runtime
[INFO] | | | | \- org.apache.felix:org.apache.felix.utils:jar:1.8.2:runtime
[INFO] | | | +- net.java.dev.jna:jna:jar:4.2.2:runtime
[INFO] | | | \- net.java.dev.jna:jna-platform:jar:4.2.2:runtime
[INFO] | | +- org.apache.karaf:org.apache.karaf.exception:jar:4.0.7:runtime
[INFO] | | +- org.apache.karaf:org.apache.karaf.client:jar:4.0.7:runtime
[INFO] | | | \- org.apache.sshd:sshd-core:jar:0.14.0:runtime
[INFO] | | +- org.apache.karaf.jaas:org.apache.karaf.jaas.boot:jar:4.0.7:runtime
[INFO] | | +- org.apache.karaf.diagnostic:org.apache.karaf.diagnostic.boot:jar:4.0.7:runtime
[INFO] | | +- org.eclipse.tycho:org.eclipse.osgi:jar:3.10.101.v20150820-1432:runtime
[INFO] | | +- org.apache.felix:org.apache.felix.framework:jar:5.4.0:runtime
[INFO] | | +- jline:jline:jar:2.14.2:compile
[INFO] | | +- org.jledit:core:jar:0.2.1:compile
[INFO] | | +- org.ops4j.pax.logging:pax-logging-api:jar:1.8.5:compile
[INFO] | | +- org.ops4j.pax.logging:pax-logging-service:jar:1.8.5:compile
[INFO] | | +- org.ops4j.pax.url:pax-url-aether:jar:2.4.7:compile
[INFO] | | \- org.apache.karaf.features:org.apache.karaf.features.core:jar:4.0.7:compile
[INFO] | +- org.apache.karaf.features:framework:xml:features:4.0.7:runtime
[INFO] | +- org.apache.karaf.features:standard:xml:features:4.0.7:compile
[INFO] | +- org.apache.karaf.features:spring:xml:features:4.0.7:runtime
[INFO] | \- org.apache.karaf.features:enterprise:xml:features:4.0.7:runtime
[INFO] +- org.ops4j.pax.exam:pax-exam:jar:4.9.1:test
[INFO] | +- org.ops4j.base:ops4j-base-store:jar:1.5.0:test
[INFO] | \- org.ops4j.base:ops4j-base-util-property:jar:1.5.0:test
[INFO] +- org.apache.camel:camel-core:jar:2.17.0:provided
[INFO] | +- com.sun.xml.bind:jaxb-core:jar:2.2.11:provided
[INFO] | \- com.sun.xml.bind:jaxb-impl:jar:2.2.11:provided
[INFO] +- org.apache.camel:camel-blueprint:jar:2.17.0:provided
[INFO] | +- org.apache.camel:camel-core-xml:jar:2.17.0:provided
[INFO] | \- org.apache.camel:camel-core-osgi:jar:2.17.0:provided
[INFO] +- org.apache.camel:camel-jms:jar:2.17.0:provided
[INFO] | +- org.apache.camel:camel-spring:jar:2.17.0:provided
[INFO] | | +- org.springframework:spring-core:jar:4.2.5.RELEASE:provided
[INFO] | | +- org.springframework:spring-aop:jar:4.2.5.RELEASE:provided
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:provided
[INFO] | | \- org.springframework:spring-expression:jar:4.2.5.RELEASE:provided
[INFO] | +- org.springframework:spring-jms:jar:4.2.5.RELEASE:provided
[INFO] | | \- org.springframework:spring-messaging:jar:4.2.5.RELEASE:provided
[INFO] | +- org.springframework:spring-context:jar:4.2.5.RELEASE:provided
[INFO] | +- org.springframework:spring-tx:jar:4.2.5.RELEASE:provided
[INFO] | \- org.springframework:spring-beans:jar:4.2.5.RELEASE:provided
[INFO] +- org.apache.camel:camel-jaxb:jar:2.17.0:provided
[INFO] +- org.apache.camel:camel-test:jar:2.17.0:test
[INFO] +- commons-logging:commons-logging:jar:1.2:provided
[INFO] +- commons-lang:commons-lang:jar:2.6:provided
[INFO] +- commons-io:commons-io:jar:2.4:provided
[INFO] +- org.apache.camel:camel-test-blueprint:jar:2.13.0:test
[INFO] | +- org.apache.aries.blueprint:org.apache.aries.blueprint:jar:1.1.0:test
[INFO] | +- org.apache.aries:org.apache.aries.util:jar:1.1.0:test
[INFO] | +- org.apache.aries.proxy:org.apache.aries.proxy.impl:jar:1.0.1:test
[INFO] | +- org.apache.aries.proxy:org.apache.aries.proxy.api:jar:1.0.0:test
[INFO] | +- com.googlecode.pojosr:de.kalpatec.pojosr.framework:jar:0.2.1:test
[INFO] | +- org.ops4j.pax.swissbox:pax-swissbox-tinybundles:jar:1.3.1:test
[INFO] | | \- org.ops4j.pax.swissbox:pax-swissbox-bnd:jar:1.3.1:test
[INFO] | | \- biz.aQute:bndlib:jar:0.0.357:test
[INFO] | +- org.apache.felix:org.apache.felix.configadmin:jar:1.4.0:compile
[INFO] | \- org.apache.felix:org.apache.felix.fileinstall:jar:3.2.6:compile
[INFO] +- org.apache.camel:camel-jackson:jar:2.17.0:provided
[INFO] | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.7.2:provided
[INFO] +- org.apache.camel:camel-jsonpath:jar:2.17.0:provided
[INFO] +- org.apache.camel:camel-jolt:jar:2.17.0:provided
[INFO] +- org.apache.camel:camel-quartz2:jar:2.17.0:provided
[INFO] | +- org.quartz-scheduler:quartz:jar:2.2.2:provided
[INFO] | | \- c3p0:c3p0:jar:0.9.1.1:provided
[INFO] | \- com.mchange:c3p0:jar:0.9.5.2:provided
[INFO] | \- com.mchange:mchange-commons-java:jar:0.2.11:provided
[INFO] +- org.apache.camel:camel-hazelcast:jar:2.17.0:provided
[INFO] | +- com.hazelcast:hazelcast:jar:3.6.2:provided
[INFO] | \- com.hazelcast:hazelcast-client:jar:3.6.2:provided
[INFO] +- com.jayway.jsonpath:json-path:jar:2.0.0:provided
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.3:provided
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.8.3:provided
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.3:provided
[INFO] +- com.bazaarvoice.jolt:jolt-core:jar:0.0.16:provided
[INFO] | \- javax.inject:javax.inject:jar:1:provided
[INFO] +- com.bazaarvoice.jolt:json-utils:jar:0.0.16:provided
[INFO] +- net.minidev:json-smart:jar:2.1.1:provided
[INFO] +- net.minidev:asm:jar:1.0.2:provided
[INFO] | \- asm:asm:jar:3.3.1:provided
[INFO] +- com.google.code.gson:gson:jar:2.8.0:provided
[INFO] +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] +- org.apache.maven.surefire:surefire-junit4:jar:2.19.1:test
[INFO] | \- org.apache.maven.surefire:surefire-api:jar:2.19.1:test
[INFO] +- org.apache.cxf:cxf-core:jar:3.1.8:provided
[INFO] | +- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] | | \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] | \- org.apache.ws.xmlschema:xmlschema-core:jar:2.2.1:compile
[INFO] +- org.apache.cxf:cxf-rt-rs-client:jar:3.1.8:provided
[INFO] | +- org.apache.cxf:cxf-rt-transports-http:jar:3.1.8:provided
[INFO] | \- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:3.1.8:provided
[INFO] | \- javax.annotation:javax.annotation-api:jar:1.2:provided
[INFO] +- org.jacoco:org.jacoco.agent:jar:runtime:0.7.8:test
[INFO] \- org.eclipse.jdt:org.eclipse.jdt.annotation:jar:2.1.0:compile
以下是模块中 "mvn install" 的输出的摘录,当它 运行 进行单元测试时:
Running package.usl.fraudcheck.impl.InquireCPNIContactInformationProcessorTest
[org.jboss.logging] : Logging Provider: org.jboss.logging.Log4j2LoggerProvider Ignored FQCN: org.jboss.logging.Logger
[org.hibernate.validator.internal.util.Version] : HV000001: Hibernate Validator 5.4.1.Final Ignored FQCN: org.hibernate.validator.internal.util.logging.Log_$logger
[org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver] : Cannot find javax.persistence.Persistence on classpath. Assuming non JPA 2 environment. All properties will per default be traversable. Ignored FQCN: org.jboss.logging.DelegatingBasicLogger
[org.hibernate.validator.internal.xml.ValidationXmlParser] : Trying to load META-INF/validation.xml for XML based Validator configuration. Ignored FQCN: org.jboss.logging.DelegatingBasicLogger
[org.hibernate.validator.internal.xml.ResourceLoaderHelper] : Trying to load META-INF/validation.xml via TCCL Ignored FQCN: org.jboss.logging.DelegatingBasicLogger
[org.hibernate.validator.internal.xml.ResourceLoaderHelper] : Trying to load META-INF/validation.xml via Hibernate Validator's class loader Ignored FQCN: org.jboss.logging.DelegatingBasicLogger
[org.hibernate.validator.internal.xml.ValidationXmlParser] : No META-INF/validation.xml found. Using annotation based configuration only. Ignored FQCN: org.jboss.logging.DelegatingBasicLogger
Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.67 sec <<< FAILURE! - in package.usl.fraudcheck.impl.InquireCPNIContactInformationProcessorTest
testValidate(package.usl.fraudcheck.impl.InquireCPNIContactInformationProcessorTest) Time elapsed: 0.219 sec <<< ERROR!
javax.validation.ValidationException: HV000183: Unable to initialize 'javax.el.ExpressionFactory'. Check that you have the EL dependencies on the classpath, or use ParameterMessageInterpolator instead
at package.usl.fraudcheck.impl.InquireCPNIContactInformationProcessorTest.testValidate(InquireCPNIContactInformationProcessorTest.java:23)
Caused by: java.lang.NoClassDefFoundError: javax/el/ExpressionFactory
at package.usl.fraudcheck.impl.InquireCPNIContactInformationProcessorTest.testValidate(InquireCPNIContactInformationProcessorTest.java:23)
所以,您真的只需要一个版本的 el jar。它应该是:
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
<version>3.0.1-b08</version>
</dependency>
至于其他 el jar,您需要将它们从您的依赖项中排除。依赖关系树应该可以帮助您,因为您可以看到它们的来源。
只需对传递旧 el jar 的依赖项使用排除,并确保您没有在 poms 中明确引用它,它应该可以工作。
如错误消息所述,另一种解决方案是使用不使用 EL 的消息插值器,但我不推荐它,因为某些内置约束在其消息中使用 EL,您可能需要它你自己的约束。
即使在向 org.glassfish:javax.el:3.0.1-b08
添加依赖项后,我也遇到了同样的错误。问题原来是传递依赖项被引入,其中包括 javax.el.ExpressionFactory
但没有实现。
下面的命令会输出所有包含javax.el.ExpressionFactory
的依赖
for i in $(mvn dependency:build-classpath | grep '.m2' | tr ':' ' '); do
jar -tvf $i | grep 'javax/el/ExpressionFactory' && echo -e "\t$i"
done 2> /dev/null
然后我在 pom.xml 中使用 <exclusions>
删除不匹配 org.glassfish:javax.el:3.0.1-b08
的罐子。
排除项 可能 最终也会删除所需的排除 Jar 中的代码。就我而言,我必须找到一个提供嵌入式 Jetty 服务器的替代 jar。
我正在尝试在 API 网关框架中使用 Hibernate Validator。代码最终 运行s 在 Karaf 中,但我试图首先进行单元测试(而不是 PAX 测试)。我将使用 Mockito 进行模拟,但我认为这还不是问题。
我正在使用 "hibernate-validator" 和 "hibernate-validator-annotation-processor",版本 5.4。1.Final。
当我 运行 测试时,我得到以下信息:
HV000183: Unable to initialize 'javax.el.ExpressionFactory'. Check that you have the EL dependencies on the classpath, or use ParameterMessageInterpolator instead
根据其他情况,我得出结论,我必须添加 "org.glassfish:javax.el:3.0.0"。不幸的是,这没有效果。完全相同的异常。
更新:
我看到的一些建议说要删除 "javax.el-api" 工件。我发现在一个 POM 中引用了这个,所以我把它注释掉了。我还注意到 "cdi-api" 工件似乎可以传递地拉入它,所以我也将其注释掉了。
不幸的是,"mvn dependency:tree" 仍然显示 "javax.el-api" 的 2.2.5 版本,以及 glassfish "javax.el" 神器的 3.0.0 版本。
我该如何克服这个问题?
更新:
我现在已经更新了我的依赖项,所以我只有 "javax.el",版本 3.0.1-b08,没有 "api" 变体,但我仍然遇到错误。
这是我当前的依赖关系树:
[INFO] mygroupid:usl-fraudcheck-impl:bundle:2.5.0-SNAPSHOT
[INFO] +- mygroupid:usl-csi-jaxb-base:jar:2.5.0-SNAPSHOT:compile
[INFO] | +- mygroupid:usl-shared:jar:2.5.0-SNAPSHOT:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.xmlbeans:jar:2.5.0_1:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.xstream:jar:1.4.9_1:compile
[INFO] | | | +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] | | | \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.xmlpull:jar:1.1.3.1_2:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.javax.mail:jar:1.4.1_5:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-httpclient:jar:3.1_7:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-codec:jar:1.3_5:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-io:jar:1.4_3:compile
[INFO] | | +- javax.ejb:javax.ejb-api:jar:3.2:compile
[INFO] | | +- javax.jms:javax.jms-api:jar:2.0:compile
[INFO] | | +- mygroupid.csi:csi88:jar:88.0:compile
[INFO] | | +- mygroupid.csi:csi213:jar:213.0:compile
[INFO] | | +- javax.xml.rpc:com.springsource.javax.xml.rpc:jar:1.1.0.v20110517:compile
[INFO] | | +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] | | +- javax.interceptor:javax.interceptor-api:jar:1.2:compile
[INFO] | | \- org.apache.servicemix.bundles:org.apache.servicemix.bundles.javax-inject:jar:1_2:compile
[INFO] | +- mygroupid:usl-base:jar:2.5.0-SNAPSHOT:compile
[INFO] | | +- org.apache.xmlbeans:xmlbeans:jar:2.4.0:compile
[INFO] | | | \- stax:stax-api:jar:1.0.1:compile
[INFO] | | +- org.apache.axis:axis:jar:1.4:compile
[INFO] | | +- org.apache.neethi:neethi:jar:3.0.0:compile
[INFO] | | | \- wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO] | | +- org.apache.woden:woden-api:jar:1.0M9:compile
[INFO] | | +- org.apache.commons:com.springsource.org.apache.commons.net:jar:1.4.1:compile
[INFO] | | +- org.apache.woden:woden-impl-dom:jar:1.0M9:compile
[INFO] | | +- org.apache.woden:woden-impl-commons:jar:1.0M9:compile
[INFO] | | +- org.apache.ws.commons.schema:XmlSchema:jar:1.4.7:compile
[INFO] | | +- org.apache.httpcomponents:httpcore-osgi:jar:4.4:compile
[INFO] | | | +- org.apache.httpcomponents:httpcore:jar:4.4:compile
[INFO] | | | \- org.apache.httpcomponents:httpcore-nio:jar:4.4:compile
[INFO] | | +- org.apache.httpcomponents:httpclient-osgi:jar:4.5.2:compile
[INFO] | | | +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] | | | +- commons-codec:commons-codec:jar:1.10:compile
[INFO] | | | +- org.apache.httpcomponents:httpmime:jar:4.5.2:compile
[INFO] | | | +- org.apache.httpcomponents:httpclient-cache:jar:4.5.2:compile
[INFO] | | | \- org.apache.httpcomponents:fluent-hc:jar:4.5.2:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.wsdl4j:jar:1.6.2_5:compile
[INFO] | | +- org.apache.ws.commons.axiom:axiom-api:jar:1.2.5:compile
[INFO] | | | +- javax.mail:mail:jar:1.4:compile
[INFO] | | | | \- javax.activation:activation:jar:1.1:compile
[INFO] | | | \- xml-apis:xml-apis:jar:1.4.01:test
[INFO] | | +- org.apache.axiom:com.springsource.org.apache.axiom:jar:1.2.5:compile
[INFO] | | +- org.apache.servicemix.bundles:org.apache.servicemix.bundles.axiom-impl:jar:1.2.13_1:compile
[INFO] | | | +- org.apache.james:apache-mime4j-core:jar:0.7.2:compile
[INFO] | | | +- org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.1:compile
[INFO] | | | +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
[INFO] | | | +- org.codehaus.woodstox:wstx-asl:jar:3.2.9:compile
[INFO] | | | \- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:compile
[INFO] | | +- org.apache.axis:com.springsource.org.apache.axis:jar:1.4.0:compile
[INFO] | | | \- org.apache.commons:com.springsource.org.apache.commons.httpclient:jar:3.1.0:compile
[INFO] | | | \- org.apache.commons:com.springsource.org.apache.commons.codec:jar:1.3.0:compile
[INFO] | | +- org.apache.commons:com.springsource.org.apache.commons.discovery:jar:0.4.0:compile
[INFO] | | +- org.apache.commons:com.springsource.org.apache.commons.logging:jar:1.1.1:compile
[INFO] | | +- javax.jms:com.springsource.javax.jms:jar:1.1.0:compile
[INFO] | | +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] | | \- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
[INFO] | +- mygroupid.csi:csi-app:jar:1.0:compile
[INFO] | +- mygroupid.csi:csi97:jar:97.0:compile
[INFO] | +- mygroupid.csi:csi104:jar:104.0:compile
[INFO] | +- mygroupid.csi:csi106:jar:106.0:compile
[INFO] | +- mygroupid.csi:csi112:jar:112.1:compile
[INFO] | +- mygroupid.csi:csi109:jar:109.0:compile
[INFO] | +- mygroupid.csi:csi217:jar:217.0:compile
[INFO] | +- mygroupid.csi:csi116:jar:116:compile
[INFO] | +- mygroupid.csi.icas:csi116:jar:200.0:compile
[INFO] | +- mygroupid.csi.unifiedservices:csi116:jar:212.0:compile
[INFO] | +- mygroupid.csi.paom:csi112:jar:205.0:compile
[INFO] | +- mygroupid.csi.oneviewaddresslocationsystem:csi116:jar:203.0:compile
[INFO] | +- mygroupid.csi.orderandsubscriptionmanagementmobility:csi116:jar:206.0:compile
[INFO] | +- mygroupid.csi:csi121:jar:121:compile
[INFO] | \- mygroupid.csi.unifiedservices:csi121:jar:216.0:compile
[INFO] +- mygroupid:usl-fraudcheck-api:jar:2.5.0-SNAPSHOT:compile
[INFO] | \- mygroupid:usl-metrics:jar:2.5.0-SNAPSHOT:compile
[INFO] | +- mygroupid.oracle:ojdbc6:jar:11.2.0.3.0:compile
[INFO] | +- mygroupid.oracle:oracle.jdbc.OracleDriver:jar:12.1.0.1:compile
[INFO] | +- com.zaxxer:HikariCP:jar:2.6.1:compile
[INFO] | \- org.javassist:javassist:jar:3.18.2-GA:compile
[INFO] +- mygroupid.xmlsoap:xmlsoap:jar:11.0:compile
[INFO] +- mygroupid:usl-csi-jaxb-base:test-jar:tests:2.5.0-SNAPSHOT:test
[INFO] +- commons-beanutils:commons-beanutils:jar:1.9.3:compile
[INFO] +- org.hibernate:hibernate-validator:jar:5.4.1.Final:compile
[INFO] | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | \- com.fasterxml:classmate:jar:1.3.1:compile
[INFO] +- org.hibernate:hibernate-validator-annotation-processor:jar:5.4.1.Final:compile
[INFO] +- org.glassfish:javax.el:jar:3.0.1-b08:compile
[INFO] +- log4j:log4j:jar:1.2.16:provided
[INFO] +- org.codehaus.mojo:cobertura-maven-plugin:jar:2.6:compile
[INFO] | +- net.sourceforge.cobertura:cobertura:jar:2.0.3:compile
[INFO] | | +- org.ow2.asm:asm:jar:4.1:compile
[INFO] | | +- org.ow2.asm:asm-tree:jar:4.1:compile
[INFO] | | +- org.ow2.asm:asm-commons:jar:4.1:compile
[INFO] | | +- org.ow2.asm:asm-util:jar:4.1:compile
[INFO] | | +- org.ow2.asm:asm-analysis:jar:4.1:compile
[INFO] | | +- oro:oro:jar:2.0.8:compile
[INFO] | | +- jaxen:jaxen:jar:1.1-beta-8:compile
[INFO] | | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | | +- jdom:jdom:jar:1.0:compile
[INFO] | | | +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] | | | +- xerces:xercesImpl:jar:2.11.0:test
[INFO] | | | \- xom:xom:jar:1.0b3:compile
[INFO] | | | +- com.ibm.icu:icu4j:jar:2.6.1:compile
[INFO] | | | +- xalan:xalan:jar:2.7.2:compile
[INFO] | | | | \- xalan:serializer:jar:2.7.2:compile
[INFO] | | | \- org.ccil.cowan.tagsoup:tagsoup:jar:0.9.7:compile
[INFO] | | +- org.apache.ant:ant:jar:1.8.3:compile
[INFO] | | | \- org.apache.ant:ant-launcher:jar:1.8.3:compile
[INFO] | | +- org.mortbay.jetty:servlet-api-2.5:jar:6.1.14:compile
[INFO] | | +- org.mortbay.jetty:jetty:jar:6.1.14:compile
[INFO] | | +- org.mortbay.jetty:jetty-util:jar:6.1.14:compile
[INFO] | | \- com.sun:tools:jar:0:system
[INFO] | +- net.sourceforge.cobertura:cobertura-runtime:pom:2.0.3:compile
[INFO] | +- urbanophile:java-getopt:jar:1.0.9:compile
[INFO] | +- org.apache.maven:maven-core:jar:2.0.8:compile
[INFO] | | +- org.apache.maven:maven-settings:jar:2.0.8:compile
[INFO] | | +- org.apache.maven.wagon:wagon-file:jar:1.0-beta-2:runtime
[INFO] | | +- org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.8:compile
[INFO] | | +- org.apache.maven.wagon:wagon-http-lightweight:jar:1.0-beta-2:runtime
[INFO] | | | \- org.apache.maven.wagon:wagon-http-shared:jar:1.0-beta-2:runtime
[INFO] | | | \- jtidy:jtidy:jar:4aug2000r7-dev:runtime
[INFO] | | +- org.apache.maven:maven-profile:jar:2.0.8:compile
[INFO] | | +- org.apache.maven:maven-model:jar:2.0.8:compile
[INFO] | | +- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
[INFO] | | +- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[INFO] | | +- org.apache.maven:maven-repository-metadata:jar:2.0.8:compile
[INFO] | | +- org.apache.maven:maven-error-diagnostics:jar:2.0.8:compile
[INFO] | | +- commons-cli:commons-cli:jar:1.0:compile
[INFO] | | +- org.apache.maven.wagon:wagon-ssh-external:jar:1.0-beta-2:runtime
[INFO] | | | \- org.apache.maven.wagon:wagon-ssh-common:jar:1.0-beta-2:runtime
[INFO] | | +- org.apache.maven:maven-plugin-descriptor:jar:2.0.8:compile
[INFO] | | +- org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4:compile
[INFO] | | +- org.apache.maven:maven-artifact-manager:jar:2.0.8:compile
[INFO] | | +- org.apache.maven:maven-monitor:jar:2.0.8:compile
[INFO] | | +- org.apache.maven.wagon:wagon-ssh:jar:1.0-beta-2:runtime
[INFO] | | | \- com.jcraft:jsch:jar:0.1.27:runtime
[INFO] | | \- classworlds:classworlds:jar:1.1:compile
[INFO] | +- org.apache.maven:maven-artifact:jar:2.0.8:compile
[INFO] | +- org.apache.maven:maven-plugin-api:jar:2.0.8:compile
[INFO] | +- org.apache.maven.reporting:maven-reporting-api:jar:2.0.8:compile
[INFO] | | \- org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-9:compile
[INFO] | +- org.apache.maven:maven-project:jar:2.0.8:compile
[INFO] | | \- org.apache.maven:maven-plugin-registry:jar:2.0.8:compile
[INFO] | +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4.2:compile
[INFO] | | +- commons-validator:commons-validator:jar:1.2.0:compile
[INFO] | | | \- commons-digester:commons-digester:jar:1.6:compile
[INFO] | | +- org.apache.maven.doxia:doxia-core:jar:1.0:compile
[INFO] | | \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0:compile
[INFO] | | +- org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7:compile
[INFO] | | +- org.codehaus.plexus:plexus-velocity:jar:1.1.7:compile
[INFO] | | +- org.apache.velocity:velocity:jar:1.5:compile
[INFO] | | +- org.apache.maven.doxia:doxia-decoration-model:jar:1.0:compile
[INFO] | | +- org.apache.maven.doxia:doxia-module-apt:jar:1.0:compile
[INFO] | | +- org.apache.maven.doxia:doxia-module-fml:jar:1.0:compile
[INFO] | | +- org.apache.maven.doxia:doxia-module-xdoc:jar:1.0:compile
[INFO] | | \- org.apache.maven.doxia:doxia-module-xhtml:jar:1.0:compile
[INFO] | +- org.codehaus.plexus:plexus-utils:jar:2.0.2:compile
[INFO] | \- org.apache.maven.shared:maven-invoker:jar:2.0.11:compile
[INFO] +- org.osgi:org.osgi.core:jar:5.0.0:provided
[INFO] +- org.osgi:org.osgi.compendium:jar:5.0.0:provided
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | \- org.objenesis:objenesis:jar:2.1:test
[INFO] +- org.powermock:powermock-module-junit4:jar:1.6.6:test
[INFO] | \- org.powermock:powermock-module-junit4-common:jar:1.6.6:test
[INFO] | +- org.powermock:powermock-core:jar:1.6.6:test
[INFO] | \- org.powermock:powermock-reflect:jar:1.6.6:test
[INFO] +- org.powermock:powermock-api-mockito:jar:1.6.6:test
[INFO] | \- org.powermock:powermock-api-mockito-common:jar:1.6.6:test
[INFO] | \- org.powermock:powermock-api-support:jar:1.6.6:test
[INFO] +- org.slf4j:slf4j-api:jar:1.7.21:provided
[INFO] +- org.apache.aries.blueprint:org.apache.aries.blueprint.annotation.api:jar:1.0.0:provided
[INFO] +- org.ops4j.pax.exam:pax-exam-junit4:jar:4.9.1:test
[INFO] | +- org.ops4j.pax.exam:pax-exam-spi:jar:4.9.1:test
[INFO] | | \- org.ops4j.pax.tinybundles:tinybundles:jar:2.1.1:test
[INFO] | | \- biz.aQute.bnd:bndlib:jar:2.4.0:test
[INFO] | \- org.ops4j.base:ops4j-base-lang:jar:1.5.0:test
[INFO] +- org.ops4j.pax.exam:pax-exam-container-karaf:jar:4.9.1:test
[INFO] | +- org.ops4j.pax.exam:pax-exam-container-remote:jar:4.9.1:test
[INFO] | | +- org.ops4j.pax.exam:pax-exam-container-rbc-client:jar:4.9.1:test
[INFO] | | | \- org.ops4j.pax.exam:pax-exam-container-rbc:jar:4.9.1:test
[INFO] | | +- org.ops4j.pax.swissbox:pax-swissbox-core:jar:1.8.2:test
[INFO] | | | \- org.ops4j.pax.swissbox:pax-swissbox-lifecycle:jar:1.8.2:test
[INFO] | | \- org.ops4j.base:ops4j-base-net:jar:1.5.0:test
[INFO] | +- org.apache.commons:commons-compress:jar:1.4.1:test
[INFO] | | \- org.tukaani:xz:jar:1.0:test
[INFO] | +- org.ops4j.pax.swissbox:pax-swissbox-framework:jar:1.8.2:test
[INFO] | | +- org.ops4j.pax.swissbox:pax-swissbox-tracker:jar:1.8.2:test
[INFO] | | +- org.ops4j.base:ops4j-base-exec:jar:1.5.0:test
[INFO] | | +- org.ops4j.base:ops4j-base-io:jar:1.5.0:test
[INFO] | | \- org.ops4j.base:ops4j-base-monitors:jar:1.5.0:test
[INFO] | \- org.ops4j.base:ops4j-base-spi:jar:1.5.0:test
[INFO] +- org.apache.karaf:apache-karaf:zip:4.0.7:compile
[INFO] | +- org.apache.karaf.features:framework:kar:4.0.7:compile
[INFO] | | +- org.apache.karaf.features:base:jar:4.0.7:runtime
[INFO] | | +- org.apache.karaf:org.apache.karaf.main:jar:4.0.7:runtime
[INFO] | | | +- org.apache.karaf:org.apache.karaf.util:jar:4.0.7:runtime
[INFO] | | | | \- org.apache.felix:org.apache.felix.utils:jar:1.8.2:runtime
[INFO] | | | +- net.java.dev.jna:jna:jar:4.2.2:runtime
[INFO] | | | \- net.java.dev.jna:jna-platform:jar:4.2.2:runtime
[INFO] | | +- org.apache.karaf:org.apache.karaf.exception:jar:4.0.7:runtime
[INFO] | | +- org.apache.karaf:org.apache.karaf.client:jar:4.0.7:runtime
[INFO] | | | \- org.apache.sshd:sshd-core:jar:0.14.0:runtime
[INFO] | | +- org.apache.karaf.jaas:org.apache.karaf.jaas.boot:jar:4.0.7:runtime
[INFO] | | +- org.apache.karaf.diagnostic:org.apache.karaf.diagnostic.boot:jar:4.0.7:runtime
[INFO] | | +- org.eclipse.tycho:org.eclipse.osgi:jar:3.10.101.v20150820-1432:runtime
[INFO] | | +- org.apache.felix:org.apache.felix.framework:jar:5.4.0:runtime
[INFO] | | +- jline:jline:jar:2.14.2:compile
[INFO] | | +- org.jledit:core:jar:0.2.1:compile
[INFO] | | +- org.ops4j.pax.logging:pax-logging-api:jar:1.8.5:compile
[INFO] | | +- org.ops4j.pax.logging:pax-logging-service:jar:1.8.5:compile
[INFO] | | +- org.ops4j.pax.url:pax-url-aether:jar:2.4.7:compile
[INFO] | | \- org.apache.karaf.features:org.apache.karaf.features.core:jar:4.0.7:compile
[INFO] | +- org.apache.karaf.features:framework:xml:features:4.0.7:runtime
[INFO] | +- org.apache.karaf.features:standard:xml:features:4.0.7:compile
[INFO] | +- org.apache.karaf.features:spring:xml:features:4.0.7:runtime
[INFO] | \- org.apache.karaf.features:enterprise:xml:features:4.0.7:runtime
[INFO] +- org.ops4j.pax.exam:pax-exam:jar:4.9.1:test
[INFO] | +- org.ops4j.base:ops4j-base-store:jar:1.5.0:test
[INFO] | \- org.ops4j.base:ops4j-base-util-property:jar:1.5.0:test
[INFO] +- org.apache.camel:camel-core:jar:2.17.0:provided
[INFO] | +- com.sun.xml.bind:jaxb-core:jar:2.2.11:provided
[INFO] | \- com.sun.xml.bind:jaxb-impl:jar:2.2.11:provided
[INFO] +- org.apache.camel:camel-blueprint:jar:2.17.0:provided
[INFO] | +- org.apache.camel:camel-core-xml:jar:2.17.0:provided
[INFO] | \- org.apache.camel:camel-core-osgi:jar:2.17.0:provided
[INFO] +- org.apache.camel:camel-jms:jar:2.17.0:provided
[INFO] | +- org.apache.camel:camel-spring:jar:2.17.0:provided
[INFO] | | +- org.springframework:spring-core:jar:4.2.5.RELEASE:provided
[INFO] | | +- org.springframework:spring-aop:jar:4.2.5.RELEASE:provided
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:provided
[INFO] | | \- org.springframework:spring-expression:jar:4.2.5.RELEASE:provided
[INFO] | +- org.springframework:spring-jms:jar:4.2.5.RELEASE:provided
[INFO] | | \- org.springframework:spring-messaging:jar:4.2.5.RELEASE:provided
[INFO] | +- org.springframework:spring-context:jar:4.2.5.RELEASE:provided
[INFO] | +- org.springframework:spring-tx:jar:4.2.5.RELEASE:provided
[INFO] | \- org.springframework:spring-beans:jar:4.2.5.RELEASE:provided
[INFO] +- org.apache.camel:camel-jaxb:jar:2.17.0:provided
[INFO] +- org.apache.camel:camel-test:jar:2.17.0:test
[INFO] +- commons-logging:commons-logging:jar:1.2:provided
[INFO] +- commons-lang:commons-lang:jar:2.6:provided
[INFO] +- commons-io:commons-io:jar:2.4:provided
[INFO] +- org.apache.camel:camel-test-blueprint:jar:2.13.0:test
[INFO] | +- org.apache.aries.blueprint:org.apache.aries.blueprint:jar:1.1.0:test
[INFO] | +- org.apache.aries:org.apache.aries.util:jar:1.1.0:test
[INFO] | +- org.apache.aries.proxy:org.apache.aries.proxy.impl:jar:1.0.1:test
[INFO] | +- org.apache.aries.proxy:org.apache.aries.proxy.api:jar:1.0.0:test
[INFO] | +- com.googlecode.pojosr:de.kalpatec.pojosr.framework:jar:0.2.1:test
[INFO] | +- org.ops4j.pax.swissbox:pax-swissbox-tinybundles:jar:1.3.1:test
[INFO] | | \- org.ops4j.pax.swissbox:pax-swissbox-bnd:jar:1.3.1:test
[INFO] | | \- biz.aQute:bndlib:jar:0.0.357:test
[INFO] | +- org.apache.felix:org.apache.felix.configadmin:jar:1.4.0:compile
[INFO] | \- org.apache.felix:org.apache.felix.fileinstall:jar:3.2.6:compile
[INFO] +- org.apache.camel:camel-jackson:jar:2.17.0:provided
[INFO] | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.7.2:provided
[INFO] +- org.apache.camel:camel-jsonpath:jar:2.17.0:provided
[INFO] +- org.apache.camel:camel-jolt:jar:2.17.0:provided
[INFO] +- org.apache.camel:camel-quartz2:jar:2.17.0:provided
[INFO] | +- org.quartz-scheduler:quartz:jar:2.2.2:provided
[INFO] | | \- c3p0:c3p0:jar:0.9.1.1:provided
[INFO] | \- com.mchange:c3p0:jar:0.9.5.2:provided
[INFO] | \- com.mchange:mchange-commons-java:jar:0.2.11:provided
[INFO] +- org.apache.camel:camel-hazelcast:jar:2.17.0:provided
[INFO] | +- com.hazelcast:hazelcast:jar:3.6.2:provided
[INFO] | \- com.hazelcast:hazelcast-client:jar:3.6.2:provided
[INFO] +- com.jayway.jsonpath:json-path:jar:2.0.0:provided
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.3:provided
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.8.3:provided
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.3:provided
[INFO] +- com.bazaarvoice.jolt:jolt-core:jar:0.0.16:provided
[INFO] | \- javax.inject:javax.inject:jar:1:provided
[INFO] +- com.bazaarvoice.jolt:json-utils:jar:0.0.16:provided
[INFO] +- net.minidev:json-smart:jar:2.1.1:provided
[INFO] +- net.minidev:asm:jar:1.0.2:provided
[INFO] | \- asm:asm:jar:3.3.1:provided
[INFO] +- com.google.code.gson:gson:jar:2.8.0:provided
[INFO] +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] +- org.apache.maven.surefire:surefire-junit4:jar:2.19.1:test
[INFO] | \- org.apache.maven.surefire:surefire-api:jar:2.19.1:test
[INFO] +- org.apache.cxf:cxf-core:jar:3.1.8:provided
[INFO] | +- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] | | \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] | \- org.apache.ws.xmlschema:xmlschema-core:jar:2.2.1:compile
[INFO] +- org.apache.cxf:cxf-rt-rs-client:jar:3.1.8:provided
[INFO] | +- org.apache.cxf:cxf-rt-transports-http:jar:3.1.8:provided
[INFO] | \- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:3.1.8:provided
[INFO] | \- javax.annotation:javax.annotation-api:jar:1.2:provided
[INFO] +- org.jacoco:org.jacoco.agent:jar:runtime:0.7.8:test
[INFO] \- org.eclipse.jdt:org.eclipse.jdt.annotation:jar:2.1.0:compile
以下是模块中 "mvn install" 的输出的摘录,当它 运行 进行单元测试时:
Running package.usl.fraudcheck.impl.InquireCPNIContactInformationProcessorTest
[org.jboss.logging] : Logging Provider: org.jboss.logging.Log4j2LoggerProvider Ignored FQCN: org.jboss.logging.Logger
[org.hibernate.validator.internal.util.Version] : HV000001: Hibernate Validator 5.4.1.Final Ignored FQCN: org.hibernate.validator.internal.util.logging.Log_$logger
[org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver] : Cannot find javax.persistence.Persistence on classpath. Assuming non JPA 2 environment. All properties will per default be traversable. Ignored FQCN: org.jboss.logging.DelegatingBasicLogger
[org.hibernate.validator.internal.xml.ValidationXmlParser] : Trying to load META-INF/validation.xml for XML based Validator configuration. Ignored FQCN: org.jboss.logging.DelegatingBasicLogger
[org.hibernate.validator.internal.xml.ResourceLoaderHelper] : Trying to load META-INF/validation.xml via TCCL Ignored FQCN: org.jboss.logging.DelegatingBasicLogger
[org.hibernate.validator.internal.xml.ResourceLoaderHelper] : Trying to load META-INF/validation.xml via Hibernate Validator's class loader Ignored FQCN: org.jboss.logging.DelegatingBasicLogger
[org.hibernate.validator.internal.xml.ValidationXmlParser] : No META-INF/validation.xml found. Using annotation based configuration only. Ignored FQCN: org.jboss.logging.DelegatingBasicLogger
Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.67 sec <<< FAILURE! - in package.usl.fraudcheck.impl.InquireCPNIContactInformationProcessorTest
testValidate(package.usl.fraudcheck.impl.InquireCPNIContactInformationProcessorTest) Time elapsed: 0.219 sec <<< ERROR!
javax.validation.ValidationException: HV000183: Unable to initialize 'javax.el.ExpressionFactory'. Check that you have the EL dependencies on the classpath, or use ParameterMessageInterpolator instead
at package.usl.fraudcheck.impl.InquireCPNIContactInformationProcessorTest.testValidate(InquireCPNIContactInformationProcessorTest.java:23)
Caused by: java.lang.NoClassDefFoundError: javax/el/ExpressionFactory
at package.usl.fraudcheck.impl.InquireCPNIContactInformationProcessorTest.testValidate(InquireCPNIContactInformationProcessorTest.java:23)
所以,您真的只需要一个版本的 el jar。它应该是:
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
<version>3.0.1-b08</version>
</dependency>
至于其他 el jar,您需要将它们从您的依赖项中排除。依赖关系树应该可以帮助您,因为您可以看到它们的来源。
只需对传递旧 el jar 的依赖项使用排除,并确保您没有在 poms 中明确引用它,它应该可以工作。
如错误消息所述,另一种解决方案是使用不使用 EL 的消息插值器,但我不推荐它,因为某些内置约束在其消息中使用 EL,您可能需要它你自己的约束。
即使在向 org.glassfish:javax.el:3.0.1-b08
添加依赖项后,我也遇到了同样的错误。问题原来是传递依赖项被引入,其中包括 javax.el.ExpressionFactory
但没有实现。
下面的命令会输出所有包含javax.el.ExpressionFactory
for i in $(mvn dependency:build-classpath | grep '.m2' | tr ':' ' '); do
jar -tvf $i | grep 'javax/el/ExpressionFactory' && echo -e "\t$i"
done 2> /dev/null
然后我在 pom.xml 中使用 <exclusions>
删除不匹配 org.glassfish:javax.el:3.0.1-b08
的罐子。
排除项 可能 最终也会删除所需的排除 Jar 中的代码。就我而言,我必须找到一个提供嵌入式 Jetty 服务器的替代 jar。