edit: this is long. short version: I probably screwed up installing things or am forgetting something. Could you look below to see if you spot any inconsistencies?
Hello. After a long day of having nothing work, I turn to the Hibernate community. I hope you guys can point out whatever I've done that's wrong. My guess is that it's going to be something really, really simple.
Here's the deal, trying to just get a simple hibernate search going. I used the archetype found
here which is as follows:
Code:
mvn archetype:generate -DarchetypeGroupId=org.hibernate -DarchetypeArtifactId=hibernate-search-quickstart -DarchetypeVersion=4.0.0-SNAPSHOT -DarchetypeRepository=http://repository.jboss.org/nexus/content/groups/public-jboss/
I then installed jars, and modified poms, and so on and so forth until eclipse stopped complaining about errors. This took several hours more than I feel like it should have.
when I run mvn install, here are the messages I get:
Code:
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.hibernate:MySearch:jar:4.0.0.CR2
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-deploy-plugin is missing. @ line 116, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 108, column 21
[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 Hibernate Search Quickstart 4.0.0.CR2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ MySearch ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ MySearch ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ MySearch ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ MySearch ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.7.1:test (default-test) @ MySearch ---
[INFO] Surefire report directory: C:\Users\556174\Desktop\mvn_test\Hsearch\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running NewSearch.IndexAndSearchTest
Dec 8, 2011 4:50:14 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Dec 8, 2011 4:50:14 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.0.0.CR7}
Dec 8, 2011 4:50:14 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Dec 8, 2011 4:50:14 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Dec 8, 2011 4:50:14 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Dec 8, 2011 4:50:14 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
Dec 8, 2011 4:50:14 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: true
Dec 8, 2011 4:50:14 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [org.hsqldb.jdbcDriver] at URL [jdbc:hsqldb:.]
Dec 8, 2011 4:50:14 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=sa, password=****, autocommit=true, release_mode=auto}
Dec 8, 2011 4:50:14 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
Dec 8, 2011 4:50:15 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory
Dec 8, 2011 4:50:15 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Dec 8, 2011 4:50:15 PM org.hibernate.search.Version <clinit>
INFO: HSEARCH000034: Hibernate Search 4.0.0.CR2
Dec 8, 2011 4:50:15 PM org.hibernate.search.impl.ConfigContext getLuceneMatchVersion
WARN: HSEARCH000075: Configuration setting hibernate.search.lucene_version was not specified, using LUCENE_CURRENT.
Dec 8, 2011 4:50:15 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Dec 8, 2011 4:50:15 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
Dec 8, 2011 4:50:15 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: true
Dec 8, 2011 4:50:15 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [org.hsqldb.jdbcDriver] at URL [jdbc:hsqldb:.]
Dec 8, 2011 4:50:15 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=sa, password=****, autocommit=true, release_mode=auto}
Dec 8, 2011 4:50:15 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
Dec 8, 2011 4:50:15 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory
Dec 8, 2011 4:50:15 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Dec 8, 2011 4:50:15 PM org.hibernate.search.impl.ConfigContext getLuceneMatchVersion
WARN: HSEARCH000075: Configuration setting hibernate.search.lucene_version was not specified, using LUCENE_CURRENT.
Tests run: 4, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 1.179 sec <<< FAILURE!
Results :
Tests in error:
testIndexAndSearch(NewSearch.IndexAndSearchTest)
testIndexAndSearch(NewSearch.IndexAndSearchTest)
testStemming(NewSearch.IndexAndSearchTest)
testStemming(NewSearch.IndexAndSearchTest)
Tests run: 4, Failures: 0, Errors: 4, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.595s
[INFO] Finished at: Thu Dec 08 16:50:15 EST 2011
[INFO] Final Memory: 9M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.7.1:test (default-test) on project MySearch: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\556174\Desktop\mvn_test\Hsearch\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
the errors from testindexandsearch are all similar (full text
here, snippet follows):
Code:
-------------------------------------------------------------------------------
Test set: NewSearch.IndexAndSearchTest
-------------------------------------------------------------------------------
Tests run: 4, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 1.179 sec <<< FAILURE!
testIndexAndSearch(NewSearch.IndexAndSearchTest) Time elapsed: 1.076 sec <<< ERROR!
java.lang.NoSuchMethodError: org.apache.lucene.analysis.SimpleAnalyzer.<init>(Lorg/apache/lucene/util/Version;)V
at org.hibernate.search.store.impl.DirectoryProviderHelper.initializeIndexIfNeeded(DirectoryProviderHelper.java:155)
The initialization seems to be coming from this snippet of code:
Code:
private void initHibernate() {
Ejb3Configuration config = new Ejb3Configuration();
config.configure( "hibernate-search-example", new HashMap() );
emf = config.buildEntityManagerFactory();
em = emf.createEntityManager();
}
Which eclipse complains about being deprecated, but... I have no idea what to replace it with. If anything?
now, I feel like some of my issues are coming from my persistence.xml document:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Persistence deployment descriptor for dev profile -->
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="hibernate-search-example">
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.connection.url" value="jdbc:hsqldb:hsql://localhost/tutorial"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<!-- optional -->
<property name="hibernate.search.default.directory_provider" value="filesystem"/>
<property name="hibernate.search.default.indexBase" value="C:/Users/[myusername]/Desktop/luceneIndexes"/>
</properties>
</persistence-unit>
</persistence>
it seems to connect to the database ok. however, the folder luceneIndexes is only created if my directory_provider is set to "filesystem". If I change it to "org.hibernate.search.store.FSDirectoryProvider", the directory is never created. Either way, nothing is ever inside of this folder.
I hate setting up environments, so it's entirely possible that I've screwed everything up when I installed hibernate, or hibernate-search, or hsqldb, or any myriad of things. I installed by navigating to the java lib/ext/ directory, and just plopping the jars in there. I would have added them to the classpath, but eclipse didn't seem to notice that they were there when I did. Probably because I did something wrong.
Additionally, I have hsqldb server running in the background: is there anything else I should have running? If that turns out to be the case, I'm going to be very annoyed at myself.
Finally: I'm on windows 7 x64.
Ugh. hope you can help, and thank you.
edit:
Here's someone else with the same error message (no method init).