[JBoss Messaging] - Re: Reliable delivery
by vc123
"ataylor" wrote : anonymous wrote : But, what about non_persistent messages ? In the current JM implementation non_persistent delivery performance seems to be determined by the relational database backend too as I wrote earlier, though it does not suffer from sync writes as much as persistent delivery does.
|
| The only time non persistent messages are written to the database is if paging kicks in. Theres a configurable limit on a destination that controls how many messages can be held in memory. at any point. Are you consuming the messages in your test?
Andy,
Wile we are at it, I substituted Postgres for Oracle since it is more readily available to anyone wishing to try my simple test.
We have two goals with our application: the fastest possible non_persistent delivery and control message persistent delivery with a desired rate of a dozen m/s. While the second goal seems to be satisfiable, the first is a bit tricky.
Here's the sender/receiver code.
| -- Sender
|
| import java.util.Properties;
| import javax.jms.*;
| import javax.naming.*;
|
| class MySender {
| static boolean keepSending = false;
| static int count = 0;
|
| static class Thread1 extends Thread {
| int oldCount= 0;
| public void run() {
| try {
| while(true) {
| sleep(10000);
| // keepSending = false;
| System.out.println("Sent per sec: "+ (count - oldCount)/10);
| oldCount= count;
| }
| } catch (Exception e) {System.out.println(e);}
| }
| }
|
| public static void main(String[] argv) throws Exception
| {
|
| String URL = "jnp://localhost:1099";
| Properties env = new Properties();
| env.put(Context.PROVIDER_URL, URL);
| env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| InitialContext ctx = new InitialContext(env);
| QueueConnectionFactory qcf = (QueueConnectionFactory)ctx.lookup("ConnectionFactory");
|
|
| QueueConnection conn = qcf.createQueueConnection();
| QueueSession sess = conn.createQueueSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
| Queue queue = sess.createQueue("q1");
|
|
| BytesMessage message = sess.createBytesMessage();
| byte[] content = new byte[1024];
| for (int i = 0; i < content.length; i++)
| {
| content = (byte) (i & 0xFF);
| }
| message.writeBytes(content);
|
| QueueSender sender = sess.createSender(queue);
| conn.start();
|
| keepSending=true;
| (new Thread1()).start();
| while (keepSending)
| {
| sender.send(message, javax.jms.DeliveryMode.NON_PERSISTENT, 4, 1000);
| count++;
| }
| System.out.println("Count: "+count);
|
| }
|
| }
|
| -- Receiver
|
| import java.util.Properties;
| import javax.jms.*;
| import javax.naming.*;
|
| class MyReceiver implements MessageListener {
| static int count = 0;
|
| static class Thread1 extends Thread {
| int oldCount= 0;
| public void run() {
| try {
| while(true) {
| sleep(10000);
| System.out.println("Received per sec: "+ (count - oldCount)/10);
| oldCount= count;
| }
| } catch (Exception e) {System.out.println(e);}
| }
| }
|
| public void onMessage(Message message)
| {
| BytesMessage bm = (BytesMessage) message;
| count++;
| }
|
| public static void main(String[] argv) throws Exception
| {
|
| String URL = "jnp://localhost:1099";
| Properties env = new Properties();
| env.put(Context.PROVIDER_URL, URL);
| env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| InitialContext ctx = new InitialContext(env);
| QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
|
|
| QueueConnection conn = qcf.createQueueConnection();
| QueueSession sess = conn.createQueueSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
| Queue queue = sess.createQueue("q1");
|
| QueueReceiver receiver = sess.createReceiver(queue);
| receiver.setMessageListener(new MyReceiver());
|
| (new Thread1()).start();
| conn.start();
|
| Thread.sleep(3600*10000);
| }
|
| }
|
The sender, receiver and the Messaging ran in three separate VMs. The Messaging ran under Jboss 4.2.2 but the results are similar with 5.0 Beta 4. Every ten second, both S and R print the current message rate.
Here's what happens, see the output:
| --Sender
|
| Sent per sec: 12544
| Sent per sec: 17100
| Sent per sec: 12134
| Sent per sec: 13414
| Sent per sec: 11161
| Sent per sec: 8089
| Sent per sec: 4044
| Sent per sec: 1502
| Sent per sec: 238
| Sent per sec: 68
| Sent per sec: 21
| Sent per sec: 0
|
| -- Receiver
|
| Received per sec: 13879
| Received per sec: 16058
| Received per sec: 9916
| Received per sec: 11360
| Received per sec: 6189
| Received per sec: 3958
| Received per sec: 2104
| Received per sec: 397
| Received per sec: 8
| Received per sec: 0
| Received per sec: 0
| Received per sec: 0
|
|
as you can see, after a short while the consumer cannot consume and the producer cannot produce any more. Upon killing both S and R, the JBoss Messaging dies with this stack:
| 08:57:38,423 ERROR [ServerConsumerEndpoint] Failed to expire delivery: Delivery[Reference[5480029]:NON-RELIABLE]
| java.lang.OutOfMemoryError: GC overhead limit exceeded
| at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:45)
| at java.lang.StringBuilder.<init>(StringBuilder.java:68)
| at org.jboss.jms.destination.JBossQueue.toString(JBossQueue.java:80)
| at org.jboss.jms.server.endpoint.ServerSessionEndpoint.makeCopyForDLQOrExpiry(ServerSessionEndpoint.java:1655)
| at org.jboss.jms.server.endpoint.ServerSessionEndpoint.expireDelivery(ServerSessionEndpoint.java:1085)
| at org.jboss.jms.server.endpoint.ServerConsumerEndpoint.handle(ServerConsumerEndpoint.java:231)
| at org.jboss.messaging.core.impl.RoundRobinDistributor.handle(RoundRobinDistributor.java:119)
| at org.jboss.messaging.core.impl.MessagingQueue$DistributorWrapper.handle(MessagingQueue.java:582)
| at org.jboss.messaging.core.impl.ClusterRoundRobinDistributor.handle(ClusterRoundRobinDistributor.java:79)
| at org.jboss.messaging.core.impl.ChannelSupport.deliverInternal(ChannelSupport.java:606)
| at org.jboss.messaging.core.impl.MessagingQueue.deliverInternal(MessagingQueue.java:505)
| at org.jboss.messaging.core.impl.ChannelSupport.deliver(ChannelSupport.java:356)
| at org.jboss.jms.server.endpoint.ServerSessionEndpoint$2.run(ServerSessionEndpoint.java:1539)
| at EDU.oswego.cs.dl.util.concurrent.QueuedExecutor$RunLoop.run(QueuedExecutor.java:89)
| at java.lang.Thread.run(Thread.java:619)
| 08:57:55,232 ERROR [STDERR] Exception in thread "WorkerThread#1[127.0.0.1:60882]"
|
VJ
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128768#4128768
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128768
18 years, 2 months
[JBoss Seam] - NotLoggedInException
by vwiencek
Hello,
I've a xhtml page using a session bean to acces my entities. When I trying to access some entities, sometimes, for some entities, I need to be identified ...
When I throw a NotLoggedInException, I get an error on the page. Why is'nt that exception caught by seam, to force a redirection to login.xhtml ?
I can't use @Restrict, because I need to execute the method and query the entity to know if it is restricted.
| @Unwrap
| public Wedding getWedding() {
| if (wedding != null && wedding.getSiteName().equals(name))
| return wedding;
| try{
| wedding = (Wedding)em
| .createQuery("from Wedding where siteName like :name")
| .setParameter("name", name)
| .getSingleResult();
|
| if (wedding.getIsPrivate()){
| if (currentUser == null ||
| !currentUser.isAllowedToView(wedding)) {
| log.info("must be loggued");
| throw new org.jboss.seam.security.NotLoggedInException();
| }
| }
|
| return wedding;
| }
| catch (NoResultException e) {
| log.info("no existing wedding");
| }
| return null;
| }
|
Is my code/question stupide ?
Thx
Vincent
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128762#4128762
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128762
18 years, 2 months
[Persistence, JBoss/CMP, Hibernate, Database] - adding a constraint with @PrimaryKeyJoinColumn
by anewton
I have two entities that are sharing a primary key using @PrimaryKeyJoinColumn. When the schema is created with hbm2ddl, no foreign key constraint is add. Is there an extra annotation that I need to use to get the constraint generated? I'm using Seam 2.0.0.GA on JBoss 4.2.2.GA. My Hibernate dependencies look like this:
| [INFO] +- org.hibernate:hibernate:jar:3.2.4.sp1:provided
| [INFO] | +- javax.transaction:jta:jar:1.0.1B:provided
| [INFO] | +- asm:asm-attrs:jar:1.5.3:provided
| [INFO] | +- antlr:antlr:jar:2.7.6:provided
| [INFO] | +- cglib:cglib:jar:2.1_3:provided
| [INFO] | \- asm:asm:jar:1.5.3:provided
| [INFO] +- org.hibernate:hibernate-annotations:jar:3.3.0.ga:provided
| [INFO] +- org.hibernate:hibernate-entitymanager:jar:3.3.1.ga:provided
| [INFO] | +- org.hibernate:hibernate-commons-annotations:jar:3.0.0.ga:provided
| [INFO] | \- jboss:jboss-common-core:jar:2.0.4.GA:provided
| [INFO] +- org.hibernate:hibernate-validator:jar:3.0.0.GA:provided
|
Here are the two classes:
| @Entity
| @Name( "user" )
| @Scope( SESSION )
| @Table( name = "WEB_USER" )
| public class User implements Serializable
| {
| private String id;
| private Profile profile;
|
| @Id
| @NotNull
| @GeneratedValue( strategy = GenerationType.AUTO )
| @Column( name = "WEB_USER_ID" )
| public String getId()
| {
| return id;
| }
|
| public void setId( String id )
| {
| this.id = id;
| }
|
| @OneToOne( cascade = CascadeType.ALL )
| @PrimaryKeyJoinColumn
| public Profile getProfile()
| {
| return profile;
| }
|
| public void setProfile( Profile profile )
| {
| this.profile = profile;
| }
| }
|
and
| @Entity
| @Name( "profile" )
| @Table( name = "WEB_USER_PROFILE" )
| public class Profile implements Serializable
| {
| private String id;
|
| @Id
| @Column( name = "WEB_USER_ID", nullable = false )
| public String getId()
| {
| return id;
| }
|
| public void setId( String id )
| {
| this.id = id;
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128753#4128753
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128753
18 years, 2 months
[JBossWS] - Re: WS-Security Newbie Question...
by shashankjain
Hi,
My client jar is configured like this
META-INF
jboss-wsse-client.xml
standard-jaxws-client.xml
com
test
Has all proxy classes generated by wsconsume tool
and
com
test
standalone
Has the java class for calling the web service through the port
All my files are configured properly and I am setting all jars required as per wsrunclient tool in the classpath. Still the client is not adding the <wsse-security tags as required by server. This is the error I get on server.Seems server is set up properly to accept the encryped data but client is unable to call the outbound handler...
This is the client messges I get
DEBUG [main] (JAXWSClientMetaDataBuilder.java:77) - START buildMetaData: [servic
e={http://org.jboss.ws/samples/wssecurity}SecureService]
DEBUG [main] (WSDLDefinitionsFactory.java:102) - parse: http://127.0.0.1:8080/Te
stSecure/SecureService?wsdl
DEBUG [main] (JAXWSClientMetaDataBuilder.java:103) - END buildMetaData:
UnifiedMetaData:
implementation: jbossws-native-2.0.3.GA (build=200801251318)
deploymentName: null
securityDomain: null
ServiceMetaData:
qname={http://org.jboss.ws/samples/wssecurity}SecureService
refName=null
wsdName=null
wsdlFile=null
wsdlLocation=http://127.0.0.1:8080/TestSecure/SecureService?wsdl
jaxrpcMapping=null
publishLocation=null
securityConfig=null
properties=null
TypesMetaData:
ClientEndpointMetaData:
type=JAXWS
qname={http://org.jboss.ws/samples/wssecurity}SecureServicePort
address=http://127.0.0.1:8080/TestSecure/SecureService
binding=http://schemas.xmlsoap.org/wsdl/soap/http
seiName=null
configFile=META-INF/standard-jaxws-client-config.xml
configName=Standard Client
authMethod=null
properties={}
OperationMetaData:
qname={http://org.jboss.ws/samples/wssecurity}getName
javaName={http://org.jboss.ws/samples/wssecurity}getName
style=rpc/literal
oneWay=false
soapAction=
DEBUG [main] (JAXWSClientMetaDataBuilder.java:277) - START: rebuildMetaData
DEBUG [main] (EndpointMetaData.java:311) - setParameterStyle: null
DEBUG [main] (JAXWSMetaDataBuilder.java:134) - processSOAPBinding on: com.hp.sec
urity.client.SecureService
DEBUG [main] (EndpointMetaData.java:311) - setParameterStyle: WRAPPED
DEBUG [main] (EndpointMetaData.java:708) - Create new config [name=Standard Clie
nt,file=META-INF/standard-jaxws-client-config.xml]
DEBUG [main] (JBossWSConfigFactory.java:125) - getConfig: [name=Standard Client,
url=META-INF/standard-jaxws-client-config.xml]
DEBUG [main] (JBossWSConfigFactory.java:71) - parse: jar:file:/C:/jboss_new/clie
nt/jbossws-client.jar!/META-INF/standard-jaxws-client-config.xml
DEBUG [main] (EndpointMetaData.java:763) - Configure EndpointMetaData
DEBUG [main] (EndpointMetaData.java:775) - Added 0 PRE handlers
DEBUG [main] (EndpointMetaData.java:776) - Added 0 ENDPOINT handlers
DEBUG [main] (EndpointMetaData.java:777) - Added 0 POST handlers
DEBUG [main] (JAXWSMetaDataBuilder.java:938) - JAXBContext [types=[class java.la
ng.String, class java.lang.String],tns=http://org.jboss.ws/samples/wssecurity]
DEBUG [main] (OperationMetaData.java:207) - Found best matching java method: pub
lic abstract java.lang.String com.hp.security.client.SecureService.getName(java.
lang.String)
DEBUG [main] (JAXWSClientMetaDataBuilder.java:323) - END: rebuildMetaData
ServiceMetaData:
qname={http://org.jboss.ws/samples/wssecurity}SecureService
refName=null
wsdName=null
wsdlFile=null
wsdlLocation=http://127.0.0.1:8080/TestSecure/SecureService?wsdl
jaxrpcMapping=null
publishLocation=null
securityConfig=null
properties=null
TypesMetaData:
[complexType={http://www.w3.org/2001/XMLSchema}string,javaType=java.lang.S...
g]
ClientEndpointMetaData:
type=JAXWS
qname={http://org.jboss.ws/samples/wssecurity}SecureServicePort
address=http://127.0.0.1:8080/TestSecure/SecureService
binding=http://schemas.xmlsoap.org/wsdl/soap/http
seiName=com.hp.security.client.SecureService
configFile=META-INF/standard-jaxws-client-config.xml
configName=Standard Client
authMethod=null
properties={}
OperationMetaData:
qname={http://org.jboss.ws/samples/wssecurity}getName
javaName=getName
style=rpc/literal
oneWay=false
soapAction=
ParameterMetaData:
xmlName=name
partName=name
xmlType={http://www.w3.org/2001/XMLSchema}string
javaType=java.lang.String
mode=IN
inHeader=false
index=0
ReturnMetaData:
xmlName=return
partName=return
xmlType={http://www.w3.org/2001/XMLSchema}string
javaType=java.lang.String
mode=OUT
inHeader=false
index=-1
DEBUG [main] (EndpointMetaData.java:628) - Configure SOAPBinding
DEBUG [main] (HandlerResolverImpl.java:125) - initHandlerChain: PRE
DEBUG [main] (HandlerResolverImpl.java:125) - initHandlerChain: ENDPOINT
DEBUG [main] (HandlerResolverImpl.java:125) - initHandlerChain: POST
DEBUG [main] (HandlerResolverImpl.java:99) - getHandlerChain: [type=PRE,info=[se
rvice={http://org.jboss.ws/samples/wssecurity}SecureService,port={http://org.jbo
ss.ws/samples/wssecurity}SecureServicePort,binding=http://schemas.xmlsoap...
dl/soap/http]]
DEBUG [main] (HandlerResolverImpl.java:99) - getHandlerChain: [type=POST,info=[s
ervice={http://org.jboss.ws/samples/wssecurity}SecureService,port={http://org.jb
oss.ws/samples/wssecurity}SecureServicePort,binding=http://schemas.xmlsoa...
sdl/soap/http]]
DEBUG [main] (HandlerResolverImpl.java:99) - getHandlerChain: [type=ENDPOINT,inf
o=[service={http://org.jboss.ws/samples/wssecurity}SecureService,port={http://or
g.jboss.ws/samples/wssecurity}SecureServicePort,binding=http://schemas.xmlsoap.o
rg/wsdl/soap/http]]
DEBUG [main] (BindingImpl.java:94) - setHandlerChain: []
DEBUG [main] (ServiceDelegateImpl.java:427) - No port configuration for: {http:/
/org.jboss.ws/samples/wssecurity}SecureServicePort
DEBUG [main] (MessageContextAssociation.java:46) - pushMessageContext: org.jboss
.ws.core.jaxws.handler.SOAPMessageContextJAXWS@322bce (Thread main)
DEBUG [main] (EndpointInvocation.java:103) - setRequestParamValue: [name=name,va
lue=java.lang.String]
DEBUG [main] (CommonSOAPBinding.java:144) - bindRequestMessage: {http://org.jbos
s.ws/samples/wssecurity}getName
DEBUG [main] (CommonSOAPBinding.java:189) - Create RPC body element: {http://org
.jboss.ws/samples/wssecurity}getName
DEBUG [main] (EndpointInvocation.java:110) - getRequestParamValue: name
DEBUG [main] (EndpointInvocation.java:268) - transformPayloadValue: java.lang.St
ring -> java.lang.String
DEBUG [main] (HandlerChainExecutor.java:84) - Create a handler executor: []
DEBUG [main] (HandlerChainExecutor.java:84) - Create a handler executor: []
DEBUG [main] (HandlerChainExecutor.java:84) - Create a handler executor: []
DEBUG [main] (HTTPRemotingConnection.java:169) - Get locator for: [addr=http://1
27.0.0.1:8080/TestSecure/SecureService,props={javax.xml.ws.service.endpoint.addr
ess=http://127.0.0.1:8080/TestSecure/SecureService}]
DEBUG [main] (MicroRemoteClientInvoker.java:240) - org.jboss.remoting.transport.
http.HTTPClientInvoker@b51404 connecting
DEBUG [main] (MicroRemoteClientInvoker.java:245) - org.jboss.remoting.transport.
http.HTTPClientInvoker@b51404 connected
DEBUG [main] (HTTPRemotingConnection.java:213) - Remoting metadata: {HEADER={SOA
PAction="", Content-Type=text/xml; charset=UTF-8}, NoThrowOnError=true}
DEBUG [main] (HTTPClientInvoker.java:253) - Setting request header with SOAPActi
on : ""
DEBUG [main] (HTTPClientInvoker.java:253) - Setting request header with Content-
Type : text/xml; charset=UTF-8
DEBUG [main] (SOAPContentElement.java:136) - -----------------------------------
DEBUG [main] (SOAPContentElement.java:137) - Transitioning from OBJECT_VALID to
XML_VALID
DEBUG [main] (ObjectContent.java:135) - getXMLFragment from Object [xmlType={htt
p://www.w3.org/2001/XMLSchema}string,javaType=class java.lang.String]
DEBUG [main] (SimpleSerializer.java:58) - serialize: [xmlName=name,xmlType={http
://www.w3.org/2001/XMLSchema}string]
DEBUG [main] (ObjectContent.java:162) - xmlFragment: [source=Shashank</nam
e>]
DEBUG [main] (SOAPContentElement.java:143) - -----------------------------------
DEBUG [main] (SOAPMessageUnMarshallerHTTP.java:118) - getMimeHeaders from: {Conn
ection=[close], X-Powered-By=[Servlet 2.4; JBoss-4.2.1.GA (build: SVNTag=JBoss_4
_2_1_GA date=200707131605)/Tomcat-5.5], ResponseCodeMessage=Internal Server Erro
r, Date=[Tue, 12 Feb 2008 13:27:41 GMT], Content-Type=[text/xml;charset=UTF-8],
Server=[Apache-Coyote/1.1], HEADER={SOAPAction="", Content-Type=text/xml; charse
t=UTF-8}, Transfer-Encoding=[chunked], NoThrowOnError=true, ResponseCode=500}
DEBUG [main] (MessageFactoryImpl.java:205) - createMessage: [contentType=text/xm
l; charset=UTF-8]
DEBUG [main] (InvokerRegistry.java:595) - removed org.jboss.remoting.transport.h
ttp.HTTPClientInvoker@b51404 from registry
DEBUG [main] (MessageContextJAXWS.java:105) - Begin response processing
DEBUG [main] (MessageContextAssociation.java:75) - popMessageContext: org.jboss.
ws.core.jaxws.handler.SOAPMessageContextJAXWS@322bce (Thread main)
DEBUG [main] (MessageContextAssociation.java:46) - pushMessageContext: org.jboss
.ws.core.jaxws.handler.SOAPMessageContextJAXWS@7244ca (Thread main)
DEBUG [main] (CommonSOAPBinding.java:542) - unbindResponseMessage: {http://org.j
boss.ws/samples/wssecurity}getName
DEBUG [main] (HandlerChainExecutor.java:96) - close
DEBUG [main] (HandlerChainExecutor.java:96) - close
DEBUG [main] (HandlerChainExecutor.java:96) - close
DEBUG [main] (MessageContextAssociation.java:75) - popMessageContext: org.jboss.
ws.core.jaxws.handler.SOAPMessageContextJAXWS@7244ca (Thread main)
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/soap/SOAPFa
ult
at javax.xml.ws.soap.SOAPFaultException.(SOAPFaultException.java:4
3)
at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SO
APFaultHelperJAXWS.java:72)
at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultExceptio
n(SOAP11BindingJAXWS.java:109)
at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPB
inding.java:579)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:381)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:300)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:16
6)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:15
2)
at $Proxy8.getName(Unknown Source)
at com.test.standalone.NewClient.(NewClient.java:55)
at com.test.standalone.NewClient.main(NewClient.java:95)
Regards
Shashank
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128749#4128749
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128749
18 years, 2 months