SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye

Welcome, Guest
Guest Settings
Help

Compass Support Forums » Compass » Compass Users

Thread: Creating index table for Spring/Compass using JDBC store

This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 27 - Pages: 2 [ 1 2 | Next ] - Last Post: Dec 12, 2011 7:18 PM Last Post By: anitas
Lei Jin

Posts: 14
Registered: 2/13/07
Creating index table for Spring/Compass using JDBC store
Posted: Jul 15, 2007 1:56 AM
 
  Click to reply to this thread Reply
Hello, I'm trying to set up JDBC store with Spring/Hibernate. I have previously used the Filestore and it worked great. Here is the exception I'm getting on starting up tomcat.

java.sql.SQLException: Base table or view not found message from server: "Table
'mydb.index_user' doesn't exist"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2001)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2281)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:
1634)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewPr
oxyPreparedStatement.java:76)
at org.apache.lucene.store.jdbc.support.JdbcTemplate.executeSelect(JdbcT
emplate.java:107)
at org.apache.lucene.store.jdbc.handler.AbstractFileEntryHandler.fileExi
sts(AbstractFileEntryHandler.java:59)
at org.apache.lucene.store.jdbc.JdbcDirectory.fileExists(JdbcDirectory.j
ava:322)
at org.apache.lucene.index.IndexReader.indexExists(IndexReader.java:342)

at org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore.
indexExists(AbstractLuceneSearchEngineStore.java:232)
at org.compass.core.lucene.engine.store.JdbcLuceneSearchEngineStore.inde
xExists(JdbcLuceneSearchEngineStore.java:267)
at org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore$
2.doWithStore(AbstractLuceneSearchEngineStore.java:222)
at org.compass.core.lucene.engine.store.LuceneStoreTemplate.execute(Luce
neStoreTemplate.java:43)
at org.compass.core.lucene.engine.store.LuceneStoreTemplate.executeForSu
bIndex(LuceneStoreTemplate.java:37)
at org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore.
indexExists(AbstractLuceneSearchEngineStore.java:219)
at org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore.
verifyIndex(AbstractLuceneSearchEngineStore.java:239)
at org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore.
verifyIndex(AbstractLuceneSearchEngineStore.java:255)
at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndex
Manager.verifyIndex(DefaultLuceneSearchEngineIndexManager.java:89)
at org.compass.core.impl.DefaultCompass$TransactionalSearchEngineIndexMa
nager$2.doInCompass(DefaultCompass.java:293)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:134)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:117)
at org.compass.core.impl.DefaultCompass$TransactionalSearchEngineIndexMa
nager.verifyIndex(DefaultCompass.java:291)
at org.compass.core.lucene.engine.manager.ScheduledLuceneSearchEngineInd
exManager.verifyIndex(ScheduledLuceneSearchEngineIndexManager.java:98)
at org.compass.core.impl.DefaultCompass.<init>(DefaultCompass.java:147)
at org.compass.core.impl.DefaultCompass.<init>(DefaultCompass.java:102)
at org.compass.core.impl.DefaultCompass.<init>(DefaultCompass.java:95)
at org.compass.core.config.CompassConfiguration.buildCompass(CompassConf
iguration.java:191)
at org.compass.spring.LocalCompassBean.newCompass(LocalCompassBean.java:
332)
at org.compass.spring.LocalCompassBean.afterPropertiesSet(LocalCompassBe
an.java:322)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1059)

Here is my configuration:

<bean id="compass" class="org.compass.spring.LocalCompassBean">
<property name="resourceLocations">
<list>
<value>classpath:com/mydb/web/mvc/model/user/User.cmd.xml</value>
<value>classpath:User.cpm.xml</value>
</list>
</property>

<property name="dataSource"><ref bean="dataSource"/></property>
<property name="compassSettings">
<props>
<prop key="compass.engine.connection">jdbc://</prop>
<prop key="compass.engine.store.jdbc.managed">true</prop>
<prop key="compass.engine.store.jdbc.dialect">org.apache.lucene.store.jdbc.dialect.MySQLInnoDBDialect</prop>
<prop key="compass.transaction.factory">org.compass.spring.transaction.SpringSyncTransactionFactory</prop>
</props>
</property>

