Wicket 8 AnnotatedMountScanner not working anymore - wicket

After upgrading from Wicket 7 to Wicket 8, page mounting does not work anymore.
In Wicket 7 I added
new AnnotatedMountScanner().scanPackage("com.example").mount(this);
in my init() method of my AuthenticatedWebApplication
And on my page I added #MountPath("/mypage").
In Wicket 8 this does not work anymore and instead of /mypage the browser URL points to wicket/bookmarkable/com.example.MyPage , however when I manually add
mountPage("AAA", MyPage.class); it works.
Here is my classpath with all wicket dependencies:
$ mvn dependency:tree | grep wicket [INFO] +-
org.apache.wicket:wicket-core:jar:8.0.0:compile [INFO] | +-
org.apache.wicket:wicket-request:jar:8.0.0:compile [INFO] | +-
org.apache.wicket:wicket-util:jar:8.0.0:compile [INFO] +-
org.wicketstuff:wicketstuff-annotation:jar:8.0.0:compile [INFO] +-
org.apache.wicket:wicket-spring:jar:8.0.0:compile [INFO] | -
org.apache.wicket:wicket-ioc:jar:8.0.0:compile [INFO] +-
org.apache.wicket:wicket-datetime:jar:8.0.0-M7:compile [INFO] +-
org.apache.wicket:wicket-auth-roles:jar:8.0.0:compile [INFO] +-
de.agilecoders.wicket:wicket-bootstrap-core:jar:2.0.2:compile [INFO]
| +- de.agilecoders.wicket:jquery-selectors:jar:2.0.0:compile
[INFO] | +-
de.agilecoders.wicket.webjars:wicket-webjars:jar:2.0.7:compile [INFO]
| +- org.apache.wicket:wicket-extensions:jar:8.0.0:compile [INFO]
+- de.agilecoders.wicket:wicket-bootstrap-extensions:jar:2.0.2:compile
[INFO] +-
com.googlecode.wicket-jquery-ui:wicket-jquery-ui-plugins:jar:8.0.0-M7:compile
[INFO] | -
com.googlecode.wicket-jquery-ui:wicket-jquery-ui-core:jar:8.0.0-M7:compile
But I do not want to add all mypages manually. Is it possible to also use the AnnotatedMountScanner again in Wicket 8?

It turned out to be a class reloading issue with spring-boot devtools.
When spring-boot-devtools was added as dependency, the RestartClassLoader always changed the Page Classes and Wickets Page Class Matching was out of order.
Explanation after debugging.
When my BookmarkablePageLink called getURL() it went through normal Wicket processing of the RequestHandlers.
The crucial part began in the AbstractBookmarkableMapper#382 where Wicket tries to find out by calling checkPageClass if the page class from the RequestHandler matches to the class of the MountedMapper internally represented via the pageClassProvider.
#Override
protected boolean checkPageClass(Class<? extends IRequestablePage> pageClass)
{
return Objects.equals(pageClass, this.getPageClass());
}
As the objects were not the same (due to the use of RestartClassLoader) my bookmarkable page did not get the URL from the MountedMapper.

Related

BundleException: Missing Constraint:Import-Package: org.eclipse.e4.ui.internal.workbench.swt; version="0.0.0"

I am trying to launch an RCP application(Product) using "--console". I got few conflicts but not sure how to resolve this particular conflict.
org.osgi.framework.BundleException: The bundle
"com.company.abc.app_1.5 [111]" could not be resolved.
Reason: Missing Constraint: Import-Package: org.eclipse.e4.ui.internal.workbench.swt; version="0.0.0"
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1327)
On checking the the dependencies which I think I should look at, I found the following in com.company.abc.app:
[INFO] +- org.eclipse.ui:org.eclipse.ui.workbench:jar:3.106.2-SDK-4.4.2:compile
[INFO] | +- org.eclipse.help:org.eclipse.help:jar:3.6.0-SDK-4.4.2:compile
[INFO] | +- org.eclipse.jface:org.eclipse.jface.databinding:jar:1.6.200-SDK-4.4.2:compile
[INFO] | | \- org.eclipse.core:org.eclipse.core.databinding:jar:1.4.2-SDK-4.4.2:compile
[INFO] | +- org.eclipse.core:org.eclipse.core.databinding.property:jar:1.4.200-SDK-4.4.2:compile
[INFO] | +- org.eclipse.core:org.eclipse.core.databinding.observable:jar:1.4.1-SDK-4.4.2:compile
[INFO] | +- **org.eclipse.e4:org.eclipse.e4.ui.workbench.swt:jar:0.12.100-SDK-4.4.2:compile**
Though I do not see any org.eclipse.e4.ui.workbench.swt in the product. When I searched in maven repo I did not find org.eclipse.e4.ui.workbench.swt v0.12.100-SDK-4.4.2. That's bit confusing.
Also, I do not completely understand why it complains about version 0.0.0 in Missing Constraint: Import-Package: org.eclipse.e4.ui.internal.workbench.swt; version="0.0.0" ?

CMS Magnolia magnolia-rest-content-delivery version in pom

