[JBoss Messaging] - Re: Consumed messages redelivered ?
by joellindheimer
Lakshmi, Tim, Ovidiu,
I have isolated the variable that caused the problem. When I configured my consumer with Spring the problem was duplicated. I noticed that there was a difference between my test and the Spring configuration and that was the user of our own configured QueueConnectionFactory. I then switched from using Click's configured WMXQueueConnectionFactory:
<connection-factories>
<tx-connection-factory>
<jndi-name>WMXQueueConnectionFactory</jndi-name>
<use-java-context>false</use-java-context>
<xa-transaction/>
<rar-name>jms-ra.rar</rar-name>
<connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
<blocking-timeout-millis>60000</blocking-timeout-millis>
<min-pool-size>5</min-pool-size>
<max-pool-size>45</max-pool-size>
<idle-timeout-minutes>5</idle-timeout-minutes>
</tx-connection-factory>
</connection-factories>
To using the generic Jboss "/XAConnectionFactory" and the problem went away. This is very good news... however, I imagine that it would be important to Jboss to understand why the problem occurs with the WMXConnectionFactory configuration as to avoid others encountering the same problem.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961711#3961711
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961711
19 years, 8 months
[JBoss/Spring Integration] - Re: Is it SpringLifecycleInterceptor or just me?
by Arno Werr
Exception from SpringLifecycleInterceptor:
| Error message: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoSuchMethodError: javax.interceptor.InvocationContext.getTarget()Ljava/lang/Object;
| Exception in thread "main" javax.ejb.EJBException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoSuchMethodError: javax.interceptor.InvocationContext.getTarget()Ljava/lang/Object;
| at org.jboss.ejb3.cache.simple.SimpleStatefulCache.create(SimpleStatefulCache.java:223)
| at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:288)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
| Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoSuchMethodError: javax.interceptor.InvocationContext.getTarget()Ljava/lang/Object;
| at org.jboss.ejb3.interceptor.LifecycleInterceptorHandler.postConstruct(LifecycleInterceptorHandler.java:109)
| at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:582)
| at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:108)
| at org.jboss.ejb3.ThreadlocalPool.get(ThreadlocalPool.java:48)
| at org.jboss.ejb3.cache.simple.SimpleStatefulCache.create(SimpleStatefulCache.java:207)
| at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:288)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
| at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:190)
| at org.jboss.remoting.Client.invoke(Client.java:525)
| at org.jboss.remoting.Client.invoke(Client.java:488)
| at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulRemoteProxy.invoke(StatefulRemoteProxy.java:133)
| at $Proxy1.initAirports(Unknown Source)
| at com.ileonov.client.Client.init(Client.java:97)
| at com.ileonov.client.Client.run(Client.java:39)
| at com.ileonov.client.Client.main(Client.java:23)
| Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodError: javax.interceptor.InvocationContext.getTarget()Ljava/lang/Object;
| at org.jboss.ejb3.interceptor.LifecycleInvocationContextImpl.proceed(LifecycleInvocationContextImpl.java:141)
| at org.jboss.ejb3.interceptor.LifecycleInterceptorHandler.postConstruct(LifecycleInterceptorHandler.java:105)
| at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:582)
| at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:108)
| at org.jboss.ejb3.ThreadlocalPool.get(ThreadlocalPool.java:48)
| at org.jboss.ejb3.cache.simple.SimpleStatefulCache.create(SimpleStatefulCache.java:207)
| at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:288)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
| Caused by: java.lang.NoSuchMethodError: javax.interceptor.InvocationContext.getTarget()Ljava/lang/Object;
| at org.jboss.spring.callback.SpringLifecycleInterceptor.postConstruct(SpringLifecycleInterceptor.java:44)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.ejb3.interceptor.LifecycleInvocationContextImpl.proceed(LifecycleInvocationContextImpl.java:131)
| ... 13 more
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961699#3961699
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961699
19 years, 8 months
[JBoss/Spring Integration] - Is it SpringLifecycleInterceptor or just me?
by Arno Werr
The other day I decided to play a little with batch processing on JBoss + Spring EJB3 and all.
Created this stateful session bean to force the Entity manager do a batch job for me on remove
| @Stateful
| @Interceptors(SpringLifecycleInterceptor.class)
| @TransactionAttribute(NOT_SUPPORTED)
| public class StetefulBean implements Init {
| @PersistenceContext(unitName = "titan", type = EXTENDED)
| private EntityManager manager;
|
| @Spring(jndiName = "spring-pojo", bean = "statefulService")
| private TravelService service;
|
| @PostConstruct
| public void postConstruct() {
| service.setManager(manager);
| }
|
| public void initAirports(int index) {
| if (isInit(Airport.class)) {
| return;
| }
| List<Airport> lst = new ArrayList<Airport>();
|
| for (int i = 0; i < index; i++) {
| Airport port = new Airport();
| if (i % 2 == 0) {
| port.setName("Denver " + (i + 1));
| port.setAirportCode("dnvr_" + (i + 1));
| } else {
| port.setName("Hoover " + (i + 1));
| port.setAirportCode("hvr_" + (i + 1));
| }
| lst.add(port);
| }
| service.createAirports(lst);
| }
|
| @Remove
| @TransactionAttribute(REQUIRED)
| public void flush() {
| // syncrhonize with database;
| }
|
| private boolean isInit(Class clazz) {
| return service.getNumberOfObjects(clazz) == 0 ? false : true;
| }
| }
|
I am using this SpringLifecycleInterceptor.class from the JBoss+Spring distribution. Unfortunately, that one is giving me kinda trouble throwing all kind of exceptions
OK. Made my own interceptor a la SpringLifecycleInterceptor
| public class StatefulBeanInterceptor extends SpringPassivationInterceptor {
| private static final long serialVersionUID = 1243234L;
| @PostConstruct
| public void postConstruct(InvocationContext ctx) throws Throwable {
| inject(ctx.getBean());
| ctx.proceed();
| }
| }
|
Wired it up. @Interceptors(StatefulBeanInterceptor.class)
Ran JBoss.
No problemo! Works like a charm. There might be something wrong with that SpringLifecyleInterceptor thing from the distribution, or mine might be a bit obsolete (I've downloaded sometime late June, I guess). No idea...
Another question - how to inject EntityManager from Spring configuration. Currently I am using annotations and pushing manager to the service layer. Yet wiring it up from outside, Spring, I mean, would be kinda kool to me.
Cheers,
Arno
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961698#3961698
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961698
19 years, 8 months
[Security & JAAS/JBoss] - Re: Adding roles to user on the fly
by kuzmiigo
Some additional information.
jboss-web.xml:
<jboss-web>
| <security-domain>java:/jaas/testdomain</security-domain>
| </jboss-web>
>From login-config.xml:
<application-policy name="testdomain">
| <authentication>
| <login-module code="com.test.security.SpecialLoginModule1" flag="required">
| <module-option name="password-stacking">useFirstPass</module-option>
| <module-option name="dsJndiName">java:/DefaultDS</module-option>
| </login-module>
| <login-module code="com.test.security.SpecialLoginModule2" flag="required">
| <module-option name="password-stacking">useFirstPass</module-option>
| <module-option name="dsJndiName">java:/DefaultDS</module-option>
| </login-module>
| </authentication>
| </application-policy>
Flushing code:
String domain = "testdomain";
| Principal principal = new SimplePrincipal(user.getUsername());
| ObjectName jaasMgr = new ObjectName("jboss.security:service=JaasSecurityManager");
| Object[] params = { domain, principal };
| String[] signature = { "java.lang.String", Principal.class.getName() };
| MBeanServer server = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
| server.invoke(jaasMgr, "flushAuthenticationCache", params, signature);
Credentials caching is disabled, after flushing (just in case) Subject is not populated again (LoginModules are not called again to populate "Roles" group).
I would be grateful for your comments,
Igor
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961697#3961697
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961697
19 years, 8 months