<property name="transactionManager">
<ref local="transactionManager" />
</property>
</bean>
<bean id="hibernateGpsDevice" class="org.compass.spring.device.hibernate.SpringHibernate3GpsDevice">
<property name="name"><value>hibernateDevice</value></property>
<property name="sessionFactory"><ref local="sessionFactory" /></property>
</bean>
<bean id="compassGps" class="org.compass.gps.impl.SingleCompassGps" init-method="start" destroy-method="stop">
<property name="compass"><ref bean="compass" /></property>
<property name="gpsDevices">
<list>
<bean class="org.compass.spring.device.SpringSyncTransactionGpsDeviceWrapper">
<property name="gpsDevice" ref="hibernateGpsDevice" />
</bean>
</list>
</property>
</bean>
<bean id="c3p0DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${jdbc.driverClassName}"/>
<property name="jdbcUrl" value="${jdbc.url}"/>
<property name="user" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>

<bean id="dataSource" class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
<property name="targetDataSource" ref="c3p0DataSource"/>
</bean>

There must be a really simple thing that I'm missing, but I've been trying to find out for hours. Can someone help? Thanks.
Lei Jin

Posts: 14
Registered: 2/13/07
Re: Creating index table for Spring/Compass using JDBC store
Posted: Jul 15, 2007 6:15 PM   in response to: Lei Jin in response to: Lei Jin
 
  Click to reply to this thread Reply
I did some more research and found this other exception.

java.sql.SQLException: Data too long for column 'deleted_' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2001)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2281)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java
:1825)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java
:1667)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewP
roxyPreparedStatement.java:105)
at org.apache.lucene.store.jdbc.support.JdbcTemplate.executeUpdate(JdbcT
emplate.java:159)
at org.apache.lucene.store.jdbc.lock.PhantomReadLock.obtain(PhantomReadL
ock.java:66)
at org.apache.lucene.store.Lock.obtain(Lock.java:63)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:254)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:244)
at org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore$
1.doWithStore(AbstractLuceneSearchEngineStore.java:210)
at org.compass.core.lucene.engine.store.LuceneStoreTemplate.execute(Luce
neStoreTemplate.java:43)
at org.compass.core.lucene.engine.store.LuceneStoreTemplate.executeForSu
bIndex(LuceneStoreTemplate.java:37)
at org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore.
createIndex(AbstractLuceneSearchEngineStore.java:208)
at org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore.
verifyIndex(AbstractLuceneSearchEngineStore.java:240)
at org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore.
verifyIndex(AbstractLuceneSearchEngineStore.java:255)
at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndex
Manager.verifyIndex(DefaultLuceneSearchEngineIndexManager.java:89)
at org.compass.core.impl.DefaultCompass$TransactionalSearchEngineIndexMa
nager$2.doInCompass(DefaultCompass.java:293)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:134)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:117)
at org.compass.core.impl.DefaultCompass$TransactionalSearchEngineIndexMa
nager.verifyIndex(DefaultCompass.java:291)
at org.compass.core.lucene.engine.manager.ScheduledLuceneSearchEngineInd
exManager.verifyIndex(ScheduledLuceneSearchEngineIndexManager.java:98)
at org.compass.core.impl.DefaultCompass.<init>(DefaultCompass.java:147)
at org.compass.core.impl.DefaultCompass.<init>(DefaultCompass.java:102)
at org.compass.core.impl.DefaultCompass.<init>(DefaultCompass.java:95)
at org.compass.core.config.CompassConfiguration.buildCompass(CompassConf
iguration.java:191)
at org.compass.spring.LocalCompassBean.newCompass(LocalCompassBean.java:
332)
at org.compass.spring.LocalCompassBean.afterPropertiesSet(LocalCompassBe
an.java:322)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1059)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:363)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveReference(BeanDefinitionValueResolver.java:176)
Lei Jin

Posts: 14
Registered: 2/13/07
Re: Creating index table for Spring/Compass using JDBC store
Posted: Jul 15, 2007 9:34 PM   in response to: Lei Jin in response to: Lei Jin
 
  Click to reply to this thread Reply
There's also this exception in case it is useful.

