On Dec 17, 2007, at 10:21 AM, Alexander Coles wrote:

Thanks for your suggestions, Matt.

That's what I immediately thought of - but I doubled checked both the spellings, and that BaseDaoTestCase.java loads applicationContext-resources.xml.

I also added search.index to jdbc.properties and still get this issue:
[news] WARN [main] SystemPropertyUtils.resolvePlaceholders(85) | Could not resolve placeholder 'search.index' in [${search.index}] as system property: neither system property nor environment variable found

Just for the hell of it, I tried passing another property in (jdbc.password) - which I know works in other configuration files: [news] WARN [main] SystemPropertyUtils.resolvePlaceholders(85) | Could not resolve placeholder 'jdbc.password' in [${jdbc.password}] as system property: neither system property nor environment variable found

I double checked and search.properties is in my target/test-classes directory.

The only thing I can think of at this stage is that properties (perhaps) don't resolve correctly if using a custom schema:
       <compass:connection>
           <compass:file path="${search.index}"/>
       </compass:connection>


I don't know if that sounds like a plausible explanation.

It sounds plausible, but it's not a question I can answer. You might ask the Compass mailing list.

Matt


Thanks again for your help.

Alex



On 17 Dec 2007, at 16:53, Matt Raible wrote:

The only thing I can think of is:

1. You've misspelled the property name in search.properties.
2. You're not loading applicationContext-resources.xml in your tests.

You might try adding search.index to mail.properties or jdbc.properties and see if that works.

Matt

On Dec 15, 2007, at 6:51 PM, Alexander Coles wrote:

Hi,

Like a couple others on the list, I have a user requirement for full-text searching capabilities in an application that I am developing. As such, I decided to go with Lucene, through its Compass abstraction.

I actually got Compass + Spring + Hibernate more or less working in a past application that didn't use AppFuse - but does use a similar stack (Spring, Hibernate, Spring MVC). It used the out of the box HibernateGpsDevice.

Based on what I read in the following tutorial, I feel I'm on the verge of getting AppFuse 2.0 working with Compass + JPA: http://www.nabble.com/Mini-Tutorial-3A-Compass-and-AppFuse-2.0- to12608860s2369.html#a12608860

Here's what I've done:
* In the same vein as mail.properties, jdbc.properties, I created a new property configurer in the form of searc.properties to the following directories (this is a modular project):
        core/src/test/resources/search.properties
        web/src/main/resources/search.properties
        web/src/test/resources/search.properties
 - inside of which search.index is defined.
 This should allows for separate test and web indexes to be defined.

 * I added a search.properties to the the following files:

--- core/src/test/resources/applicationContext-resources.xml, web/ src/main/resources/applicationContext-resources.xml:

<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderC onfigurer">
       <property name="locations">
           <list>
               <value>classpath:jdbc.properties</value>
               <value>classpath:mail.properties</value>
               <value>classpath:search.properties</value>
           </list>
       </property>
   </bean>
---

 * And the following:

--- core/src/main/resources/applicationContext.xml:

   <compass:compass name="compass" txManager="transactionManager">
       <compass:connection>
           <compass:file path="${search.index}"/>
       </compass:connection>
       <compass:searchEngine>
<compass:analyzer name="standardAnalyzer" type="Standard"/> <compass:optimizer schedule="true" scheduleInterval="90" />
       </compass:searchEngine>
       <compass:mappings>
           <compass:class name="gov.fws.news.model.Asset"/>
           <compass:class name="gov.fws.news.model.NewsItem"/>
       </compass:mappings>
       <compass:settings>
           <compass:setting name="compass.transaction.factory"
value="org.compass.spring.transaction.SpringSyncTransactionFactory"/ >
       </compass:settings>
   </compass:compass>

<!-- A direct LocalCompassSessionBean, used with code within a transaction context -->
   <compass:session id="sess" />

   <bean id="jpaGpsDevice"
       class="org.compass.gps.device.jpa.JpaGpsDevice">
       <property name="name" value="JpaGpsDevice"/>
<property name="entityManagerFactory" ref="entityManagerFactory"/>
       <property name="nativeExtractor">
<bean class="org.compass.spring.device.jpa.SpringNativeJpaExtractor"/>
       </property>
   </bean>

<bean id="compassGps" class="org.compass.gps.impl.SingleCompassGps"
       init-method="start" destroy-method="stop">
       <property name="compass" ref="compass"/>
       <property name="gpsDevices">
           <list>
               <bean
class="org.compass.spring.device.SpringSyncTransactionGpsDeviceWrapp er">
                   <property name="gpsDevice" ref="jpaGpsDevice"/>
               </bean>
           </list>
       </property>
   </bean>

---



Both in tests, and when running mvn jetty:run*, the parameterized reference to Compass' index is not resolving: <compass:file path="${search.index}"/>. In fact, I am seeing a ${search.index} folder being created in my project folders on executing tests/ running in the container.

I cannot see what I am doing wrong in terms of the configuration of the propertyConfigurer. This works if the file path is hard- coded.

I can't wait untiL Compass integration is added into AppFuse (http://issues.appfuse.org/browse/APF-267). Once I get this working, I would love to share back my setup on the Wiki.

Alex

* I have run appfuse:full-source on the project, but this shouldn't be necessary - it just suited the needs of this particular project.

Alexander Coles
[EMAIL PROTECTED]
www.alexcolesportfolio.com

-------------------------------------------------------------------- -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to