[JBoss Cache] - Using ExpirationAlgorithm in EvictionConfig not working in JBoss 5.1
by Thomas Hofmann
Thomas Hofmann [https://community.jboss.org/people/temenosthofmann] created the discussion
"Using ExpirationAlgorithm in EvictionConfig not working in JBoss 5.1"
To view the discussion, visit: https://community.jboss.org/message/776685#776685
--------------------------------------------------------------
I'm using JBoss Cache Malagueta 3.2.5.GA in JBoss 5.1. There is a cache configuration without any eviction config:
The eviction is configured dynamically, and following entries are put into the cache: Key_1=value_1, Key_2=value_2,Key_3=value_3
CacheManager cacheManager = com.bspartners.util.ServiceLocator.getCacheManager();
Cache expirationCache = cacheManager.getCache("prodb-expiration-cache", true);
Node rootNode = expirationCache.getRoot();
Fqn cacheFqn = Fqn.fromString("/OTTO");
Region region = expirationCache.getRegion(cacheFqn, true);
ExpirationAlgorithmConfig expirationAlgorithmConfig = new ExpirationAlgorithmConfig();
expirationAlgorithmConfig.setExpirationKeyName(ExpirationAlgorithmConfig.EXPIRATION_KEY);
EvictionRegionConfig erc = new EvictionRegionConfig(cacheFqn, expirationAlgorithmConfig);
region.setEvictionRegionConfig(erc);
EvictionConfig evictionConfig = new EvictionConfig();
List should be evicted because value is expired!
Object value = rootNode.getChild(cacheFqn).getChild(Fqn.fromElements("key_1)).get("key_1");
After getting the value for key "key_1" after 15 seconds there is the value in the cache. The expiration or the eviction respectively did not start.
The RegionManager in JBoss web-console dumps the region. Why is evitionQueueSize 0?
Region RegionImpl{fqn=/OTTO; classloader=null; status=ACTIVE; eviction=true; evictionQueueSize=0}
Dumping the cache in JBoss web-console lists
--- Cache1 ---
/ null
/OTTO null
/key_2 {expiration=1352982716472, key_2=value_2}
/key_0 {expiration=1352982716472, key_0=value_0}
/key_1 {expiration=1352982716472, key_1=value_1}
-
-----------
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/776685#776685]
Start a new discussion in JBoss Cache at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 5 months
[EJB3] - ejb client and naming error - problem
by Dariusz Kominek
Dariusz Kominek [https://community.jboss.org/people/darisz] created the discussion
"ejb client and naming error - problem"
To view the discussion, visit: https://community.jboss.org/message/776774#776774
--------------------------------------------------------------
*I'm very beginner in ejb programming so please don't be angry if the question is easy.*
*Below is a code I wrote and it produces an error. What should I change to get this to work? I work with Eclipse Juno and JBoss 7.1.1. Below example should work for*
Application Server - JBoss 4.2.2 GA
IDE - Eclipse 3.4.1
*It doesn't work for my environment. Any help will be appreciated.*
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
at javax.naming.InitialContext.init(InitialContext.java:242)
at javax.naming.InitialContext.<init>(InitialContext.java:216)
at MyBeanClient.main(MyBeanClient.java:13)
Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:63)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:671)
... 4 more
*IMyBean.java*
import java.io.Serializable;
public interface IMyBean extends Serializable {
public void doSomething();
}
*MyBeanRemote.java*
import javax.ejb.Remote;
@Remote
public interface MyBeanRemote extends IMyBean{
}
*MyBeanLocal.java*
import javax.ejb.Local;
@Local
public interface MyBeanLocal extends IMyBean {
}
*MyBean.java*
import javax.ejb.Stateless;
@Stateless
public class MyBean implements MyBeanLocal, MyBeanRemote {
private static final long serialVersionUID = 9184424076718418234L;
public void doSomething() {
System.out.println("Hello World!");
}
}
*MyBeanClient.java*
import java.util.Properties;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class MyBeanClient {
public static void main(String[] args) {
try {
Properties props = new Properties();
props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
props.setProperty("java.naming.provider.url", "127.0.0.1:1099");
InitialContext ctx = new InitialContext(props);
MyBeanRemote bean = (MyBeanRemote) ctx.lookup("MyBean/remote");
bean.doSomething();
} catch (NamingException e) {
e.printStackTrace();
}
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/776774#776774]
Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 5 months
[JBoss Web Services] - Stateless WS -> WebServiceContext is null
by web.leo
web.leo [https://community.jboss.org/people/web.leo] created the discussion
"Stateless WS -> WebServiceContext is null"
To view the discussion, visit: https://community.jboss.org/message/776669#776669
--------------------------------------------------------------
Hi everybody,
i´ve implemented a web service using JAX-WS/JBoss 5.1.0. Inside the web service i used a javax.annotation.Resource annotation to get the javax.xml.ws.WebServiceContext.
Up to now it works fine but then i had to chang the web service to a stateless one via javax.ejb.Stateless annotation. Now i get a NullPointerException whenever i try to use the WebserviceContext. Where am i wrong? I also tried to use a setter method with a Resource annotation but it also didn´t work.
Part of my code:
*import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.jws.HandlerChain;
import javax.jws.WebService;
import javax.xml.ws.Holder;
import javax.xml.ws.WebServiceContext;
**@HandlerChain(file = "/HandlerDefinition.xml")
@WebService(serviceName = "webService", endpointInterface = "com.webService", targetNamespace = " http://ribs.telekom.de/ikf/2011/11/service/schreibenSachstand http://server/webService")
public class WebServiceImpl implements WebService {*
@Stateless
@Resource
WebServiceContext wsContext;
public void doWork(RequestData data, Holder<ResponseData> data0)
throws ExceptionMessage{
****
**** String uuid = (String) wsContext.getMessageContext().get(STARTTIME);
**** [...]
** ** }
****}
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/776669#776669]
Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 5 months