java.io.IOException: Lock obtain timed out: PhantomReadLock[write.lock/index_pli
ck]
at org.apache.lucene.store.Lock.obtain(Lock.java:56)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:254)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:244)
at org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore$
1.doWithStore(AbstractLuceneSearchEngineStore.java:210)
at org.compass.core.lucene.engine.store.LuceneStoreTemplate.execute(Luce
neStoreTemplate.java:43)
at org.compass.core.lucene.engine.store.LuceneStoreTemplate.executeForSu
bIndex(LuceneStoreTemplate.java:37)
at org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore.
createIndex(AbstractLuceneSearchEngineStore.java:208)
at org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore.
verifyIndex(AbstractLuceneSearchEngineStore.java:240)
at org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore.
verifyIndex(AbstractLuceneSearchEngineStore.java:255)
at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndex
Manager.verifyIndex(DefaultLuceneSearchEngineIndexManager.java:89)
at org.compass.core.impl.DefaultCompass$TransactionalSearchEngineIndexMa
nager$2.doInCompass(DefaultCompass.java:293)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:134)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:117)
at org.compass.core.impl.DefaultCompass$TransactionalSearchEngineIndexMa
nager.verifyIndex(DefaultCompass.java:291)
at org.compass.core.lucene.engine.manager.ScheduledLuceneSearchEngineInd
exManager.verifyIndex(ScheduledLuceneSearchEngineIndexManager.java:98)
at org.compass.core.impl.DefaultCompass.<init>(DefaultCompass.java:147)
at org.compass.core.impl.DefaultCompass.<init>(DefaultCompass.java:102)
at org.compass.core.impl.DefaultCompass.<init>(DefaultCompass.java:95)
at org.compass.core.config.CompassConfiguration.buildCompass(CompassConf
iguration.java:191)
at org.compass.spring.LocalCompassBean.newCompass(LocalCompassBean.java:
Lei Jin

Posts: 14
Registered: 2/13/07
Re: Creating index table for Spring/Compass using JDBC store
Posted: Jul 16, 2007 11:44 PM   in response to: Lei Jin in response to: Lei Jin
 
  Click to reply to this thread Reply
No one has any ideas?
msolnit

Posts: 108
Registered: 10/12/06
Re: Creating index table for Spring/Compass using JDBC store
Posted: Jul 18, 2007 3:47 PM   in response to: Lei Jin in response to: Lei Jin
 
  Click to reply to this thread Reply
Hi Lei. What version of MySQL are you using? Also, what version of the JDBC driver are you using?

-- Matt
Lei Jin

Posts: 14
Registered: 2/13/07
Re: Creating index table for Spring/Compass using JDBC store
Posted: Jul 18, 2007 6:28 PM   in response to: Lei Jin in response to: Lei Jin
 
  Click to reply to this thread Reply
Hi, Matt: I'm using mysql 5.0 and the standard jdbc driver com.mysql.jdbc.Driver.

Somehow the problem mysteriously went away, but now I'm encountering another problem. That is, the write.lock in the index table does not get released, thus I'm constantly getting lock obtain timeout exceptions on the PhantomReadLock. For example, I do getCompassGps().index();

but it times out waiting for a lock as the lock never get released. Is there something I may be missing in order to get the locking to work?
Lei Jin

Posts: 14
Registered: 2/13/07
Re: Creating index table for Spring/Compass using JDBC store
Posted: Jul 19, 2007 3:02 AM   in response to: Lei Jin in response to: Lei Jin
 
  Click to reply to this thread Reply
So what happens is: I update a database object which is indexed by compass. The database transaction commits, but somehow the compass transaction commit is not called, thus it never cleans up the write.lock that it holds on the index table. I'm not sure if that's the case or not, but what I'm seeing is that after an index operation, the write.lock never gets removed, and data is not written into the jdbc store. This is only happening for transaction created not by compass.

Please help, I have exhausted searching this forum and google.

Again, here is the applicable configuration I'm using.

<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>

<bean id="compass" class="org.compass.spring.LocalCompassBean">

<property name="dataSource"><ref bean="dataSource"/></property>

<property name="compassSettings">
<props>
<prop key="compass.engine.connection">jdbc://</prop>
<prop key="compass.engine.store.jdbc.managed">true</prop>
<prop key="compass.transaction.commitBeforeCompletion">true</prop>
<prop key="compass.transaction.isolation">read_committed</prop>
<prop key="compass.engine.store.jdbc.dialect">org.apache.lucene.store.jdbc.dialect.MySQLInnoDBDialect</prop>
<prop key="compass.transaction.factory">org.compass.spring.transaction.SpringSyncTransactionFactory</prop>
</props>
</property>
<property name="transactionManager">
<ref local="transactionManager" />
</property>
</bean>
<bean id="hibernateGpsDevice" class="org.compass.spring.device.hibernate.SpringHibernate3GpsDevice">
<property name="name"><value>hibernateDevice</value></property>
<property name="sessionFactory"><ref local="sessionFactory" /></property>
</bean>
<bean id="compassGps" class="org.compass.gps.impl.SingleCompassGps" init-method="start" destroy-method="stop">
<property name="compass"><ref bean="compass" /></property>
<property name="gpsDevices">
<list>
<bean class="org.compass.spring.device.SpringSyncTransactionGpsDeviceWrapper">
<property name="gpsDevice" ref="hibernateGpsDevice" />
</bean>
</list>
</property>
</bean>
msolnit

Posts: 108
Registered: 10/12/06
Re: Creating index table for Spring/Compass using JDBC store
Posted: Jul 19, 2007 12:47 PM   in response to: Lei Jin in response to: Lei Jin
 
  Click to reply to this thread Reply
Hi Lei. It might be related to this issue:
http://forums.opensymphony.com/thread.jspa?messageID=108981

I don't know if this was ever fixed. Shay?

-- Matt
Lei Jin

Posts: 14
Registered: 2/13/07
Re: Creating index table for Spring/Compass using JDBC store
Posted: Jul 19, 2007 4:14 PM   in response to: msolnit in response to: msolnit
 
  Click to reply to this thread Reply
Matt, it definitely looks similar. Basically, it looks like the compass transaction never got committed or rolledback (in which case it would remove the write lock). Has this issue been fixed, Shay? If not, is there any good workarounds? I'll try to use the eager flushing option, but I'm not sure that's a good idea performancewise.
Shay Banon

Posts: 4,028
Registered: 9/6/05
Re: Creating index table for Spring/Compass using JDBC store
Posted: Jul 20, 2007 4:37 AM   in response to: Lei Jin in response to: Lei Jin
 
  Click to reply to this thread Reply
I don't see in your configuration that you set the commit before completion flag to true. This will cause Compass to commit the transaction before the database transaction has been committed. This might solve your problem.
Lei Jin

Posts: 14
Registered: 2/13/07
Re: Creating index table for Spring/Compass using JDBC store
Posted: Jul 20, 2007 5:48 PM   in response to: Shay Banon in response to: Shay Banon
 
  Click to reply to this thread Reply
Hello, Shay: I did. If you look at the second configuration file I attached (sorry, I've been learning things along the way), I did set commit before completion to true.
Shay Banon

Posts: 4,028
Registered: 9/6/05
Re: Creating index table for Spring/Compass using JDBC store
Posted: Jul 23, 2007 2:19 PM   in response to: Lei Jin in response to: Lei Jin
 
  Click to reply to this thread Reply
Is there a chance that the lock file is there due to some previous failure? Can you try and delete it and run your test again?
louisvuittonbox

Posts: 411
Registered: 8/23/11
Re: Creating index table for Spring/Compass using JDBC store
Posted: Aug 23, 2011 10:16 PM   in response to: Lei Jin in response to: Lei Jin
 
  Click to reply to this thread Reply
miu miu bags. It's no secret that miu miu handbags are among the most popular in the world. That's because their longstanding reputation of quality and craftsmanship coupled with their amazing ability to foresee what will happen next in fashion makes their miu miu shoes among the absolute best and most unique in the world. Our miu miu 2011 offer all the same classic attributes . you'll be turning heads with one of these on your arm , and at only a fraction of the price! (Miu Miu Handbags)Please feel free to browse our Miu Miu replica handbags in our miu miu outlet, and contact us with any questions that you may have.
afra

Posts: 683
Registered: 8/10/11
tory burch
Posted: Sep 18, 2011 9:38 PM   in response to: Lei Jin in response to: Lei Jin
 
  Click to reply to this thread Reply
If you are interested in this tory burch wallet,welcome to our online store to buy tory burch handbags it. Here we provide several tory burch shoes styles and colors wallets for you to choose tory burch sale from. You also can choose to buy elegant tory burch boots. Take these tory burch flats to attend some fashion activities.
afra

Posts: 683
Registered: 8/10/11
discount puma shoes
Posted: Sep 18, 2011 9:51 PM   in response to: Lei Jin in response to: Lei Jin
 
  Click to reply to this thread Reply
The return with the discount puma shoes proved to be a productive more by simply puma store. With the new cheap puma shoes branch, discounted puma sneakers line is actually cashing in on puma shoes sale the limited updates, which frequently sell on puma shoes Outlet insane prices.
Legend
Guru: 2001 + pts
Expert: 501 - 2000 pts
Super-star: 101 - 500 pts
Assistant: 51 - 100 pts
Participant: 0 - 50 pts
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums