debop / hibernate-redis

hibernate 2nd level cache privder using redis
Apache License 2.0
357 stars 184 forks source link

Fail to load cache properties #26

Closed einsitang closed 8 years ago

einsitang commented 10 years ago

Something error. o.h.cache.redis.util.JedisTool - Fail to load cache properties. cachePath=hibernate-redis.properties java.lang.NullPointerException: null...

I use spring mvc this my Hibernate configure

<property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">
                    org.hibernate.dialect.MySQLDialect
                </prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.format_sql">true</prop>
                <prop key="hibernate.c3p0.min_size">5</prop>
                <prop key="hibernate.c3p0.max_size">20</prop>
                <prop key="hibernate.c3p0.timeout">120</prop>
                <prop key="hibernate.c3p0.max_statements">100</prop>
                <prop key="hibernate.c3p0.acquire_increment">1</prop>
                <prop key="c3p0.testConnectionOnCheckout">true</prop>
                <prop key="c3p0.idleConnectionTestPeriod">18000</prop>
                <prop key="c3p0.maxIdleTime">25000</prop>
                <prop key="c3p0.idle_test_period">120</prop>
                <prop key="hibernate.cache.use_second_level_cache">true</prop>
                <prop key="hibernate.cache.cache.use_query_cache">true</prop>
                <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.redis.SingletonRedisRegionFactory</prop>
                <prop key="hibernate.cache.region_prefix">hibernate</prop>
                <prop key="hibernate.generate_statistics">true</prop>
                <prop key="hibernate.cache.use_structured_entries">true</prop>
                <prop key="hibernate.transaction.factory_class">org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory</prop>
                <prop key="hibernate.cache.provider_configuration_file_resource_path">hibernate-redis.properties</prop>
            </props>
        </property>

and I change hibernate-redis.properties path to "WEB-INF/xx" "/xx", "E:/workspace absolute path/WEB-INF/xx" allway fail load

debop commented 10 years ago

try this.

option 1. hibernate-redis.properties file move to resources option 2. specify physical path for hibernate-redis.properties example

/server/hibernate/hibernate-redis.properties
einsitang commented 10 years ago

I try , but not work.

ABHINAVKR commented 8 years ago

@forfuns @debop You need to append file: prefix before the physical path it worked for me. e.g

**file:**/server/hibernate/hibernate-redis.properties
debop commented 8 years ago

Please, use 2.0.3 or higher