I have a problem with JOOQ framework (3.13.5) along with Spring Boot and Java 8. I'm trying to generate domain classes following the instructions from the manual given on the author's page (link) using the GenerationTool from JOOQ, which is mentioned here. The project structure is presented below:
The domain package contains JPA entities. Then I've added run configuration, where as the main class I've marked the GenerationTool from JOOQ's library with argument: /jooq-config.xml (as mentioned in the author's manual linked above). The config file content is shown below:
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.13.0.xsd">
<generator>
<database>
<name>org.jooq.meta.extensions.jpa.JPADatabase</name>
<properties>
<property>
<key>packages</key>
<value>com.ormtester.jpa.domain</value>
</property>
<property>
<key>useAttributeConverters</key>
<value>true</value>
</property>
<property>
<key>unqualifiedSchema</key>
<value>none</value>
</property>
<property>
<key>hibernate.physical_naming_strategy</key>
<value>org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy</value>
</property>
</properties>
</database>
</generator>
For the analyse issues I'm also adding the the fragment of pom.xml with lib's versions:
<dependencies>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta-extensions</artifactId>
<version>3.13.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen</artifactId>
<version>3.13.5</version>
</dependency>
</dependencies>
And now when I'm trying to build the project, I'm getting the following error:
18:49:37.330 [main] WARN org.jooq.util.jaxb.tools.MiniJAXB - org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 72; cvc-elt.1: Cannot find the declaration of element 'configuration'.
18:49:42.215 [main] INFO org.jooq.codegen.GenerationTool - Initialising properties : /jooq-config.xml
18:49:43.134 [main] DEBUG org.jooq.codegen.GenerationTool - Input configuration : <onError>FAIL</onError><generator><name>org.jooq.codegen.DefaultGenerator</name><database><name>org.jooq.meta.extensions.jpa.JPADatabase</name><regexMatchesPartialQualification>true</regexMatchesPartialQualification><sqlMatchesPartialQualification>true</sqlMatchesPartialQualification><includes>.*</includes><excludes></excludes><includeExcludeColumns>false</includeExcludeColumns><includeTables>true</includeTables><includeEmbeddables>true</includeEmbeddables><includeRoutines>true</includeRoutines><includeTriggerRoutines>false</includeTriggerRoutines><includePackages>true</includePackages><includePackageRoutines>true</includePackageRoutines><includePackageUDTs>true</includePackageUDTs><includePackageConstants>true</includePackageConstants><includeUDTs>true</includeUDTs><includeSequences>true</includeSequences><includeIndexes>true</includeIndexes><includePrimaryKeys>true</includePrimaryKeys><includeUniqueKeys>true</includeUniqueKeys><includeForeignKeys>true</includeForeignKeys><includeCheckConstraints>true</includeCheckConstraints><includeInvisibleColumns>true</includeInvisibleColumns><recordVersionFields></recordVersionFields><recordTimestampFields></recordTimestampFields><syntheticIdentities></syntheticIdentities><syntheticPrimaryKeys></syntheticPrimaryKeys><overridePrimaryKeys></overridePrimaryKeys><dateAsTimestamp>false</dateAsTimestamp><ignoreProcedureReturnValues>false</ignoreProcedureReturnValues><unsignedTypes>true</unsignedTypes><integerDisplayWidths>true</integerDisplayWidths><inputCatalog></inputCatalog><outputCatalogToDefault>false</outputCatalogToDefault><inputSchema></inputSchema><outputSchemaToDefault>false</outputSchemaToDefault><schemaVersionProvider></schemaVersionProvider><catalogVersionProvider></catalogVersionProvider><orderProvider></orderProvider><forceIntegerTypesOnZeroScaleDecimals>true</forceIntegerTypesOnZeroScaleDecimals><logSlowQueriesAfterSeconds>5</logSlowQueriesAfterSeconds><logSlowResultsAfterSeconds>5</logSlowResultsAfterSeconds><properties><property><key>packages</key><value>com.ormtester.jpa.domain</value></property><property><key>useAttributeConverters</key><value>true</value></property><property><key>unqualifiedSchema</key><value>none</value></property><property><key>hibernate.physical_naming_strategy</key><value>org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy</value></property></properties></database></generator>
Exception in thread "main" java.lang.NoSuchMethodError: org.jooq.meta.jaxb.Configuration.getBasedir()Ljava/lang/String;
at org.jooq.codegen.GenerationTool.run0(GenerationTool.java:272)
at org.jooq.codegen.GenerationTool.run(GenerationTool.java:225)
at org.jooq.codegen.GenerationTool.generate(GenerationTool.java:220)
at org.jooq.codegen.GenerationTool.main(GenerationTool.java:192)
However when I will remove the jooq-config.xml file then the error is straigtly telling me that the configuration file cannot be found.
I tried to debug the GenerationTool methods but I cannot find the problematic place. I'm unable to designate the source of the problem, so I'll be grateful for every help from Yours side. Thanks in advance!
Spring boot pulls in a set of default jOOQ library versions, which you can verify using the instructions that you got in the comments (mostly mvn dependency:tree). The error you're getting hints at there being incompatible versions on your classpath.
If your own version differs from that pulled in by spring boot, you might need to tell spring boot not to pull in any jOOQ versions, and pull them all in yourself, e.g. using this approach documented in this blog post here
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jooq</artifactId>
<exclusions>
<exclusion>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
</exclusion>
</exclusions>
</dependency>
Ok, following the tips given by #Lukas and #Lesiak in this topic I have figured out the solution. As You can see in the initial pom's content I have added the jooq-codegen and jooq-meta-extensions keeping the versions 3.13.5 and I was sure that "under the hood" those depencies are holding the same versions of the jooq and jooq-meta libs but unfortunately there were 3.12.3 in both cases. So firstly I have checked the tips that came from #Lukas and then I had to exclude those libs from from the dependencies and add them as the separate dependencies using the right version numbers.
I'm also talking about the jooq (where the initial problem was only with jooq-meta) because after the problem with Configuration class has been resolved, I've faced similar problem with `org.jooq.SQLDialect, as following:
java.lang.NoSuchMethodError:
org.jooq.SQLDialect.supportedBy([Lorg/jooq/SQLDialect;)Ljava/util/Set;
at org.jooq.meta.AbstractDatabase.(AbstractDatabase.java:117)
at java.lang.Class.forName0(Native Method) at
java.lang.Class.forName(Class.java:264) at
org.jooq.codegen.GenerationTool.loadClass0(GenerationTool.java:983)
at org.jooq.codegen.GenerationTool.loadClass(GenerationTool.java:930)
at org.jooq.codegen.GenerationTool.run0(GenerationTool.java:395) at
org.jooq.codegen.GenerationTool.run(GenerationTool.java:225) at
org.jooq.codegen.GenerationTool.generate(GenerationTool.java:220) at
org.jooq.codegen.GenerationTool.main(GenerationTool.java:192)
And as I said it also came with the version mismatch, in this case with jooq.
After all those changes my pom's content is:
<dependencies>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>3.13.5</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta-extensions</artifactId>
<version>3.13.5</version>
<exclusions>
<exclusion>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
</exclusion>
<exclusion>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta</artifactId>
<version>3.13.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen</artifactId>
<version>3.13.5</version>
<exclusions>
<exclusion>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
</exclusion>
<exclusion>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-tools</artifactId>
<version>1.3.1</version>
</dependency>
</dependencies>
And here I can give You a small hint - if You have a tables named with pluralized form and You want fastly depluralize them to keep names of the generated classes singular, You have to add the last depencency from the pom's snippet, create Your own class that extends DefaultGeneratorStrategy and overvrite the getJavaClassName() method's body with the following fragment:
String javaClassName = super.getJavaClassName(definition, mode);
boolean hasRecordSuffix = javaClassName.contains("Record");
javaClassName = javaClassName.replace("Record", "");
String val = nameTools.depluralize(javaClassName);
if (hasRecordSuffix)
val += "Record";
return val;
Then simply add Your custom naming strategy to the xml config. Works like a charm, made using this project:
link
I'm really grateful to You, #Lukas and #Lesiak, thanks for this help!
Related
I was getting this exception
java.lang.NoSuchMethodError: org.apache.xml.security.utils.XMLUtils.decode
Then I updated my dependencies and moved on to another similar exception which I am unable to resolve for quite a while:
I am getting NoSuchMethodError when my module receives the request upon calling this method
WebServiceTemplate client = ...;
client.marshalSendAndReceive(req, new ActionCallback("http://samples/RequestOrder"));
it throws
java.lang.NoSuchMethodError: org.apache.xml.security.encryption.AbstractSerializer: method <init>()V not found
at org.apache.cxf.ws.security.wss4j.StaxSerializer.<init>(StaxSerializer.java:62)
the (at least I think) relevant part of my dependencies
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.6.15</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
<version>3.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>3.3.6</version>
</dependency>
I was looking at multiple versions of org.apache.xml.security.encryption and it doesn't look like any of those versions have such method. Any idea what would be the correct combination of versions?
as a sidenote I also found this library and thought that would be helpful , but it seems it is somewhat different than aforementioned <groupId>org.apache.ws.security</groupId>
<dependency>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j</artifactId>
<version>2.3.0</version>
<type>pom</type>
</dependency>
I had similar issue and tried possible solutions online but to no avail.
Some of the documents suggested that dependency mismatch with other dependencies is key, like here.
In relation to this exact reported error, I kept on changing the version of the below dependency and finally reached this, which was the latest version as at the time this answer was posted.
<dependency>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
<version>2.1.4</version>
</dependency>
But remember to ensure that if you have the below dependency, exclude that of xmlsec :
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
</exclusion>
</exclusions>
</dependency>
Basically, I use Liquibase for most of my Java projects (at least where db migrations are needed) and it worked always on Java 8. I have a requirement now to migrate an existing project to Java 13. The project compiles with the Java 8 and also with Java 13 (see the configuration below), however, Liquibase Maven plug-in (mvn liquibase:diff) throws an ClassLoadingException:
org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [com.mypackage.TestEntity]: Could not load requested class : com.mypackage.TestEntity
here is the plugin configuration in my POM file:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.maven.plugin.version}</version>
<configuration>
<propertyFile>src/main/resources/db-migrations/liquibase/liquibase.properties</propertyFile>
<changeLogFile>src/main/resources/db-migrations/liquibase/db-changelog-master.xml</changeLogFile>
<diffChangeLogFile>${changeset.output.dir}/${timestamp} - ${desc}.xml</diffChangeLogFile>
<logging>info</logging>
</configuration>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate5</artifactId>
<version>${liquibase-hibernate5.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>${springboot.version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${validation-api.version}</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>${javassist.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
</dependencies>
</plugin>
and the liquibase.properties:
url=jdbc:postgresql://localhost:5432/user_registrations
username=postgres
password=somepwd
driver=org.postgresql.Driver
referenceUrl=hibernate:spring:com.mypackage?dialect=org.hibernate.dialect.PostgreSQL9Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
As I mentioned it at the beginning, the Java 13 build doesn't work:
<maven.compiler.release>13</maven.compiler.release>
<java.version>13</java.version>
All dependencies have the latest version.
Any idea what could be an issue here? Thanks for any input...
I'm struggling to get Guice to work with my Jersey/Grizzly classes. I started with console Java app, added Guice and got my injection working as well as my domain objects. Then I proceeded to add webservices through Jersey/Grizzly. As you might be able to tell from my coding style, I've come from a C# background. So I'm sure some of my struggle is learning Javas way of doing things.
What I want is that my non webservices classes can get injected into the webservices handlers so they can use the functionality I've built.
In my class below, I have a database instance handler I want to inject into the webservices classes:
#Path("/options")
public class OptionsServices {
private IDatabaseService dbService;
#Inject
public void setService(IDatabaseService svc){
this.dbService = svc;
}
#GET
#Path("{symbol}")
#Produces(MediaType.APPLICATION_JSON)
public Quote getOptionQuote(#PathParam("symbol") String symbol) {
// do stuff
}
}
I tried adding in GuiceBridge and binding that in my extension of the ResourceConfig class. But no matter what version I used, I get some really crazy exceptions about missing properties when I tried to initialize the webservices. Simply removing GuiceBridge from my pom.xml removes the exception. It seems like its version compatibility problem but I am at a loss to understand what version of what library.
Exception in thread "main" java.lang.NoSuchMethodError: org.glassfish.hk2.utilities.general.GeneralUtilities.getSystemProperty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
at org.jvnet.hk2.internal.ServiceLocatorImpl.<clinit>(ServiceLocatorImpl.java:122)
at org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.initialize(ServiceLocatorGeneratorImpl.java:66)
at org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.create(ServiceLocatorGeneratorImpl.java:98)
at org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.internalCreate(ServiceLocatorFactoryImpl.java:312)
at org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.create(ServiceLocatorFactoryImpl.java:268)
at org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:138)
at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:123)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:308)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:289)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.<init>(GrizzlyHttpContainer.java:334)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory.createHttpServer(GrizzlyHttpServerFactory.java:122)
at Application.Server.WebServer.startServer(WebServer.java:40)
at Application.Server.WebServer.Start(WebServer.java:45)
at Application.Startup.run(Startup.java:68)
at Application.Startup.main(Startup.java:87)
And my pom.xml
<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>
<groupId>tatmancapital</groupId>
<artifactId>ServerConsole</artifactId>
<version>R1</version>
<properties>
<jersey.version>2.17</jersey.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.google.inject/guice -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.9</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>guice-bridge</artifactId>
<version>2.5.0-b32</version>
</dependency>
<dependency>
<groupId>commons-httpclient-ssl-contrib</groupId>
<artifactId>commons-httpclient-ssl-contrib</artifactId>
<version>3.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/commons-httpclient-contrib-ssl-3.1.jar</systemPath>
</dependency>
<dependency>
<groupId>etrade</groupId>
<artifactId>com.etrade.accounts</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/etws-accounts-sdk-1.0.jar</systemPath>
</dependency>
<dependency>
<groupId>etrade</groupId>
<artifactId>com.etrade.order</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/etws-order-sdk-1.0.jar</systemPath>
</dependency>
<dependency>
<groupId>etrade</groupId>
<artifactId>com.etrade.oauth</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/etws-oauth-sdk-1.0.jar</systemPath>
</dependency>
<dependency>
<groupId>etrade</groupId>
<artifactId>com.etrade.markets</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/etws-market-sdk-1.0.jar</systemPath>
</dependency>
<dependency>
<groupId>etrade</groupId>
<artifactId>com.etrade.common</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/etws-common-connections-1.0.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<archive>
<manifest>
<mainClass>Application.Startup</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
<finalName>ServerConsole-V1</finalName>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I apologize I cannot explain this problem with more definitive here's what is wrong. I may have architected my app completely wrong and given this is just me learning, I am ok with that. I would like to avoid rewriting my domain logic construction and unit tests.
Thank you for your help
Matt
Error explanation
A java.lang.NoSuchMethodError is definitely an error with packages and library versions. It means that you have compiled code referencing a method that do not exist in your runtime code.
It's not an error commonly seen in your code because the compiler won't let you pass code referencing a non existent method. But in this case the code referencing the method and the referenced code are both libraries so that means that the code with the method reference was compiled against a different version of the target class.
Somehow this error is analogous to the more common ClassNotFoundException. But instead of not finding a class you are not finding a method inside a class.
Finding the source of your problem
Now you know what the problem is. Solving it, I'm afraid, is not that easy. Package managment and library resolution with Java is becoming harder every year. I see you are using the bom (Bill of Materials) for the Jersey library. Also, your pom file is not an easy one. I suggest you to build a test project only with the structure of your API (jax-rs) code with Guice and the HK2-Guice bridge. Maybe instead of using the BOM try this recent versions, they work for me:
com.google.inject:guice:4.1.0
org.glassfish.jersey.containers:jersey-container-servlet:2.25
org.glassfish.hk2:guice-bridge:2.5.+
I'm using the servlet container but you are using an standalone one. It doesn't matter, use yours but keep the version number.
Maven resolution
Also try to check which version of each package you are including in the final build. You may find useful this maven command to display the dependency tree:
https://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html
I'm dealing with the development of a Java EE project that involves several tools such as jBPM, Hibernate, Resteasy, ect.
In order to manage dependencies, I'm using Maven: my pom.xml is available here.
Now, I'd like to use inside that project QueryDSL 3.4.3 that depends on Google Guava 14.0.1: unfortunately, something imports as dependency Google Collections 1.0 that generates a conflict with Google Guava 14.0.1.
Is it possible to understand where Google Collections is from?
Is there a way to resolve this issue safety? (Now, I'm just removing Google Collections's jar from the deployment folder)
Update
By using the command mvn dependency:tree, I found that Google Collections 1.0 comes from:
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
</dependency>
Now, I've just to understand if it will work well also by excluding google-collections.
See also: http://grepcode.com/.../shrinkwrap-resolver-impl-maven/2.1.1/
As said, Google Collection dependency comes from shrinkwrap-resolver-impl-maven.
I resolved that issue by editing the pom.xml as follows:
<!-- ShrinkWrap Maven Resolver for Arquillian Tests -->
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
Then:
<!-- Arquillian profiles -->
<profiles>
<!-- Arquillian test profile managed by JBoss AS 7 -->
<profile>
<id>arquillian-jbossas-managed</id>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>google-collections</artifactId>
<groupId>com.google.collections</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
</profiles>
Now, it works fine.
I got a strange error in my pom.xml. Maven (I'm using Maven 2) is signaling Missing artifact javax.jws:jsr181:jar:1.0, even if I get the corresponding dependency in my pom.xml:
<dependency>
<groupId>javax.jws</groupId>
<artifactId>jsr181</artifactId>
<version>1.0</version>
</dependency>
What could possibly be the cause of this error?
Ok, I found the solution to the problem. I think the way to find it could be interesting, too.
When I look on mvnrepository.com, the pom file on the repository pointed on an URL on bea.com, which is not available anymore. So I had to change to the maintenance release, like Brian Agnew suggested. And of course, update some other dependencies in my pom.xml, which needed the obsolete version in their own dependencies. Maven comes with a cost...
<!-- https://mvnrepository.com/artifact/javax.jws/jsr181-api -->
<dependency>
<groupId>javax.jws</groupId>
<artifactId>jsr181-api</artifactId>
<version>1.0-MR1</version>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.1-1</version>
<exclusions>
<exclusion>
<groupId>javax.jws</groupId>
<artifactId>jsr181</artifactId>
</exclusion>
</exclusions>
</dependency>
Looking at my repository, I think you want:
<dependency>
<groupId>sun-jaxws</groupId>
<artifactId>jsr181-api</artifactId>
<version>1.0</version>
</dependency>