2010-03-03 20:51:08.703 INFO net.spy.memcached.MemcachedConnection:
Connection state changed for sun.nio.ch.SelectionKeyImpl@32dcb03b
2010-03-03 20:51:08.703 INFO net.spy.memcached.MemcachedConnection:
Reconnecting due to failure to connect to {QA sa=localhost/
127.0.0.1:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null,
toWrite=0, interested=0}
java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at
sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)
at
net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:
294)
at
net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:
192)
at net.spy.memcached.MemcachedClient.run(MemcachedClient.java:
1444)
can anyone guide me regarding dis issue?
Thnaks & Regards.
This looks pretty cut and dry that the server isn't running or the
client can't connect for some reason.
Can you paste the hibernate.memcached properties?
Also...
From a command prompt, can you do this?
telnet localhost 11211
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property
name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</
property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/
exchange</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</
property>
<property
name="hibernate.cache.provider_class">com.googlecode.hibernate.memcached.MemcachedCacheProvider</
property>
<property name="hibernate.memcached.servers">192.168.1.11:8888</
property>
<property name="hibernate.cache.use_query_cache">true</property>
<!-- Mapping files -->
<mapping resource="stocks.hbm.xml"/>
</session-factory>
</hibernate-configuration>
From ur blog i came to knw about second level caching,
is der any other configuration required for hibernate-memcached?
Thanks & Regards.
--
You received this message because you are subscribed to the Google Groups "hibernate-memcached" group.
To post to this group, send email to hibernate...@googlegroups.com.
To unsubscribe from this group, send email to hibernate-memca...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hibernate-memcached?hl=en.
On Mar 4, 11:08 am, Jason Buberel <ja...@buberel.org> wrote:
> If your memcache server is running on port 11211 - which netstat should have
> confirmed if it were configured correctly - then why are you using port 8888
> in your config line:
>
> <property name="hibernate.memcached.servers">192.168.1.11:8888
> </property>
>
> But the first proplem to solve is your network connectivity.
>
> Jason L. Buberel
> ja...@buberel.org
>
> > hibernate-memca...@googlegroups.com<hibernate-memcached%2Bunsu...@googlegroups.com>
To unsubscribe from this group, send email to hibernate-memca...@googlegroups.com.
If you are running memcached on another, server you'll need to ensure
that the route to that server is clear and there are no firewalls
around that destination.
Are you trying to run memcached on a server in remote datacenter then?
Also, if you learned about second-level caching and memcached from my
blog; I highly recommend doing some serious studying. There's a lot to
know there.
-Ray
(blame the iPhone for typos)
On Mar 4, 2010, at 2:48 AM, fazilTHEone <fazi...@gmail.com> wrote:
> ohk jason,
> thanks for response.
>
> On Mar 4, 1:44 pm, Jason Buberel <ja...@buberel.org> wrote:
>> Sorry - find yourself a good sysadmin!
>>
>> Jason L. Buberel
>> ja...@buberel.org
>>
>> On Wed, Mar 3, 2010 at 10:18 PM, fazilTHEone <fazil....@gmail.com>
>>> <hibernate-memcached%2Bunsu...@googlegroups.com<hibernate-
>>> memcached%252Buns...@googlegroups.com>
>>
>>>>> .
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/hibernate-memcached?hl=en.
>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups
>>> "hibernate-memcached" group.
>>> To post to this group, send email to hibernate...@googlegroups.com
>>> .
>>> To unsubscribe from this group, send email to
>>> hibernate-memca...@googlegroups.com<hibernate-
>>> memcached%2Bunsu...@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/hibernate-memcached?hl=en.
>
> --
> You received this message because you are subscribed to the Google
> Groups "hibernate-memcached" group.
> To post to this group, send email to hibernate...@googlegroups.com
> .
> To unsubscribe from this group, send email to hibernate-memca...@googlegroups.com
On Mar 4, 6:53 pm, Ray Krueger <raykrue...@gmail.com> wrote:
> This is why I said to email the list and not me directly, so helpful
> folks like Jason can jump in.
>
> If you are running memcached on another, server you'll need to ensure
> that the route to that server is clear and there are no firewalls
> around that destination.
>
> Are you trying to run memcached on a server in remote datacenter then?
>
> Also, if you learned about second-level caching and memcached from my
> blog; I highly recommend doing some serious studying. There's a lot to
> know there.
>
> -Ray
> (blame the iPhone for typos)
>
You have hibernate-memcached configured to connect to 192.168.1.11:8888
Why are you using port 8888 instead of the default 11211? Did you
configure memcached to start listening on 8888?
Also, if you're running memcached locally, try connecting to 127.0.0.1
instead of 192.168.1.1.
As far as the minimal configuration is concerned you're about there
already. Though you probably need to enable caching on the things you
actually want cached (like your Stocks class).
> To unsubscribe from this group, send email to hibernate-memca...@googlegroups.com.
i have tried default i.e. localhost/127.0.0.1 11211 as well as
different ips and ports.
can u tell me wat i'm suposd to do in java class for memcached?
On Mar 4, 7:15 pm, Ray Krueger <raykrue...@gmail.com> wrote:
> If you're running memcached locally you shouldn't have trouble connecting to it.
> How are you starting it and running it?
>
> You have hibernate-memcached configured to connect to 192.168.1.11:8888
> Why are you using port 8888 instead of the default 11211? Did you
> configure memcached to start listening on 8888?
>
> Also, if you're running memcached locally, try connecting to 127.0.0.1
> instead of 192.168.1.1.
>
> As far as the minimal configuration is concerned you're about there
> already. Though you probably need to enable caching on the things you
> actually want cached (like your Stocks class).
>
Start by studying second-level caching in hibernate.
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/performance.html
From there you should understand how to use an in-process cache like
ehcache to do second-level caching in Hibernate. Once you understand
what this stuff is all about then you can look into memcached.
Memcached is a server application that you need to install and run. It
is not part of java, hibernate, or hibernate-memcached.
http://memcached.org/
Caching in Hibernate is not a simple subject, it requires a bit of
research to get right.
On Mar 4, 7:31 pm, Ray Krueger <raykrue...@gmail.com> wrote:
> OK. You've got some serious misunderstandings about how memcached works.
>
> Start by studying second-level caching in hibernate.http://docs.jboss.org/hibernate/core/3.3/reference/en/html/performanc...
>
> From there you should understand how to use an in-process cache like
> ehcache to do second-level caching in Hibernate. Once you understand
> what this stuff is all about then you can look into memcached.
>
> Memcached is a server application that you need to install and run. It
> is not part of java, hibernate, or hibernate-memcached.http://memcached.org/
>
> Caching in Hibernate is not a simple subject, it requires a bit of
> research to get right.
>
16:47:29,218 DEBUG SessionImpl:220 - opened session at timestamp:
12678742492
16:47:29,218 DEBUG JDBCTransaction:54 - begin
16:47:29,218 DEBUG ConnectionManager:421 - opening JDBC connection
16:47:29,218 DEBUG JDBCTransaction:59 - current autocommit status:
false
16:47:29,218 DEBUG AbstractBatcher:366 - about to open
PreparedStatement (open PreparedStatements: 0, globally: 0)
16:47:29,218 DEBUG SQL:401 - select userauthen0_.ip as ip0_,
userauthen0_.serviceid as serviceid0_ from user_authentication
userauthen0_, services services1_ where
userauthen0_.serviceid=services1_.serviceid and
userauthen0_.ip='127.0.0.1' and
services1_.servicename='selectUserMaster'
16:47:29,250 DEBUG AbstractBatcher:382 - about to open ResultSet (open
ResultSets: 0, globally: 0)
16:47:29,250 DEBUG Loader:1173 - result row:
EntityKey[POJO.UserAuthentication#component[ip,serviceid]{serviceid=2,
ip=127.0.0.1}]
16:47:29,250 DEBUG AbstractBatcher:389 - about to close ResultSet
(open ResultSets: 1, globally: 1)
16:47:29,250 DEBUG AbstractBatcher:374 - about to close
PreparedStatement (open PreparedStatements: 1, globally: 1)
16:47:29,250 DEBUG TwoPhaseLoad:107 - resolving associations for
[POJO.UserAuthentication#component[ip,serviceid]{serviceid=2,
ip=127.0.0.1}]
16:47:29,250 DEBUG TwoPhaseLoad:135 - adding entity to second-level
cache: [POJO.UserAuthentication#component[ip,serviceid]{serviceid=2,
ip=127.0.0.1}]
16:47:29,359 DEBUG HashCodeKeyStrategy:12 - Transformed key
[POJO.UserAuthentication#POJO.UserAuthenticationId@f94995fc] to
hashCode [-112617988]
16:47:29,359 DEBUG HashCodeKeyStrategy:41 - Final cache key:
[POJO.UserAuthentication:0:-112617988]
16:47:29,359 DEBUG MemcachedCache:115 -
Memcache.get(POJO.UserAuthentication:0:-112617988)
16:47:29,359 DEBUG SpyMemcache:31 -
MemcachedClient.get(POJO.UserAuthentication:0:-112617988)
16:47:29,359 DEBUG HashCodeKeyStrategy:12 - Transformed key
[POJO.UserAuthentication#POJO.UserAuthenticationId@f94995fc] to
hashCode [-112617988]
16:47:29,468 DEBUG HashCodeKeyStrategy:41 - Final cache key:
[POJO.UserAuthentication:0:-112617988]
16:47:29,468 DEBUG MemcachedCache:150 -
Memcache.set(POJO.UserAuthentication:0:-112617988)
16:47:29,468 DEBUG SpyMemcache:49 -
MemcachedClient.set(POJO.UserAuthentication:0:-112617988)
16:47:29,468 DEBUG TwoPhaseLoad:206 - done materializing entity
[POJO.UserAuthentication#component[ip,serviceid]{serviceid=2,
ip=127.0.0.1}]
16:47:29,468 DEBUG StatefulPersistenceContext:790 - initializing non-
lazy collections
16:47:29,578 DEBUG JDBCTransaction:103 - commit
16:47:29,578 DEBUG AbstractFlushingEventListener:111 - processing
flush-time cascades
16:47:29,578 DEBUG AbstractFlushingEventListener:154 - dirty checking
collections
16:47:29,578 DEBUG AbstractFlushingEventListener:85 - Flushed: 0
insertions, 0 updates, 0 deletions to 1 objects
16:47:29,578 DEBUG AbstractFlushingEventListener:91 - Flushed: 0
(re)creations, 0 updates, 0 removals to 0 collections
16:47:29,578 DEBUG Printer:83 - listing entities:
16:47:29,578 DEBUG Printer:90 -
POJO.UserAuthentication{id=component[ip,serviceid]{serviceid=2,
ip=127.0.0.1}, services=POJO.Services#2}
16:47:29,687 DEBUG JDBCTransaction:116 - committed JDBC Connection
16:47:29,687 DEBUG ConnectionManager:404 - aggressively releasing JDBC
connection
16:47:29,687 DEBUG ConnectionManager:441 - releasing JDBC connection
[ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0,
globally: 0)]
16:47:29,687 DEBUG SessionImpl:220 - opened session at timestamp:
12678742496
16:47:29,687 DEBUG JDBCTransaction:54 - begin
16:47:29,687 DEBUG ConnectionManager:421 - opening JDBC connection
16:47:29,687 DEBUG JDBCTransaction:59 - current autocommit status:
false
Mar 6, 2010 4:47:29 PM Functionality.User_Functionality check_IP
INFO: check_IP Result true for Operation selectUserMaster and IP
127.0.0.1
Mar 6, 2010 4:47:29 PM Services.User_Management selectUserMaster
INFO: selectUserMaster Service Call
Mar 6, 2010 4:47:29 PM Functionality.User_Functionality
selectUserMaster
INFO: selectUserMaster for 1
16:47:29,796 DEBUG AbstractBatcher:366 - about to open
PreparedStatement (open PreparedStatements: 0, globally: 0)
16:47:29,796 DEBUG SQL:401 - select shareduser0_.shared_id as
shared1_6_, shareduser0_.userid as userid6_, shareduser0_.username as
username6_ from shared_user shareduser0_ where shareduser0_.userid=1
16:47:29,796 DEBUG AbstractBatcher:382 - about to open ResultSet (open
ResultSets: 0, globally: 0)
16:47:29,796 DEBUG Loader:1173 - result row:
EntityKey[POJO.SharedUser#0]
16:47:29,796 DEBUG AbstractBatcher:389 - about to close ResultSet
(open ResultSets: 1, globally: 1)
16:47:29,906 DEBUG AbstractBatcher:374 - about to close
PreparedStatement (open PreparedStatements: 1, globally: 1)
16:47:29,906 DEBUG TwoPhaseLoad:107 - resolving associations for
[POJO.SharedUser#0]
16:47:29,906 DEBUG TwoPhaseLoad:206 - done materializing entity
[POJO.SharedUser#0]
16:47:29,906 DEBUG StatefulPersistenceContext:790 - initializing non-
lazy collections
16:47:29,906 DEBUG JDBCTransaction:103 - commit
16:47:29,906 DEBUG AbstractFlushingEventListener:111 - processing
flush-time cascades
16:47:29,906 DEBUG AbstractFlushingEventListener:154 - dirty checking
collections
16:47:30,015 DEBUG AbstractFlushingEventListener:85 - Flushed: 0
insertions, 0 updates, 0 deletions to 1 objects
16:47:30,015 DEBUG AbstractFlushingEventListener:91 - Flushed: 0
(re)creations, 0 updates, 0 removals to 0 collections
16:47:30,015 DEBUG Printer:83 - listing entities:
16:47:30,015 DEBUG Printer:90 - POJO.SharedUser{username=Ajay,
userid=1, sharedId=0}
16:47:30,015 DEBUG JDBCTransaction:116 - committed JDBC Connection
16:47:30,015 DEBUG ConnectionManager:404 - aggressively releasing JDBC
connection
16:47:30,125 DEBUG ConnectionManager:441 - releasing JDBC connection
[ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0,
globally: 0)]
16:47:30,125 DEBUG SessionImpl:220 - opened session at timestamp:
12678742501
16:47:30,125 DEBUG JDBCTransaction:54 - begin
16:47:30,125 DEBUG ConnectionManager:421 - opening JDBC connection
16:47:30,125 DEBUG JDBCTransaction:59 - current autocommit status:
false
16:47:30,125 DEBUG AbstractBatcher:366 - about to open
PreparedStatement (open PreparedStatements: 0, globally: 0)
Mar 6, 2010 4:47:30 PM Functionality.User_Functionality get_index
INFO: Index 0
16:47:30,234 DEBUG SQL:401 - select usermaster0_.user_id as user1_4_,
usermaster0_.activation_token as activation2_4_,
usermaster0_.birthdate as birthdate4_, usermaster0_.email as email4_,
usermaster0_.gender as gender4_, usermaster0_.lastsignin as
lastsignin4_, usermaster0_.lostpassword_req as lostpass7_4_,
usermaster0_.mobile as mobile4_, usermaster0_.off_add_city as off9_4_,
usermaster0_.off_add_country as off10_4_, usermaster0_.off_add_state
as off11_4_, usermaster0_.off_add_street as off12_4_,
usermaster0_.off_add_zip as off13_4_, usermaster0_.outstanding as
outstan14_4_, usermaster0_.password as password4_,
usermaster0_.payment_method as payment25_4_, usermaster0_.phone as
phone4_, usermaster0_.res_add_city as res17_4_,
usermaster0_.res_add_country as res18_4_, usermaster0_.res_add_state
as res19_4_, usermaster0_.res_add_street as res20_4_,
usermaster0_.res_add_zip as res21_4_, usermaster0_.role as role4_,
usermaster0_.signup as signup4_, usermaster0_.status as status4_,
usermaster0_.group_id as group27_4_, usermaster0_.user_name as
user24_4_ from user_master usermaster0_ where usermaster0_.user_id=1
16:47:30,343 DEBUG AbstractBatcher:382 - about to open ResultSet (open
ResultSets: 0, globally: 0)
16:47:30,343 DEBUG Loader:1173 - result row:
EntityKey[POJO.UserMaster#1]
16:47:30,343 DEBUG AbstractBatcher:389 - about to close ResultSet
(open ResultSets: 1, globally: 1)
16:47:30,343 DEBUG AbstractBatcher:374 - about to close
PreparedStatement (open PreparedStatements: 1, globally: 1)
16:47:30,343 DEBUG TwoPhaseLoad:107 - resolving associations for
[POJO.UserMaster#1]
16:47:30,343 DEBUG TwoPhaseLoad:206 - done materializing entity
[POJO.UserMaster#1]
16:47:30,453 DEBUG StatefulPersistenceContext:790 - initializing non-
lazy collections
16:47:30,453 DEBUG JDBCTransaction:103 - commit
16:47:30,453 DEBUG AbstractFlushingEventListener:111 - processing
flush-time cascades
16:47:30,453 DEBUG AbstractFlushingEventListener:154 - dirty checking
collections
16:47:30,453 DEBUG AbstractFlushingEventListener:85 - Flushed: 0
insertions, 0 updates, 0 deletions to 1 objects
16:47:30,453 DEBUG AbstractFlushingEventListener:91 - Flushed: 0
(re)creations, 0 updates, 0 removals to 0 collections
16:47:30,562 DEBUG Printer:83 - listing entities:
16:47:30,562 DEBUG Printer:90 - POJO.UserMaster{phone=97252,
resAddZip=380015, resAddCountry=INDIA, lostpasswordReq=0,
lastsignin=2010-03-06 16:36:30, password=12345, offAddZip=380015,
userId=1, birthdate=27 May 1984, userName=Vijay, gender=5,
paymentMethodMaster=POJO.PaymentMethodMaster#Bank, outstanding=5000.0,
offAddState=Gujarat, status=true, resAddStreet=Ambavadi,
roleMaster=POJO.RoleMaster#Admin, resAddCity=Ahmedabad,
offAddCountry=INDIA, offAddCity=Ahmedabad, email=vi...@v.com,
activationToken=100.0, userGroup=POJO.UserGroup#1,
offAddStreet=Ambavadi, mobile=972526088, resAddState=Gujarat,
signup=2010-03-06 16:36:30}
16:47:30,671 DEBUG JDBCTransaction:116 - committed JDBC Connection
16:47:30,671 DEBUG ConnectionManager:404 - aggressively releasing JDBC
connection
16:47:30,671 DEBUG ConnectionManager:441 - releasing JDBC connection
[ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0,
globally: 0)]
Mar 6, 2010 4:47:30 PM Functionality.User_Functionality
Close_Connection
INFO: Session Close
Mar 6, 2010 4:47:30 PM Services.User_Management selectUserMaster
is dat correct or still i'm makin any mistake?
On Mar 4, 7:31 pm, Ray Krueger <raykrue...@gmail.com> wrote:
> OK. You've got some serious misunderstandings about how memcached works.
>
> Start by studying second-level caching in hibernate.http://docs.jboss.org/hibernate/core/3.3/reference/en/html/performanc...
>
> From there you should understand how to use an in-process cache like
> ehcache to do second-level caching in Hibernate. Once you understand
> what this stuff is all about then you can look into memcached.
>
> Memcached is a server application that you need to install and run. It
> is not part of java, hibernate, or hibernate-memcached.http://memcached.org/
>
> Caching in Hibernate is not a simple subject, it requires a bit of
> research to get right.
>
It sounds like you've added the @Cache annotations to everything and
are expecting it to never go to the database now.
It's important to realize the difference between query caching and
entity caching. Entity caching is best accomplished with entities that
have surrogate IDs, it looks like you're using composite keys here.
You really can't use composite keys with the HashCodeKeyStrategy
unless you implement equals and hashcode correctly. That goes for any
caching implementation used with hibernate. See another thread here
for more info...
http://groups.google.com/group/hibernate-memcached/browse_thread/thread/4380715b294ae100
Query caching is enabled on a query by query basis and has a lot of
caveats. The hibernate docs cover some of that, as well as a few
threads here that have run into problems.
Most important question for you is,
What are you trying to do?
-Ray
On Mar 6, 6:52 pm, Ray Krueger <raykrue...@gmail.com> wrote:
> What are you trying to achieve?
> Caching is not a golden hammer that will suddenly make everything
> awesome. You need to think about what things are making your system
> slow, what you can cache, and how it should be cached.
>
> It sounds like you've added the @Cache annotations to everything and
> are expecting it to never go to the database now.
>
> It's important to realize the difference between query caching and
> entity caching. Entity caching is best accomplished with entities that
> have surrogate IDs, it looks like you're using composite keys here.
> You really can't use composite keys with the HashCodeKeyStrategy
> unless you implement equals and hashcode correctly. That goes for any
> caching implementation used with hibernate. See another thread here
> for more info...http://groups.google.com/group/hibernate-memcached/browse_thread/thre...
>
> Query caching is enabled on a query by query basis and has a lot of
> caveats. The hibernate docs cover some of that, as well as a few
> threads here that have run into problems.
>
> Most important question for you is,
> What are you trying to do?
>
> -Ray
>
> ...
>
> read more »
I think that article will have a lot of answers for you. Have a look
and let's see what questions you still have.
I can't make sense of that log snippet you posted the formatting went to hell.
On Mar 6, 7:22 pm, Ray Krueger <raykrue...@gmail.com> wrote:
> I just stumbled on a great article about the hibernate query cache and
> the second level cache.http://www.javalobby.org/java/forums/t48846.html
>
> I think that article will have a lot of answers for you. Have a look
> and let's see what questions you still have.
>
> I can't make sense of that log snippet you posted the formatting went to hell.
>
> ...
>
> read more »