[EJB 3.0] - Re: Cluster Stateful EJB 3.0 problems
by viniciuscarvalho
Well, I've turned on the tracing on the client, and here's what I get before the first invocation:
| TRACE [main] HARMIClient.readObject(314) | Init, clusterInfo: org.jboss.ha.framework.interfaces.FamilyClusterInfoImpl@2f549848{familyName=DefaultPartition/HAJNDI,targets=[HARMIServerImpl_Stub[UnicastRef2 [liveRef: [endpoint:[127.0.0.1:1101](remote),objID:[-63ed3ba3:113211d2bae:-7ffb, 8972489255603988726]]]], HARMIServerImpl_Stub[UnicastRef2 [liveRef: [endpoint:[127.0.0.1:1101](remote),objID:[-63ed3ba3:113211d2bae:-7ffb, 8972489255603988726]]]]],currentViewId=-71890248,isViewMembersInSyncWithViewId=false,cursor=999999999,arbitraryObject=null}, policy=org.jboss.ha.framework.interfaces.RoundRobin@a97b0b
| TRACE [main] HARMIClient.invokeRemote(167) | Invoking on target=HARMIServerImpl_Stub[UnicastRef2 [liveRef: [endpoint:[127.0.0.1:1101](remote),objID:[-63ed3ba3:113211d2bae:-7ffb, 8972489255603988726]]]]
| TRACE [main] HARMIClient.invokeRemote(167) | Invoking on target=HARMIServerImpl_Stub[UnicastRef2 [liveRef: [endpoint:[127.0.0.1:1101](remote),objID:[-63ed3ba3:113211d2bae:-7ffb, 8972489255603988726]]]]
| TRACE [main] PropertyEditors.mapJavaBeanProperties(316) | Mapping properties for bean: SocketClientInvoker[1301ed8, socket://127.0.0.1:3873]
| DEBUG [main] MicroSocketClientInvoker.<init>(244) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] constructed
| DEBUG [main] MicroRemoteClientInvoker.connect(240) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] connecting
| DEBUG [main] MicroSocketClientInvoker.initPool(711) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] added new pool ([]) as ServerAddress[127.0.0.1:3873, NO enableTcpNoDelay timeout 0 ms]
| DEBUG [main] MicroRemoteClientInvoker.connect(245) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] connected
| TRACE [main] MicroRemoteClientInvoker.invoke(63) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873](1) invoking InvocationRequest[edc3a2, AOP, [advisedMethod=public abstract java.lang.Object org.jboss.ejb3.ProxyFactory.createProxy(), unadvisedMethod=public abstract java.lang.Object org.jboss.ejb3.ProxyFactory.createProxy(), metadata=[metaData={DISPATCHER={OID=[type=AS_ISvalue=jboss.j2ee:jar=increment.jar,name=ContadorBean,service=EJB3,element=ProxyFactory,partition=DefaultPartition]}, REMOTING={SUBSYSTEM=[type=AS_ISvalue=AOP], INVOKER_LOCATOR=[type=AS_ISvalue=InvokerLocator [socket://127.0.0.1:3873/]]}}], targetObject=null, arguments=null]]
| TRACE [main] MicroSocketClientInvoker.getConnection(776) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] getting a socket, usedPooled: 0
| TRACE [main] MicroSocketClientInvoker.getConnection(800) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] creating socket 0, attempt 1
| TRACE [main] MicroSocketClientInvoker.getConnection(802) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] created socket: Socket[addr=/127.0.0.1,port=3873,localport=59398]
| TRACE [main] SocketWrapper.<init>(67) | constructing org.jboss.remoting.transport.socket.ClientSocketWrapper instance for Socket[addr=/127.0.0.1,port=3873,localport=59398], using timeout 0
| TRACE [main] SocketWrapper.setTimeout(81) | ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=59398].29428e] setting timeout to 0
| TRACE [main] ClientSocketWrapper.createOutputStream(194) | ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=59398].29428e] getting output stream from Socket[addr=/127.0.0.1,port=3873,localport=59398], org.jboss.remoting.marshal.serializable.SerializableMarshaller@d0a5d9
| TRACE [main] JavaSerializationManager.createOutput(61) | Creating ObjectOutputStream
| TRACE [main] ClientSocketWrapper.createInputStream(176) | ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=59398].29428e] getting input stream from Socket[addr=/127.0.0.1,port=3873,localport=59398], org.jboss.remoting.marshal.serializable.SerializableUnMarshaller@388993
| TRACE [main] JavaSerializationManager.createInput(52) | Creating ObjectInputStreamWithClassLoader
| TRACE [main] SocketWrapper.setTimeout(81) | ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=59398].29428e] setting timeout to 0
| DEBUG [main] ClientSocketWrapper.createStreams(169) | reset timeout: 0
| TRACE [main] MicroSocketClientInvoker.writeVersion(994) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] writing version 22 on output stream
| TRACE [main] MicroSocketClientInvoker.versionedWrite(965) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] writing invocation to marshaller
| TRACE [main] MicroSocketClientInvoker.versionedWrite(970) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] done writing invocation to marshaller
| TRACE [main] MicroSocketClientInvoker.readVersion(985) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] reading version from input stream
| TRACE [main] MicroSocketClientInvoker.readVersion(987) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] read version 22 from input stream
| TRACE [main] MicroSocketClientInvoker.versionedRead(941) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] reading response from unmarshaller
| TRACE [main] MicroSocketClientInvoker.transport(667) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] returned ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=59398].29428e] to pool
| TRACE [main] MicroSocketClientInvoker.transport(682) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] received response InvocationResponse[1b9240e, org.jboss.aop.joinpoint.InvocationResponse@1ee4648]
| TRACE [main] MicroRemoteClientInvoker.invoke(181) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] received InvocationResponse so going to return response's return value of org.jboss.aop.joinpoint.InvocationResponse@1ee4648
| TRACE [main] InvokerRegistry.destroyClientInvoker(213) | destroying client invoker InvokerLocator [socket://127.0.0.1:3873/], config {}
| DEBUG [main] InvokerRegistry.decrementClientInvokerCounter(595) | removed SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] from registry
| TRACE [main] InvokerRegistry.destroyClientInvoker(222) | disconnecting SocketClientInvoker[1301ed8, socket://127.0.0.1:3873]
| DEBUG [main] MicroSocketClientInvoker.disconnect(277) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] disconnecting ...
| TRACE [main] MicroRemoteClientInvoker.disconnect(273) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] disconnecting ...
| TRACE [main] MicroSocketClientInvoker.clearPools(159) | clearing pool for ServerAddress[127.0.0.1:3873, NO enableTcpNoDelay timeout 0 ms]
| DEBUG [main] SocketWrapper.close(123) | ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=59398].29428e] closing
| TRACE [main] MicroRemoteClientInvoker.disconnect(284) | SocketClientInvoker[1301ed8, socket://127.0.0.1:3873] disconnected
| TRACE [main] ClusteredIsLocalInterceptor.findLocalContainer(69) | Cannot find local container for jboss.j2ee:jar=increment.jar,name=ContadorBean,service=EJB3
| DEBUG [main] SecurityAssociation.<clinit>(143) | Using ThreadLocal: false
| TRACE [main] SecurityAssociation.getPrincipal(190) | getPrincipal, principal=null
| TRACE [main] PropertyEditors.mapJavaBeanProperties(316) | Mapping properties for bean: SocketClientInvoker[1f6f296, socket://127.0.0.1:3873]
| DEBUG [main] MicroSocketClientInvoker.<init>(244) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] constructed
| DEBUG [main] MicroRemoteClientInvoker.connect(240) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] connecting
| DEBUG [main] MicroSocketClientInvoker.initPool(711) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] added new pool ([]) as ServerAddress[127.0.0.1:3873, NO enableTcpNoDelay timeout 0 ms]
| DEBUG [main] MicroRemoteClientInvoker.connect(245) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] connected
| TRACE [main] MicroRemoteClientInvoker.invoke(63) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873](1) invoking InvocationRequest[1b09468, AOP, [id=null, MethodInvocation=[advisedMethod=public abstract int x.x.x.jboss.ejb.Contador.increase(), unadvisedMethod=public abstract int x.x.x.jboss.ejb.Contador.increase(), metadata=[metaData={PARTITION_NAME={PARTITION_NAME=[type=TRANSIENTvalue=DefaultPartition]}, DISPATCHER={OID=[type=AS_ISvalue=jboss.j2ee:jar=increment.jar,name=ContadorBean,service=EJB3]}, REMOTING={SUBSYSTEM=[type=AS_ISvalue=AOP], INVOKER_LOCATOR=[type=AS_ISvalue=InvokerLocator [socket://127.0.0.1:3873/]]}, CLUSTERED_REMOTING={CLUSTER_VIEW_ID=[type=AS_ISvalue=0], FAILOVER_COUNTER=[type=AS_ISvalue=0], CLUSTER_FAMILY_WRAPPER=[type=AS_ISvalue=org.jboss.aspects.remoting.FamilyWrapper@10bc49d], CLUSTER_FAMILY=[type=AS_ISvalue=jar=increment.jar,name=ContadorBeansocketDefaultPartition], LOADBALANCE_POLICY=[type=AS_ISvalue=org.jboss.ha.framework.interfaces.FirstAvailable@587c94]}}], targetObject=null, arguments=null]]]
| TRACE [main] MicroSocketClientInvoker.getConnection(776) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] getting a socket, usedPooled: 0
| TRACE [main] MicroSocketClientInvoker.getConnection(800) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] creating socket 1, attempt 1
| TRACE [main] MicroSocketClientInvoker.getConnection(802) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] created socket: Socket[addr=/127.0.0.1,port=3873,localport=59399]
| TRACE [main] SocketWrapper.<init>(67) | constructing org.jboss.remoting.transport.socket.ClientSocketWrapper instance for Socket[addr=/127.0.0.1,port=3873,localport=59399], using timeout 0
| TRACE [main] SocketWrapper.setTimeout(81) | ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=59399].b2a2d8] setting timeout to 0
| TRACE [main] ClientSocketWrapper.createOutputStream(194) | ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=59399].b2a2d8] getting output stream from Socket[addr=/127.0.0.1,port=3873,localport=59399], org.jboss.remoting.marshal.serializable.SerializableMarshaller@1e13d52
| TRACE [main] JavaSerializationManager.createOutput(61) | Creating ObjectOutputStream
| TRACE [main] ClientSocketWrapper.createInputStream(176) | ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=59399].b2a2d8] getting input stream from Socket[addr=/127.0.0.1,port=3873,localport=59399], org.jboss.remoting.marshal.serializable.SerializableUnMarshaller@80fa6f
| TRACE [main] JavaSerializationManager.createInput(52) | Creating ObjectInputStreamWithClassLoader
| TRACE [main] SocketWrapper.setTimeout(81) | ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=59399].b2a2d8] setting timeout to 0
| DEBUG [main] ClientSocketWrapper.createStreams(169) | reset timeout: 0
| TRACE [main] MicroSocketClientInvoker.writeVersion(994) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] writing version 22 on output stream
| TRACE [main] MicroSocketClientInvoker.versionedWrite(965) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] writing invocation to marshaller
| TRACE [main] MicroSocketClientInvoker.versionedWrite(970) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] done writing invocation to marshaller
| TRACE [main] MicroSocketClientInvoker.readVersion(985) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] reading version from input stream
| TRACE [main] MicroSocketClientInvoker.readVersion(987) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] read version 22 from input stream
| TRACE [main] MicroSocketClientInvoker.versionedRead(941) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] reading response from unmarshaller
| TRACE [main] MicroSocketClientInvoker.transport(667) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] returned ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=59399].b2a2d8] to pool
| TRACE [main] MicroSocketClientInvoker.transport(682) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] received response InvocationResponse[4fce71, org.jboss.aop.joinpoint.InvocationResponse@17a8a02]
| TRACE [main] MicroRemoteClientInvoker.invoke(181) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] received InvocationResponse so going to return response's return value of org.jboss.aop.joinpoint.InvocationResponse@17a8a02
| TRACE [main] InvokerRegistry.destroyClientInvoker(213) | destroying client invoker InvokerLocator [socket://127.0.0.1:3873/], config {}
| DEBUG [main] InvokerRegistry.decrementClientInvokerCounter(595) | removed SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] from registry
| TRACE [main] InvokerRegistry.destroyClientInvoker(222) | disconnecting SocketClientInvoker[1f6f296, socket://127.0.0.1:3873]
| DEBUG [main] MicroSocketClientInvoker.disconnect(277) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] disconnecting ...
| TRACE [main] MicroRemoteClientInvoker.disconnect(273) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] disconnecting ...
| TRACE [main] MicroSocketClientInvoker.clearPools(159) | clearing pool for ServerAddress[127.0.0.1:3873, NO enableTcpNoDelay timeout 0 ms]
| DEBUG [main] SocketWrapper.close(123) | ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=59399].b2a2d8] closing
| TRACE [main] MicroRemoteClientInvoker.disconnect(284) | SocketClientInvoker[1f6f296, socket://127.0.0.1:3873] disconnected
| O total é:1
|
It seems that it is not listing the available bean on the other node. I've also turned on the trace level for jgroups and the clusters are communicating all the time through ack messages. BUT, I tried to use the second cluster as my JNDI provider and I'm getting a connection refused. There's no firewall, the udp multicast is working and I'm using the same version of jbossall-client.jar on both servers and the client. Could this be the problem? If so, any hints?
Regards
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4053686#4053686
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4053686
18Â years, 11Â months
[JBoss Seam] - s:convertEntity with non-numeric @Id
by awhitford
According to the documentation:
anonymous wrote :
| The converter works with any entity which has an @Id annotation - either simple or composite.
|
But if I try to use it with an Entity that has a String as the @Id, I get a NumberFormatException:
| java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
| java.lang.Integer.parseInt(Integer.java:447)
| java.lang.Integer.<init>(Integer.java:620)
| org.jboss.seam.ui.EntityConverter.getAsObject(EntityConverter.java:80)
| com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:152)
|
So this would lead me to believe that it works only for numbers. Can this please be emphasized in the documentation?
So what do I need to do? I guess I need to delcare my own converter? And then how do I get it wired in?
Or could EntityConverter be enhanced to handle String @Id Entities? (Overload the get method in EntityConverterStore, and do some kind of class meta-data check in EntityConverter?)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4053685#4053685
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4053685
18Â years, 11Â months
[EJB 3.0] - Error creating MBeanProxy when using @Depends
by mbarker
I used a Trailblazer tutorial as the basis for my example.
http://trailblazer.demo.jboss.com/EJB3Trail/serviceobjects/jmx/index.html
The managment interfaces are Calculator and InvestmentAdvisor. The MBeans are CalculatorMBean and InvestmentAdvisorMBean. I want to inject Calculator into my other MBean, InvestmentAdvisorMBean. I receive an MBeanProxy error when deploying on JBoss 4.2.0.GA.
[EJBContainer] STARTED EJB: com.csg.mpg.service.CalculatorMBean ejbName: CalculatorMBean
[STDOUT] Calculator - Creating
[JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.service.ServiceContainer
[JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=mpg-ejbs-1.0.0-SNAPSHOT.jar,name=InvestmentAdvisorMBean,service=EJB3 with dependencies:
[JmxKernelAbstraction] trail:service=calculator
[EJBContainer] STARTED EJB: com.csg.mpg.service.InvestmentAdvisorMBean ejbName: InvestmentAdvisorMBean
[STDERR] java.lang.RuntimeException: Error creating MBeanProxy: trail:service=calculator
[STDERR] at org.jboss.mx.util.MBeanProxyExt.init(MBeanProxyExt.java:415)
[STDERR] at org.jboss.mx.util.MBeanProxyExt.(MBeanProxyExt.java:99)
[STDERR] at org.jboss.mx.util.MBeanProxyExt.create(MBeanProxyExt.java:394)
[STDERR] at org.jboss.mx.util.MBeanProxyExt.create(MBeanProxyExt.java:349)
I'd prefer to stick with the following because I can call calculator.calculate
directly.
@Depends ("trail:service=calculator")
public void setCalculator (Calculator calculator) {
this.calculator = calculator;
}
but I discovered that the following works
@Depends ("trail:service=calculator")
private ObjectName calculatorName;
It is clumsy since I have to loop through the various mbean servers (I have
two for some reason) in order get the mbean and then call invoke.
Any thoughts on what I am missing?
Here are my classes
| public interface Calculator {
| // Attribute
| public void setGrowthrate(double g);
|
| public double getGrowthrate();
|
| // The management method
| public double calculate(int start, int end, double saving);
|
| // Life cycle method
| public void create() throws Exception;
|
| public void destroy() throws Exception;
| }
|
| @Service(objectName = "trail:service=calculator")
| @Management(Calculator.class)
| public class CalculatorMBean implements Calculator {
|
| double growthrate;
|
| public void setGrowthrate(double growthrate) {
| this.growthrate = growthrate;
| }
|
| public double getGrowthrate() {
| return growthrate;
| }
|
| public double calculate(int start, int end, double saving) {
| double tmp = Math.pow(1. + growthrate / 12., 12. * (end - start) + 1);
| return saving * 12. * (tmp - 1) / growthrate;
| }
|
| // Lifecycle methods
| public void create() throws Exception {
| growthrate = 0.08;
| System.out.println("Calculator - Creating");
| }
|
| public void destroy() {
| System.out.println("Calculator - Destroying");
| }
|
| }
| public interface InvestmentAdvisor {
|
| // The management method
| public void advise();
|
| // Life cycle method
| public void create() throws Exception;
|
| public void destroy() throws Exception;
| }
| @Service (objectName="trail:service=investmentAdvisor")
| @Management(InvestmentAdvisor.class)
| public class InvestmentAdvisorMBean implements InvestmentAdvisor {
|
| private Calculator calculator;
|
| @Depends ("trail:service=calculator")
| public void setCalculator (Calculator calculator) {
| this.calculator = calculator;
| }
|
| public void create() throws Exception {
| System.out.println("InvestmentAdvisorMBean created");
| }
|
| public void destroy() throws Exception {
| System.out.println("InvestmentAdvisorMBean destroyed");
| }
|
| public void advise() {
| System.out.println("InvestmentAdvisorMBean advising");
| calculator.calculate(25, 65, 300);
|
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4053675#4053675
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4053675
18Â years, 11Â months
[EJB 3.0] - Re: Cluster Stateful EJB 3.0 problems
by viniciuscarvalho
Well here's the code for the client:
| public void execute(){
| Contador contador = obterContador();
| int total = 0;
| for(int i=0;i<repeat;i++){
| total = contador.increase();
| System.out.println("O total é:" + total);
| try {
| Thread.sleep(5000);
| } catch (InterruptedException e) {
| e.printStackTrace();
| }
| }
| }
|
| public Contador obterContador(){
| Contador contador = null;
| try {
| Properties p = new Properties();
| p.put(Context.INITIAL_CONTEXT_FACTORY,
| "org.jnp.interfaces.NamingContextFactory");
| p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
| p.put(Context.PROVIDER_URL, "192.168.0.39:1100"); // HA-JNDI port.
|
| InitialContext ctx = new InitialContext(p);
| contador = (Contador) ctx.lookup("ContadorBean/remote");
| } catch (NamingException e) {
| e.printStackTrace();
| }
| return contador;
| }
|
Yeah, pretty much what you've described :
After a few calls and during the sleep of the client, I shutdown the server that is responding to the calls. I was hopping that the second node would answer the calls.
PS: I've ran the JGroups tests for receiver and sender, the draw example, and both works ok.
Best regards
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4053674#4053674
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4053674
18Â years, 11Â months