Problem with #Indexed annotations in hibernate search - hibernate-search

I'm actually trying to deploy HibernateSearch in a J2EE application. I have imported some dependencies I've seen on tuto's :
<!-- HIBERNATE DEPENDENCIES -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${commons-dbcp.version}</version>
</dependency>
<!-- Hibernate Search -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
<version>3.1.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.4.0.GA</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers</artifactId>
<version>3.0.3</version>
</dependency>
My problem is, in order to continue, I need to put the #Indexed annotation in my entity classes but I don't have access to this annotation(Eclipse doesn't know it and of course,that doesn't pass the compilation)
Could you give me some advice or lead ? Maybe I don't have the good dependencies ?

I don't use Eclipse or Maven but I can confirm that in my project that uses Hibernate Search 3.3.0 that the Indexed annotation does definitely exist in the hibernate-search-3.3.0.Final JAR. Try update your dependencies to use the latest JAR. There is definitely nothing else that you need to use this annotation though.

Related

Quarkus runtime does not inject EntityManager

I have tried #PersistenceContext, #PersistenceUnit, and #Inject combinations but nothing works. #Inject fails maven-quarkus-plugin build:
[ERROR] Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type javax.persistence.EntityManager and qualifiers [#Default]
I have tried with and without persistence.xml.
My datasource and application.properties work fine, as I can just inject a AgroalDataSource and do direct JDBC, but I want to port over my JPA Entity classes and use them.
my parent module pom
<!-- versions set by quarkus-bom, but they don't pass in, when changing quarkus version, update this from quarkus bom -->
<properties>
<quarkus.version>1.0.0.CR1</quarkus.version>
<agroal.version>1.7</agroal.version>
<jakarta.enterprise.cdi-api.version>2.0.2</jakarta.enterprise.cdi-api.version>
<jboss-jaxrs-api_2.1_spec.version>2.0.1.Final</jboss-jaxrs-api_2.1_spec.version>
<jboss-logging.version>3.3.2.Final</jboss-logging.version>
<jboss-threads.version>3.0.0.Final</jboss-threads.version>
<smallrye-config.version>1.3.9</smallrye-config.version>
<wildfly-common.version>1.5.0.Final-format-001</wildfly-common.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-universe-bom</artifactId>
<version>${quarkus.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
my pom
<dependencies>
<dependency>
<groupId>com.lmco.is3.cs</groupId>
<artifactId>datatypes</artifactId>
<exclusions>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
</exclusions>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lmco.is3.cs</groupId>
<artifactId>utils</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lmco.is3.nc</groupId>
<artifactId>netcentric-if</artifactId>
<version>1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.spec.javax.websocket</groupId>
<artifactId>jboss-websocket-api_1.1_spec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>io.agroal</groupId>
<artifactId>agroal-api</artifactId>
<version>${agroal.version}</version>
</dependency>
<dependency>
<groupId>io.agroal</groupId>
<artifactId>agroal-narayana</artifactId>
<version>${agroal.version}</version>
</dependency>
<dependency>
<groupId>io.agroal</groupId>
<artifactId>agroal-pool</artifactId>
<version>${agroal.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-config</artifactId>
<version>${smallrye-config.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-agroal</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-artemis-jms</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-postgresql</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jsonb</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>${jboss-logging.version}</version>
</dependency>
<dependency>
<groupId>org.wildfly.common</groupId>
<artifactId>wildfly-common</artifactId>
<version>${wildfly-common.version}</version>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>${jakarta.enterprise.cdi-api.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
<version>${jboss-jaxrs-api_2.1_spec.version}</version>
</dependency>
application.properties
# Configures the Artemis properties.
quarkus.artemis.url=tcp://mq:61616?type=CF
quarkus.artemis.username=artemis
quarkus.artemis.password=simetraehcapa
quarkus.datasource.url=jdbc:postgresql://db:5432/stsdb
quarkus.datasource.driver=org.postgresql.Driver
quarkus.datasource.username=appuser
quarkus.datasource.password=appuser
quarkus.resteasy.gzip.enabled=true
quarkus.resteasy.gzip.max-input=10M
quarkus.log.category."com.lmco.is3.nc.micro.clock".level=INFO
I figured it out! Not real "intuitive", but I had not migrated over any Entity classes yet. All it took was to put one class in scope and everything started working. So much for simple prototyping. Maybe it should have warned "no entity classes found".
Friend, I had the same problem. Here's what I did that worked for me, I hope to help you:
added on application.properties
quarkus.hibernate-orm."db".packages = packages with their entities
example:
quarkus.hibernate-orm."db".packages=br.com.application.base.models
in my repositories:
#ApplicationScoped
#ActivateRequestContext
public class HeaderRepository {
#PersistenceUnit("db")
EntityManager entityManager;
I hope to help you
following documentation: https://quarkus.io/guides/hibernate-orm
thanks

Maven using wrong version of javax.validation

I have a dynamic web project I have been working on that uses hibernate as a jpa provider. Up until the last week, I could insert, update, query, and delete from my databases using hibernate. Recently, I began working on validation, and brought in a lot of different maven dependencies. In the course of doing this, I somehow have ended up with my project using an older, deprecated version of javax.validation jar, which throws a no such method exception. I have included the relevant lines of the stack trace below:
Caused by: java.lang.NoSuchMethodError: javax.validation.BootstrapConfiguration.getClockProviderClassName()Ljava/lang/String;
at org.hibernate.validator.internal.xml.ValidationBootstrapParameters.<init>(ValidationBootstrapParameters.java:63)
However, in my pom.xml I have the following dependency (which, when examined via javap and through eclipse, it has the method getClockProviderClassName() in the specified class):
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.0.Final</version>
</dependency>
I put the following exclusion tag in my pom in multiple dependencies to try and ensure that it does not pull this jar from other sources:
<exclusion>
<artifactId>validation-api</artifactId>
<groupId>javax.validation</groupId>
</exclusion>
I have also simplified my build path, so there is three elements in it: one properties folder that contains only my log4j configuration, the JRE System library (version 1.8) and maven dependencies. Is there any way to tell where the deprecated javax.validation jar is coming from? Can I force the program to use version 2.0.0 I bring in with maven? Thank you for your help.
Additional Information:
full stack trace
persistence.xml source
working datasource properties
Java Build Path
Line where root exception occurs (in my code)
look inside the included jar to see it contains the method
using javap to examine artifact in maven (m2) directory
dependency overview from maven
Dependencies from pom.xml
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.0.2.RELEASE</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.2.Final</version>
<exclusions>
<exclusion>
<artifactId>jboss-logging</artifactId>
<groupId>org.jboss.logging</groupId>
</exclusion>
<exclusion>
<artifactId>validation-api</artifactId>
<groupId>javax.validation</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.10.0</version>
</dependency>
<!-- https://stackoverflow.com/questions/20859379/cannot-import-javax-ejb-packages -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jboss.logging/jboss-logging -->
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.3.0.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.ejb/ejb-api -->
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0-alpha-1</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.3</version>
</dependency>
<!-- ********************************************************************************************************** -->
<!-- THE FOLLOWING ARE SEPERATE FROM HIBERNATE THAT IS USED TO CONNECT
TO DB, THESE ARE FOR USE WITH VALIDATION -->
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.7.Final</version>
<exclusions>
<exclusion>
<artifactId>validation-api</artifactId>
<groupId>javax.validation</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator-annotation-processor -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
<version>6.0.7.Final</version>
<exclusions>
<exclusion>
<artifactId>validation-api</artifactId>
<groupId>javax.validation</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-cdi</artifactId>
<version>6.0.7.Final</version>
<exclusions>
<exclusion>
<artifactId>validation-api</artifactId>
<groupId>javax.validation</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.0.Final</version>
</dependency>
<!-- ********************************************************************************************************** -->
<!-- API and reference implementation of expression language {a.b} in html
code -->
<!-- https://mvnrepository.com/artifact/javax.el/javax.el-api -->
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.web/javax.el -->
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>2.2.6</version>
</dependency>
</dependencies>
Try adding this dependency to your pom.xml
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
The situation is provoked by having javaee-web-api 7.0 as dependency:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
This dependency provided by your servlet or application container at runtime is giving you an older api for javax.validation.
You have two things to try:
Change the version of javaee-web-api to 8.0
This is the fastest solution if you are deploying your web app to a servlet or application container that supports Java EE 8.0 (for example: it seems to work in Tomcat 8.5.X but reading the documentation, only Tomcat 9 provides support for Java EE 8).
Keep javaee-web-api as 7.0 and downgrade hibernate-validator, validation-api dependencies:
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
<version>5.4.2.Final</version>
</dependency>
You have to change also some imports such as #Email or #NotEmpty from javax.validation package to org.hibernate.validator.constraints (those annotations are Deprecated in 6.0.X hibernate-validator versions because they're included inside javax.validation api).
Do mvn dependency:tree , May you have another dependencies that use hibernate-annotations, and conflict with your spring version, also you can find them and exclude from class path, as below:
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
</exclusion>
</exclusions>
I hopefully help you.
Had the same problem with Springboot 2.1.4.RELEASE and some GeoTools dependencies.
Validation-api was specified from javax.validation and javaee-api jars.
Put them as dependencies like following:
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
Had the same issue as jekho, but solved it with:
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-referencing</artifactId>
<version>22.3</version>
<exclusions>
<exclusion>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
</exclusion>
</exclusions>
</dependency>
I found which dependency was using javaee-api by using maven's dependency:tree on my project which points out which packages are being used by which dependency.

Adding rampart.mar to classpath via Maven

I have been trying to find a solution for this for several days, but with no avail.
I'm currently in the process of introducing Maven to some of my Java projects. One of them requires Axis2 and Rampart for WS Security.
I added all Axis2 and Rampart dependencies in pom.xml:
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart-core</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart-policy</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart-trust</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart</artifactId>
<version>1.5.2</version>
<type>mar</type>
</dependency>
When I import the project in Eclipse, rampart.mar is not there, and attempting to engage the rampart module on runtime causes a failure.
However, when I use maven-dependency-plugin to copy all dependencies to a specific repository, I see that the rampart mar file is there!
This makes me believe that this is a limitation in the Eclipse m2e plugin. Anyone stumbled upon this one before? I saw several similar questions on Stackoverflow that were left unanswered.

Eclipse STS Hibernate error: "Fetching children of Database". org.slf4j.spi.LocationAwareLogger.log

I have looked and tried various solutions dealing with the SLF4J related issue but nothing has worked. All I am trying to do is use the Hibernate plug in inside STS. I Simply click on the Hibernate perspective, Then the down arrow on my project and down arrow on the Database and this exception occurs.
I saw in the properties of the Hibernate console that there is an Eclipse log file dir to a logback. Do I have to setup logback in my pom somewhere?
I used my setup from eclipse tutorials I found online. The only difference is that I'm using the specific STS version and a more recent version of Spring and Hibernate. I have setup the hibernate conifig and the console config.
Any help to get this Hibernate plugin working correctly with Logging using Maven would be really appreciated. Thanks in advance!!
The following is my setup:
STS v3.2, MySQL DB, vFabric Server (comes with STS), Using Maven
POM versions:
<java-version>1.6</java-version>
<spring.version>3.2.2.RELEASE</spring.version>
<spring.security.version>3.1.3.RELEASE</spring.security.version>
<org.aspectj-version>1.6.10</org.aspectj-version>
<org.slf4j-version>1.7.2</org.slf4j-version>
<org.apache.tiles>2.2.2</org.apache.tiles>
<mysql>5.1.24</mysql>
<hibernate.version>4.1.5.Final</hibernate.version>
<junit.version>4.11</junit.version>
Spring, Hibernate & Logging sections:
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- Saw this fix online and was trying - doesn't work, temp commented out
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.1.Final</version>
<exclusions>
Exclude SLF4j to avoid version conflicts (we have 1.6.2, this drags in 1.6.1)
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.0.1.Final</version>
<classifier>tests</classifier>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
END Saw this fix online and was trying - doesn't work, temp commented out -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>provided</scope>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.1.0.CR2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
Below is the stack trace:
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:133)
at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.getTables(JDBCMetaDataDialect.java:26)
at org.hibernate.cfg.reveng.JDBCReader.processTables(JDBCReader.java:476)
at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:74)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$2.execute(LazyDatabaseSchemaWorkbenchAdapter.java:126)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:115)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:65)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:106)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Thanks! I actually ended up just commenting out logging for a couple minutes while I let the Hibernate reveng tool do its thing. Per this post forum.hibernate.org/viewtopic.php?p=2441023 I then readded them after and all is well! :D –
The NoSuchMethodError on LocationAwareLogger.log() method with 6 arguments is symptomatic of a slf4j binding with version prior to 1.6 on the class path. The 'mvn dependency:tree' should indicate as much, i.e that you have an older binding, say slf4j-log4j-1.5.jar.

GWT validation (JSR 303) SampleValidatorFactory

I try to use bean validation in GWT. I follow this guide :
https://developers.google.com/web-toolkit/doc/latest/DevGuideValidation
At compile time, I have the following error :
ERROR: Could not load deferred binding result type 'com.google.gwt.sample.validation.client.SampleValidatorFactory'
I can make it working if I include this dependency:
<dependency>
<groupId>com.googlecode.gwt-validation</groupId>
<artifactId>gwt-validation</artifactId>
<version>2.1</version>
</dependency>
But I find it weird because this dependency is not mentionned in the guide.
Question : As GWT 2.5 is supposed to support bean validation, why do I need this additional library? What am I doing wrong?
I am using GWT 2.5.0
My pom.xml contains the following dependencies :
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.1.Final</version>
<type>jar</type>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.1.Final</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<type>jar</type>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<type>jar</type>
</dependency>
and my gwt.xml contains the following lines :
<inherits name="org.hibernate.validator.HibernateValidator" />
<replace-with
class="com.google.gwt.sample.validation.client.SampleValidatorFactory">
<when-type-is class="javax.validation.ValidatorFactory" />
</replace-with>
In the code, I get the Validator in this way :
import javax.validation.Validator;
...
private static final Validator VALIDATOR= Validation.buildDefaultValidatorFactory().getValidator();
You are mixing a third party library gwt-validation with Native GWT Validation.
The gwt-validation is not from official gwt team or google. You should not be using following in your pom if you intend to stick to native gwt validation support.
<dependency>
<groupId>com.googlecode.gwt-validation</groupId>
<artifactId>gwt-validation</artifactId>
<version>2.1</version>
</dependency>
Also note that you have native gwt hibernate validator support upto 4.1.0 only. GWT Sample usage. GWT native hibernate validator source code.
And you can include it as
<!-- Hibernate bean validation binary for the server -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
<exclusions>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Hibernate bean validation source for the GWT client -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
<classifier>sources</classifier>
<exclusions>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Required by Hibernate validator because slf4j-log4j is
optional in the hibernate-validator POM
-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>