I need to install magnolia-rest-content-delivery module in Maven.
Before installing this module I had following dependencies. Project was built and installed without problems.
Question: How it's possible not to define dependency version in magnolia projects?
1st attempt to install without version like others from group info.magnolia.rest
That cause error `[ERROR] 'dependencies.dependency.version' for info.magnolia.rest:magnolia-rest-content-delivery:jar is missing.``
Question: What's so special about magnolia-rest-content-delivery so it does need version?
2nd attempt - add version to
That cause error during deployment
Module Magnolia REST Content Delivery (version 2.0.1) is dependent on rest-integration (version 2.0.1/*),
but Magnolia REST Integration (version 1.2.1) is currently installed.
3rd attempt: adding same version to all dependencies in info.magnolia.rest groupId
That cause same error during deployment
Module Magnolia REST Content Delivery (version 2.0.1) is dependent on rest-integration (version 2.0.1/*),
but Magnolia REST Integration (version 1.2.1) is currently installed.
What can I try next to resolve issue?
Thank you.
Update:
Project's pom have dependency from magnolia-enterprise-bundle-parent v#5.5.4
in dependency tree I can see that magnolia-rest-integration picked-up version 1.2.1
What would be safe way to override version defined in BOM?
Update 2:
I end-up with overriding dependency versions in dependencyManagement section
Clean local maven repository and build
Regardles that effective pom now shows correct versions for magnolia rest modules result is almost the same
[ERROR] Module Magnolia REST Tools (version 2.0.1) is dependent on rest-integration (version 2.0.1/*),
but Magnolia REST Integration (version 1.2.1) is currently installed.
[ERROR] Module Magnolia REST Content Delivery (version 2.0.1) is dependent on rest-integration (version 2.0.1/*),
but Magnolia REST Integration (version 1.2.1) is currently installed.
I couldn't attach dependency tree output file (here is small excerpt)
[INFO] +- info.magnolia.eebundle:magnolia-enterprise-standard-webapp:war:5.5.4:compile
[INFO] +- info.magnolia.rest:magnolia-rest-integration:jar:2.0.1:compile
[INFO] | +- info.magnolia.core:magnolia-configuration:jar:5.5.4:compile
[INFO] | | \- org.atteo:evo-inflector:jar:1.2.1:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.2:compile
[INFO] | | \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | +- org.jboss.resteasy:resteasy-jaxrs:jar:3.0.19.SP1-redhat-1:compile
[INFO] | | +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar:1.0.0.Final-redhat-1:compile
[INFO] | | \- org.jboss.logging:jboss-logging:jar:3.3.0.Final-redhat-1:compile
[INFO] | +- org.jboss.resteasy:resteasy-jackson2-provider:jar:3.0.19.SP1-redhat-1:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-core:jar:2.8.6:compile
[INFO] | | \- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.8.6:compile
[INFO] | | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.8.6:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.8.6:compile
[INFO] | +- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.0.19.SP1-redhat-1:compile
[INFO] | +- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
[INFO] | \- com.google.guava:guava:jar:18.0:compile
[INFO] +- info.magnolia.rest:magnolia-rest-services:jar:2.0.1:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] | +- io.swagger:swagger-annotations:jar:1.5.4:compile
[INFO] | +- org.apache.jackrabbit:jackrabbit-jcr-commons:jar:2.12.4:compile
[INFO] | +- commons-codec:commons-codec:jar:1.10:compile
[INFO] | +- org.jboss.resteasy:resteasy-jackson-provider:jar:3.0.19.SP1-redhat-1:compile
[INFO] | | +- org.codehaus.jackson:jackson-core-asl:jar:1.9.12:compile
[INFO] | | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.12:compile
[INFO] | | +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.12:compile
[INFO] | | \- org.codehaus.jackson:jackson-xc:jar:1.9.12:compile
[INFO] | \- org.jboss.resteasy:resteasy-client:jar:3.0.19.SP1-redhat-1:compile
[INFO] +- info.magnolia.rest:magnolia-rest-tools:jar:2.0.1:compile
[INFO] | +- io.swagger:swagger-jaxrs:jar:1.5.4:compile
[INFO] | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.8.6:compile
[INFO] | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.8.6:compile
[INFO] | | | +- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] | | | \- com.fasterxml.woodstox:woodstox-core:jar:5.0.3:compile
[INFO] | | \- io.swagger:swagger-core:jar:1.5.4:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.8.6:compile
[INFO] | | \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | \- io.swagger:swagger-models:jar:1.5.4:compile
[INFO] +- info.magnolia.rest:magnolia-rest-content-delivery:jar:2.0.1:compile
[INFO] | +- javax.json:javax.json-api:jar:1.0:compile
[INFO] | +- org.glassfish:javax.json:jar:1.0:compile
[INFO] | \- org.apache.jackrabbit:jackrabbit-spi-commons:jar:2.12.4:compile
[INFO] | \- org.apache.jackrabbit:jackrabbit-spi:jar:2.12.4:compile
The only place where this mistic "Magnolia REST Integration (version 1.2.1)" mentioned is:
.m2\repository\info\magnolia\bundle\magnolia-bundle-parent\5.5.4\magnolia-bundle-parent-5.5.4.pom
Version numbers for rest comes from parent pom that you most likely extend or from dependency section of Magnolia CE or EE webapp that you import or from BOM. No way to say w/o seeing whole pom. As for what's special about Content Delivery - it's not defined in the "source" of versions for other modules hence you need to declare it explicitly.
From the error it most likely looks like you end up with both versions of the artefact in your webapp or version is not being picked up (i.e. some error in your pom). You should not need to declare magnolia-rest-integration at all as it should be pulled in by either magnolia-rest-content-delivery or by -services or -tools modules anyway.
Please include link to whole pom. Also please provide output of running mvn dependency:tree to point out exactly what is wrong.

The project contains another dependency with the same archive name

I'm seeing the following error (and a couple of others like it) in my markers:
Invalid classpath publish/export dependency C:/Users/LevineJ/.m2/repository/org/bouncycastle/bcmail-jdk14/1.38/bcmail-jdk14-1.38.jar.
The project contains another dependency with the same archive name.
When I do a quick search, I find bcmail-jdk14.1.jar in two locations:
C:\Users\LevineJ.m2\repository\bouncycastle\bcmail-jdk14\138
C:\Users\LevineJ.m2\repository\org\bouncycastle\bcmail-jdk14\1.38
From what I've read on the topic (various posts/articles), I'm thinking this has to do with the error I'm seeing. Can someone please provide some info regarding:
1. What does this error mean?
2. How would I go about solving it?
If it helps, I'm using:
Eclipse Java EE - Luna Service Release 1 (4.4.1)
m2e plugin
m2e-wtp plugin
Results of mvn dependency:tree
C:\Users\LevineJ\Development\default-workspace\adweb>mvn dependency:tree
Picked up _JAVA_OPTIONS: -Dcom.gxs.common.configuration.proxy.envid=totcpa -Dcom.gxs.common.logging.configfilepath=C:\Users\LevineJ\Development\config\adweb\LogCfg.xml -Dcom.gxs.common.configuration.localenvid=adweb -Dcom.gxs.common.logging.sdklogfile=C:\Users\LevineJ\Development\config\adweb\tgo.log -Dcom.gxs.common.configuration.path=C:\Users\LevineJ\Development\config\adweb\CRC
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.gxs:adweb:war:${build.number}
[WARNING] 'version' contains an expression but should be a constant. # line 9, column 11
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:tomcat-maven-plugin is missing. # line 325, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building adweb ${build.number}
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.gxs:reportservice-client:jar:05.09.00.16 is missing, no dependency information available
[INFO]
[INFO] --- maven-dependency-plugin:2.3:tree (default-cli) # adweb ---
[WARNING] Missing POM for com.gxs:reportservice-client:jar:05.09.00.16
[INFO] com.gxs:adweb:war:${build.number}
[INFO] +- com.opentext.ix.ad:adcommon:jar:LATEST:compile
[INFO] | +- com.gxs.imclient:IMclient:jar:07.24.00.03:compile
[INFO] | +- com.gxs.e2eui:wscommon:jar:1.0:compile
[INFO] | | +- org.apache.woden:woden-impl-dom:jar:1.0M8:compile
[INFO] | | | +- org.apache.woden:woden-api:jar:1.0M8:compile
[INFO] | | | +- org.apache.ws.commons.schema:XmlSchema:jar:1.4.2:compile
[INFO] | | | +- org.apache.ant:ant:jar:1.7.0:compile
[INFO] | | | +- wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO] | | | +- xerces:xercesImpl:jar:2.8.1:compile
[INFO] | | | +- xerces:xmlParserAPIs:jar:2.6.0:compile
[INFO] | | | \- org.apache.ws.commons.axiom:axiom-api:jar:1.2.7:compile
[INFO] | | | +- org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.0.1:compile
[INFO] | | | +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.2:compile
[INFO] | | | \- jaxen:jaxen:jar:1.1.1:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.3.04:compile
[INFO] | +- com.gxs.e2eui:imqsclient:jar:1.0:compile
[INFO] | | \- org.apache.axis2:axis2-jws-api:jar:1.4.1:compile
[INFO] | | +- org.apache.ant:ant-launcher:jar:1.7.0:compile
[INFO] | | +- org.apache.ws.commons.axiom:axiom-impl:jar:1.2.7:compile
[INFO] | | +- org.apache.ws.commons.axiom:axiom-dom:jar:1.2.7:compile
[INFO] | | +- javax.mail:mail:jar:1.4.2:compile
[INFO] | | | \- javax.activation:activation:jar:1.1:compile
[INFO] | | +- xalan:xalan:jar:2.7.0:compile
[INFO] | | +- org.codehaus.woodstox:wstx-asl:jar:3.2.4:compile
[INFO] | | \- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:compile
[INFO] | +- com.gxs:reportservice-client:jar:05.09.00.16:compile
[INFO] | +- org.springframework.data:spring-data-commons-core:jar:1.4.1.RELEASE:compile
[INFO] | +- org.springframework.ws:spring-oxm:jar:1.5.10:compile
[INFO] | | +- org.springframework.ws:spring-xml:jar:1.5.10:compile
[INFO] | | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | +- org.springframework:spring-context:jar:3.1.2.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:3.1.2.RELEASE:compile
[INFO] | | +- org.springframework:spring-expression:jar:3.1.2.RELEASE:compile
[INFO] | | \- org.springframework:spring-asm:jar:3.1.2.RELEASE:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.2:compile
[INFO] | +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.3.2:compile
[INFO] | +- org.springframework:spring-core:jar:3.1.2.RELEASE:compile
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.3.3:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.3.2:compile
[INFO] | | \- commons-codec:commons-codec:jar:1.6:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.5:compile
[INFO] | +- org.slf4j:jcl-over-slf4j:jar:1.7.5:runtime
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.7.5:runtime
[INFO] | \- com.thoughtworks.xstream:xstream:jar:1.2.2:compile
[INFO] | \- xpp3:xpp3_min:jar:1.1.3.4.O:compile
[INFO] +- org.jboss.spec:jboss-javaee-6.0:pom:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.resource:jboss-connector-api_1.5_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.ejb:jboss-ejb-api_3.1_spec:jar:1.0.0.Final:provided
[INFO] | | \- javax.xml:jaxrpc-api:jar:1.1:provided
[INFO] | | \- javax.xml.soap:saaj-api:jar:1.3:provided
[INFO] | +- org.jboss.spec.javax.el:jboss-el-api_2.2_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.4_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.enterprise.deploy:jboss-jad-api_1.2_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.security.auth.message:jboss-jaspi-api_1.0_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.xml.registry:jboss-jaxr-api_1.0_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.jms:jboss-jms-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.servlet.jsp:jboss-jsp-api_2.2_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.2_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.xml.rpc:jboss-jaxrpc-api_1.1_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.xml.soap:jboss-saaj-api_1.3_spec:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.spec.javax.xml.ws:jboss-jaxws-api_2.2_spec:jar:1.0.0.Final:provided
[INFO] | +- javax.enterprise:cdi-api:jar:1.0-SP4:provided
[INFO] | +- javax.jws:jsr181-api:jar:1.0-MR1:provided
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:provided
[INFO] | +- org.jboss.resteasy:jaxrs-api:jar:2.1.0.GA:provided
[INFO] | +- stax:stax-api:jar:1.0.1:provided
[INFO] | \- javax.validation:validation-api:jar:1.0.0.GA:provided
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.2:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.3.2:compile
[INFO] +- com.sun.faces:jsf-api:jar:LATEST:compile
[INFO] +- com.sun.faces:jsf-impl:jar:LATEST:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- commons-fileupload:commons-fileupload:jar:1.3.1:compile
[INFO] +- commons-io:commons-io:jar:2.4:compile
[INFO] +- org.primefaces:primefaces:jar:4.0:compile
[INFO] +- org.primefaces.extensions:primefaces-extensions:jar:2.0.0:compile
[INFO] | \- com.google.code.gson:gson:jar:2.2.4:compile
[INFO] +- org.primefaces.themes:all-themes:jar:LATEST:compile
[INFO] +- javax.inject:javax.inject:jar:1.0-PFD-1:compile
[INFO] +- org.springframework:spring-web:jar:3.1.2.RELEASE:compile
[INFO] | +- aopalliance:aopalliance:jar:1.0:compile
[INFO] | \- org.springframework:spring-beans:jar:3.1.2.RELEASE:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- log4j:log4j:jar:1.2.15:compile
[INFO] +- xstream:xstream:jar:1.1.2:compile
[INFO] +- junit:junit:jar:4.11:compile
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] +- org.mockito:mockito-all:jar:1.8.5:test
[INFO] +- org.springframework:spring-test:jar:3.1.2.RELEASE:compile
[INFO] +- org.glassfish.web:el-impl:jar:2.2:compile
[INFO] | \- javax.el:el-api:jar:2.2:compile
[INFO] +- com.lowagie:itext:jar:2.1.7:compile
[INFO] | +- bouncycastle:bcmail-jdk14:jar:138:compile
[INFO] | +- bouncycastle:bcprov-jdk14:jar:138:compile
[INFO] | \- org.bouncycastle:bctsp-jdk14:jar:1.38:compile
[INFO] | +- org.bouncycastle:bcprov-jdk14:jar:1.38:compile
[INFO] | \- org.bouncycastle:bcmail-jdk14:jar:1.38:compile
[INFO] +- com.gxs:primefaces-theme-tgo:jar:01.00.00.01:compile
[INFO] +- com.gxs:crc-client:jar:2.0.11:compile
[INFO] +- com.gxs:crc-system:jar:2.0.11:compile
[INFO] +- com.gxs.tglogging:tglogging:jar:05.09.00.02:compile
[INFO] +- com.gxs.fms:FMSClient:jar:LATEST:compile
[INFO] \- com.opentext:metrics-service-dto:jar:LATEST:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.374 s
[INFO] Finished at: 2014-11-14T11:26:44-05:00
[INFO] Final Memory: 12M/306M
[INFO] ------------------------------------------------------------------------
Screenshot of Maven Dependencies/Build Path
Screenshot of Deployment Assembly
Thanks.
The issue is that runtime *.jar dependencies are published into WEB-APP/lib folder. If two dependencies have the same name, they can not be published.
The strange thing with your issue is that itext (with its bouncycastle dependencies) are pretty common. Several projects in our company have it, but I have never seen a similar warning.
So this makes me wonder, where the issue comes from. The two duplicate dependencies (bcmail and bcprov) are actually not duplicate - they have different version (hence different JAR name). So the issue must be somewhere else.
Please check your Java Build Path (or check .classpath project file) settings and Deployment Assembly settings. You must have unintentionally included bcmail duplicate manually.
Also make sure you don't have bcmail-jdk14-1.38.jar in your src/main/webapp/WEB-INF/lib/.
And last possible suspect might be some unconventional JBoss deployment configuration combining two projects into one web application. But I am not that familiar with JBoss Tools (just guessing you are using it based on your dependencies).
I've checked all answers above but they don't work for me. I found that my Maven project has a different directory than regular Java Web project. I checked file .classpath in root directory and I changed
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
to
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="**WebRoot**/WEB-INF/lib"/>
</attributes>
which solved my problem
I was getting this issue because I was having following configuration
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<outputFileNameMapping>#{artifactId}#.#{extension}#</outputFileNameMapping>
</configuration>
</plugin>
When I added #version# to outputFileNameMapping, it resolved this error.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<outputFileNameMapping>#{artifactId}#.#{extension}#.#{version}#</outputFileNameMapping>
</configuration>
</plugin>
This also happens if you load up another copy of the same project (the dependency project) in your workspace. Project A is dependent on Project B but if you add in Project B branchX then you'll have this problem.

Stanford CoreNLP: Building Error (NoSuchMethodError)

Sorry if this is a newbie's question.
I was trying to use maven in Netbeans to build CoreNLP parser.
I first added dependency of stanford-corenlp 1.2.0. However, I always got an error while compiling my code. I tried to simplify my code to just create the StanfordCoreNLP object, but it still did not function with the same error message. I guess here might come with the main trouble spot then.
My simplified code shows as:
import java.util.Properties;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
Properties props = new Properties();
props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
The error message:
Exception in thread "main" java.lang.NoSuchMethodError:
edu.stanford.nlp.process.PTBTokenizer.factory
(Ledu/stanford/nlp/process/LexedTokenFactory;Ljava/lang/String;)Ledu/stanford/nlp/objectbank/TokenizerFactory;
at edu.stanford.nlp.pipeline.PTBTokenizerAnnotator.<init>(PTBTokenizerAnnotator.java:42)
at edu.stanford.nlp.pipeline.StanfordCoreNLP$1.create(StanfordCoreNLP.java:365)
at edu.stanford.nlp.pipeline.StanfordCoreNLP$1.create(StanfordCoreNLP.java:355)
at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:62)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:328)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:194)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:184)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:176)
at com.mycompany.hellocore.App.main(App.java:26)
I also tried the same thing via maven on Eclipse, the error message is still the same. Can anyone give me some suggestions? Thanks!
OS: Mac Lion /
Java version: 1.6.0_29
[Update]
01-6-2012 Based on Sri Sankaran's suggestion, i tried mvn dependency: tree:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building hellocore 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) # hellocore ---
[INFO] com.mycompany:hellocore:jar:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] \- edu.stanford.nlp:stanford-corenlp:jar:1.2.0:compile
[INFO] +- xom:xom:jar:1.2.5:compile
[INFO] | +- xml-apis:xml-apis:jar:1.3.03:compile
[INFO] | +- xerces:xercesImpl:jar:2.8.0:compile
[INFO] | \- xalan:xalan:jar:2.7.0:compile
[INFO] \- joda-time:joda-time:jar:2.0:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.483s
[INFO] Finished at: Fri Jan 06 08:55:06 EST 2012
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------
The setting in my Netbeans:
But it seems like the library in need looks the same as what is already downloaded in Netbeans. The project still stops while Adding annotator tokenize.
[Update]
01-09-2012
After i reinstalled my system, the problem was gone. So i think the code and the module are both correct. The classpath directories might be just messed up by me. Thank you for all people's helps.
Just a gentle reminder for people using corenlp via Netbeans. In addition to the standard dependency of stanford-corenlp.jar. If you want to inlcude the stanford-corenlp-models.jar into your project. Seems like you also need to specify the <classifier> to add the models to the dependency repository.
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>1.2.0</version>
<classifier>models</classifier>
</dependency>
You need to include model (POS tag, NER, Coref, etc), so your annotator worked.
You can get it here
The usage of Standford NLP suggests that there are other dependencies. If they aren't transitively included in the classpath by virtue of the stated dependency on stanford-corenlp 1.2.0 you will have to explicitly state these other dependencies as well. The command mvn dependency:tree should display your effective dependency tree.

JPA/SCALA No Persistence provider named xxx?

When I execute the following code in scala REPL:
javax.persistence.Persistence.createEntityManagerFactory("manager1")
I get
javax.persistence.PersistenceException: No Persistence provider for EntityManager named manager1
The same maven project running Java has no problems (in other words, I believe my dependecies are setup correctly)
Using the remote debugger I found the problem seem to be at PersistenceProviderResolverHolder where it executed the following code:
Enumeration<URL> resources = cl.getResources( "META-INF/services/" + PersistenceProvider.class.getName() )
The returned enumeration has no elements.
When I execute the same REPL session
val cl = classOf[javax.persistence.spi.PersistenceProviderResolverHolder].getClassLoader()
cl.getResources( "META-INF/services/javax.persistence.spi.PersistenceProvider").hasMoreElements
I get "true"
This happens both when using mvn:scala or when using scala directly:
scala -cp "target/dependency/*":target/classes
My dependencies are
[INFO] --- maven-dependency-plugin:2.3:tree (default-cli) # java.jpa.basics ---
[INFO] com.edc4it:java.jpa.basics:jar:1.0
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.2:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.6.2:compile
[INFO] | \- log4j:log4j:jar:1.2.16:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.6:compile
[INFO] +- javassist:javassist:jar:3.9.0.GA:compile
[INFO] +- org.scala-lang:scala-library:jar:2.9.1:compile
[INFO] \- org.hibernate:hibernate-entitymanager:jar:3.6.7.Final:compile
[INFO] +- org.hibernate:hibernate-core:jar:3.6.7.Final:compile
[INFO] | +- antlr:antlr:jar:2.7.6:compile
[INFO] | +- commons-collections:commons-collections:jar:3.1:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
[INFO] | \- javax.transaction:jta:jar:1.1:compile
[INFO] +- cglib:cglib:jar:2.2:compile
[INFO] | \- asm:asm:jar:3.1:compile
[INFO] \- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
The only JPA releated dependency is "org.hibernate:hibernate-entitymanager:3.6.7.Final"
It looks like a classloading problem, but could it be something different?
After some more digging and debugging, I found out that the JPA implementation uses the current tread's contextual classloader (which in my case is the sun.misc.Launcher$AppClassLoader). That classloader indeed does not include the JPA and Hibernate JARs. (see javax.persistence.spi.PersistenceProviderResolverHolder.PersistenceProviderResolverPerClassLoader#getContextualClassLoader)
Changing the contextual classloader prior to getting the EntityManagerFactory therefore does the trick:
Thread.currentThread().setContextClassLoader(JPAUtil.class.getClassLoader());
emf = Persistence.createEntityManagerFactory("manager");
In REPL setting the contextual classloader does not work, it is reset to the application classloader after setting it.
I dkn't know what the consequences are yet (not sure if all the JPA code will actually work, just did a few tests and seems to work so far).
Also i don't understand why hibernate would use the contextual classloader and not just the current classloader.