[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Deploying Ehcache as a Restful Web Service  XML
Forum Index -> Ehcache
Author Message
priyasri

neo

Joined: 05/30/2012 12:30:14
Messages: 3
Offline

Hi,
I am a newbie to Ehcache.

I just wrote a sample Java code to read a list of table rows and populate it into a TO object and store that in EhCache with unique Key for each Row.

I had the terracotta server running in my machine locally on localhost:9510 port. Until now, it was working fine.

Now, I planned to change my configuration to embed the ehCache Server into Weblogic as a Web Service and I dont want to have a ehcache/terracotta standalone server. And here is what I did:

1. Downloaded Ehcache server distribution from the following link:
http://sourceforge.net/projects/ehcache/files/ehcache-server/ehcache-server-1.0.0/

2. Unzip ehcache-server.war to a folder called ehcache.

3. Remove the following jars from WEB-INF/lib:
◦jaxws-rt-2.1.4.jar - Removed this file
- The following files were not found in the ehcache server 1.0.0 distribution:

◦metro-webservices-api-1.2.jar
◦metro-webservices-rt-1.2.jar
◦metro-webservices-tools-1.2.jar

4. changed the ehcache.xml under <weblogic home>\user_projects\domains\base_domain\autodeploy\ehcache-server-1.0.0.war\WEB-INF\classes

and added the following lines at the end of the file before the end of </ehcache> tag:

<cache name="AttributesCache"
maxElementsInMemory="100"
maxElementsOnDisk="0"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="0"
memoryStoreEvictionPolicy="LFU">
<terracotta/>

</cache>
<terracottaConfig url="localhost:8080"/>

5. Deploy the folder to WebLogic.
6. Started my weblogic server and getting the following error in the logs:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
May 30, 2012 2:26:12 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized
INFO: WSSERVLET12: JAX-WS context listener initializing
2012-05-30 14:26:12,990 INFO - Terracotta 3.2.1, as of 20100304-100300 (Revision 14673 by cruise@su10mo5 from 3.2)
2012-05-30 14:26:13,006 WARN - We couldn't load configuration data from the server at 'localhost:8080'; retrying. (Error: Response: '404: Not Found' for url: 'http://localhost:8080/config'.)



My assumptions are, since I deploy it as a war, My EhCache standalone Server need not be running, and the EhCache Manager should be started or initialized via weblogic on port 8080

Can anyone kindly help me resolve this issue?
Jaza

journeyman

Joined: 04/15/2012 07:17:33
Messages: 28
Offline

Hi,

maybe I misunderstood some points, but I think you're mixing up some things here. Ehcache Server is by no means a replacement for the Terracotta server. Terracotta Server acts as backend store for distributed caches accessed by several clients via ehcache while you can imagine ehcache Server as a Soap/Rest facade for clients which cannot use ehcache API (non-Java apps for example) directly.

The error message appears since your ehcache.xml is pointing to a Terracotta server on port 8080, which is not there.

Regards,
Jan
priyasri

neo

Joined: 05/30/2012 12:30:14
Messages: 3
Offline

So, If I understand right:

1. We definitely need to run the Terracotta Server outside of weblogic. Terracotta Server is totally independent entity (like a database).

2. By deploying the ehcache server war file, we get a WebService Interface, which will be helpful for non-java clients.

Is my above assumption right?


We basicially thought of having the Terracotta Server embeded within Weblogic. i.e When we start the weblogic, we want the terracotta server to be started too. Is there a way to do that?
Jaza

journeyman

Joined: 04/15/2012 07:17:33
Messages: 28
Offline

1) yes and 2) yes

Terracotta server is an independent Java process, you should (and can not to my best knowledge) tie it to startup/shutdown of your Weblogic server.

Just to be sure: are you distributing the cache over several nodes/JVM's? Maybe for your use case (just 100 elements in memory) standalone ehcache is enough?

priyasri

neo

Joined: 05/30/2012 12:30:14
Messages: 3
Offline

No, we are not planning to have it as a distributed Cache or in Weblogic Clusters.

For the time being, we are just trying out cache, may be in future we may increase the no. of elements, as you say hardly 250 elements will be there in ehcache for this release.

By Standalone ehcache, are you referring to Ehcache DX (Standalone Ehcache).

Is my following assumption right:

1. We don't need to start any Ehcache Server?
2. In Memory Caching
3. Will have flexibility to perform data refresh as and when a table changes (via triggers) or with cache configuration attributes?


Can you kindly clarify?
Jaza

journeyman

Joined: 04/15/2012 07:17:33
Messages: 28
Offline

In this case you won't need the Terracotta server, simply use ehcache from ehcache.org inside your app.

1) yes, neither Cache nor Terracotta server
2) yes, but you can overflow to disk as well if you want
3) a classic :) check this documentation: http://www.ehcache.org/documentation/recipes/expiration
rajoshi

seraphim

Joined: 07/04/2011 04:36:10
Messages: 1465
Offline

Issue seems to be resolved, closing the topic.

Rakesh Joshi
Terracotta.
 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team