sanne.grinovero wrote:
To anyone reading this: Samuel ended up sharing his test on JIRA
https://hibernate.onjira.com/browse/HSEARCH-1265
Where I explained how to manage dependencies on AS7 more effectively.
Hi Thank you very much for your prompt review of the issue.
I have followed your advise and removed the previous error.
After further remove the Lucene modules from the pom.xml and redeploy the module, jboss thrown another exception:
Quote:
22:51:20,963 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "HibernateSearchTest-ear-1.0.ear"
22:51:22,628 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "HibernateSearchTest-ejb-1.0.jar"
22:51:22,628 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "HibernateSearchTest-web-1.0.war"
22:51:22,635 INFO [org.jboss.as.jpa] (MSC service thread 1-5) JBAS011401: Read persistence.xml for HibernateSeasrchTestPU
22:51:22,749 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named MyisamProductArticleFacade in deployment unit subdeployment "HibernateSearchTest-ejb-1.0.jar" of deployment "HibernateSearchTest-ear-1.0.ear" are as follows:
java:global/HibernateSearchTest-ear-1.0/HibernateSearchTest-ejb-1.0/MyisamProductArticleFacade!HibernateSearch.entity.facade.MyisamProductArticleFacadeLocal
java:app/HibernateSearchTest-ejb-1.0/MyisamProductArticleFacade!HibernateSearch.entity.facade.MyisamProductArticleFacadeLocal
java:module/MyisamProductArticleFacade!HibernateSearch.entity.facade.MyisamProductArticleFacadeLocal
java:global/HibernateSearchTest-ear-1.0/HibernateSearchTest-ejb-1.0/MyisamProductArticleFacade
java:app/HibernateSearchTest-ejb-1.0/MyisamProductArticleFacade
java:module/MyisamProductArticleFacade
22:51:22,765 INFO [org.jboss.as.jpa] (MSC service thread 1-7) JBAS011402: Starting Persistence Unit Service 'HibernateSearchTest-ear-1.0.ear/HibernateSearchTest-ejb-1.0.jar#HibernateSeasrchTestPU'
22:51:22,800 INFO [org.jboss.web] (MSC service thread 1-3) JBAS018210: Registering web context: /HibernateSearchTest-web
22:51:22,849 INFO [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-7) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
22:51:22,855 INFO [org.hibernate.dialect.Dialect] (MSC service thread 1-7) HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
22:51:22,858 INFO [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-7) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
22:51:22,859 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-7) HHH000397: Using ASTQueryTranslatorFactory
22:51:22,880 INFO [org.hibernate.search.Version] (MSC service thread 1-7) HSEARCH000034: Hibernate Search 4.2.0.Final
22:51:22,893 WARN [org.hibernate.search.impl.ConfigContext] (MSC service thread 1-7) HSEARCH000075: Configuration setting hibernate.search.lucene_version was not specified, using LUCENE_CURRENT.
22:51:23,006 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.persistenceunit."HibernateSearchTest-ear-1.0.ear/HibernateSearchTest-ejb-1.0.jar#HibernateSeasrchTestPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."HibernateSearchTest-ear-1.0.ear/HibernateSearchTest-ejb-1.0.jar#HibernateSeasrchTestPU": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]
Caused by: org.hibernate.search.SearchException: HSEARCH000159: Cannot find a Coordinates Interface nor Lat/Long annotations bound to default @Spatial for class HibernateSearch.entity.MyisamProductArticle
at org.hibernate.search.engine.spi.AbstractDocumentBuilder.bindSpatialAnnotation(AbstractDocumentBuilder.java:1038)
at org.hibernate.search.engine.spi.AbstractDocumentBuilder.initializeClassLevelAnnotations(AbstractDocumentBuilder.java:462)
at org.hibernate.search.engine.spi.AbstractDocumentBuilder.initializeClass(AbstractDocumentBuilder.java:376)
at org.hibernate.search.engine.spi.AbstractDocumentBuilder.<init>(AbstractDocumentBuilder.java:174)
at org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity.<init>(DocumentBuilderIndexedEntity.java:179)
at org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:422)
at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:222)
at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:146)
at org.hibernate.search.event.impl.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:130)
at org.hibernate.search.hcore.impl.HibernateSearchIntegrator.integrate(HibernateSearchIntegrator.java:83)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:303)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1750)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
... 3 more
22:51:23,213 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "HibernateSearchTest-ear-1.0.ear" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"HibernateSearchTest-ear-1.0.ear/HibernateSearchTest-ejb-1.0.jar#HibernateSeasrchTestPU\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"HibernateSearchTest-ear-1.0.ear/HibernateSearchTest-ejb-1.0.jar#HibernateSeasrchTestPU\": Failed to start service"}}
22:51:23,224 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment HibernateSearchTest-ejb-1.0.jar in 11ms
22:51:23,225 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment HibernateSearchTest-web-1.0.war in 11ms
22:51:23,249 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment HibernateSearchTest-ear-1.0.ear in 36ms
22:51:23,250 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.persistenceunit."HibernateSearchTest-ear-1.0.ear/HibernateSearchTest-ejb-1.0.jar#HibernateSeasrchTestPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."HibernateSearchTest-ear-1.0.ear/HibernateSearchTest-ejb-1.0.jar#HibernateSeasrchTestPU": Failed to start service
22:51:23,251 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"HibernateSearchTest-ear-1.0.ear/HibernateSearchTest-ejb-1.0.jar#HibernateSeasrchTestPU\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"HibernateSearchTest-ear-1.0.ear/HibernateSearchTest-ejb-1.0.jar#HibernateSeasrchTestPU\": Failed to start service"}}}}
This is the entity class:
Code:
package HibernateSearch.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.solr.analysis.LowerCaseFilterFactory;
import org.apache.solr.analysis.SnowballPorterFilterFactory;
import org.apache.solr.analysis.StandardTokenizerFactory;
import org.apache.solr.analysis.SynonymFilterFactory;
import org.hibernate.search.annotations.Analyzer;
import org.hibernate.search.annotations.AnalyzerDef;
import org.hibernate.search.annotations.Boost;
import org.hibernate.search.annotations.DateBridge;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Latitude;
import org.hibernate.search.annotations.Longitude;
import org.hibernate.search.annotations.Parameter;
import org.hibernate.search.annotations.Resolution;
import org.hibernate.search.annotations.Spatial;
import org.hibernate.search.annotations.SpatialMode;
import org.hibernate.search.annotations.Store;
import org.hibernate.search.annotations.TokenFilterDef;
import org.hibernate.search.annotations.TokenizerDef;
/**
*
* @author sam
*/
@Entity
@Table(name = "myisam_product_article", catalog = "hibernatedb", schema = "")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "MyisamProductArticle.findAll", query = "SELECT m FROM MyisamProductArticle m"),
@NamedQuery(name = "MyisamProductArticle.findByArticleId", query = "SELECT m FROM MyisamProductArticle m WHERE m.articleId = :articleId"),
@NamedQuery(name = "MyisamProductArticle.findByLat", query = "SELECT m FROM MyisamProductArticle m WHERE m.lat = :lat"),
@NamedQuery(name = "MyisamProductArticle.findByLon", query = "SELECT m FROM MyisamProductArticle m WHERE m.lon = :lon"),
@NamedQuery(name = "MyisamProductArticle.findByCreationDate", query = "SELECT m FROM MyisamProductArticle m WHERE m.creationDate = :creationDate")})
@Spatial(spatialMode = SpatialMode.GRID)
//This annotation tells hibernate search that this class has to be indexed
@Indexed(index = "MyisamProductArticle")
@Analyzer(impl = org.apache.lucene.analysis.standard.StandardAnalyzer.class)
@AnalyzerDef(name = "customanalyzer", tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class),
filters = {@TokenFilterDef(factory = LowerCaseFilterFactory.class),
@TokenFilterDef(factory = SnowballPorterFilterFactory.class, params = {
@Parameter(name = "language", value = "English"),
}),
@TokenFilterDef(factory = SynonymFilterFactory.class, params = {
@Parameter(name = "ignoreCase", value = "true"),
@Parameter(name = "expand", value = "true"),
@Parameter(name = "synonyms", value="syntest.txt")})
})
public class MyisamProductArticle implements Serializable, Comparable<MyisamProductArticle> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "article_id")
private Integer articleId;
@Lob
@Size(max = 65535)
@Column(name = "a_desc")
@Analyzer(definition = "customanalyzer")
@Field(index = Index.YES, store = Store.YES)
private String aDesc;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Column(name = "lat")
@Latitude(of="location")
private Double lat;
@Column(name = "lon")
@Longitude(of="location")
private Double lon;
@Column(name = "creation_date")
@Temporal(TemporalType.DATE)
private Date creationDate;
public MyisamProductArticle() {
}
public MyisamProductArticle(Integer articleId) {
this.articleId = articleId;
}
public Integer getArticleId() {
return articleId;
}
public void setArticleId(Integer articleId) {
this.articleId = articleId;
}
public String getADesc() {
return aDesc;
}
public void setADesc(String aDesc) {
this.aDesc = aDesc;
}
public Double getLat() {
return lat;
}
public void setLat(Double lat) {
this.lat = lat;
}
public Double getLon() {
return lon;
}
public void setLon(Double lon) {
this.lon = lon;
}
public Date getCreationDate() {
return creationDate;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
@Override
public int hashCode() {
int hash = 0;
hash += (articleId != null ? articleId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof MyisamProductArticle)) {
return false;
}
MyisamProductArticle other = (MyisamProductArticle) object;
if ((this.articleId == null && other.articleId != null) || (this.articleId != null && !this.articleId.equals(other.articleId))) {
return false;
}
return true;
}
// default comparator on Date
@Override
public int compareTo(MyisamProductArticle compareArticle) {
//ascending order
return this.creationDate.compareTo(compareArticle.creationDate);
//descending order
//return compareAritcle.compareTo(this.creationDate.creationDate);
}
@Override
public String toString() {
return "HibernateSearch.entity.MyisamProductArticle[ articleId=" + articleId + " ]";
}
}
Thank you for your time again.
Samuel