You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by rauch <ko...@gmail.com> on 2010/03/24 13:32:15 UTC

Sending BlobMessage to Topic. At 5.3.0 Valid. At 5.4.0(Snapshot) exception.

OS: ubuntu-9.10-amd64 
java version "1.6.0_15" 
Java(TM) SE Runtime Environment (build 1.6.0_15-b03) 
Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02, mixed mode) 
------------------------------------------------------------------------------------------------------------------- 
When I use apache-activemq-5.3.0-bin I can create Producer and can send
BlobMessages using
"tcp://localhost:61616?jms.blobTransferPolicy.defaultUploadUrl=http://localhost:8161/fileserver/" 
But in 5.3.0 all BlobMessages (Files) are hold at
~/apache-activemq-5.3.0/webapps/fileserver/ directory all time.
(JMSDeliveryMode = Non-Persistent, JMSExpiration = 10000L, Non-Durable
Subscription) even this File was delivered to all subscribers. 
----------------------------------------------------------------------------------------------------------------- 
Ok, by now I decide using apache-activemq-5.4-SNAPSHOT-bin. I rebuild my
java project with new library and what a have: 
I start apache-activemq-5.4-SNAPSHOT/bin/activemq with default configs. 
Now, I can send TextMessages to Topic and All subscribers get it. But when I
send BlobMessages to Topic I get an Exception: at clients side: 
sendFile Exception java.lang.Exception: javax.jms.JMSException: PUT was not
successful: 500 org/eclipse/jetty/util/URIUtil java.lang.Exception:
javax.jms.JMSException: PUT was not successful: 500
org/eclipse/jetty/util/URIUtil at
activemqmessaging.ProducerTool.sendBLOBMessage(ProducerTool.java:137) at
n_sserver.Server.sendFile(Server.java:52) at
n_sserver.Server.startServer(Server.java:82) at
n_sserver.Server.main(Server.java:122) Caused by: javax.jms.JMSException:
PUT was not successful: 500 org/eclipse/jetty/util/URIUtil at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
at
org.apache.activemq.command.ActiveMQBlobMessage.onSend(ActiveMQBlobMessage.java:176)
at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1732) at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:231)
at
org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:241)
at activemqmessaging.ProducerTool.sendBLOBMessage(ProducerTool.java:119) ...
3 more Caused by: java.io.IOException: PUT was not successful: 500
org/eclipse/jetty/util/URIUtil at
org.apache.activemq.blob.DefaultBlobUploadStrategy.uploadStream(DefaultBlobUploadStrategy.java:70)
at
org.apache.activemq.blob.DefaultBlobUploadStrategy.uploadFile(DefaultBlobUploadStrategy.java:44)
at org.apache.activemq.blob.BlobUploader.upload(BlobUploader.java:51) at
org.apache.activemq.command.ActiveMQBlobMessage.onSend(ActiveMQBlobMessage.java:173)
... 7 more
=========================================================== 
At Broker`s log I get: 
Loading message broker from: xbean:activemq.xml 
 INFO |
PListStore:/home/rauch/Downloads/Programs/Different/ActiveMQ/apache-activemq-5.4-SNAPSHOT/data/activemqBroker5.4/tmp_storage
started 
 INFO | Using Persistence Adapter:
org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter@710ca208 
 INFO | Replayed 1 operations from the journal in 0.01 seconds. 
 INFO | ActiveMQ 5.4-SNAPSHOT JMS Message Broker (activemqBroker5.4) is
starting 
 INFO | For help or more information please see: http://activemq.apache.org/
 INFO | Scheduler using directory: activemq-data/scheduler 
 INFO | Listening for connections at: tcp://rauch-laptop:61616 
 INFO | Connector openwire Started 
 INFO | ActiveMQ JMS Message Broker (activemqBroker5.4,
ID:rauch-laptop-46943-1269431686418-0:0) started 
 INFO | Logging to
org.slf4j.impl.JCLLoggerAdapter(org.eclipse.jetty.util.log) via
org.eclipse.jetty.util.log.Slf4jLog 
 INFO | jetty-7.0.1.v20091125 
 INFO | ActiveMQ WebConsole initialized. 
 INFO | Initializing Spring FrameworkServlet 'dispatcher' 
 INFO | ActiveMQ Console at http://0.0.0.0:8161/admin
 INFO | Initializing Spring root WebApplicationContext 
 INFO | Successfully connected to tcp://localhost:61616 
 INFO | Camel Console at http://0.0.0.0:8161/camel
 INFO | ActiveMQ Web Demos at http://0.0.0.0:8161/demo
 INFO | RESTful file access application at http://0.0.0.0:8161/fileserver
 INFO | Started SelectChannelConnector@0.0.0.0:8161 
ERROR | Error for /fileserver/ID:rauch-laptop-35835-1269431710986-0:2:1:1:1 
java.lang.NoClassDefFoundError: org/eclipse/jetty/util/URIUtil 
        at
org.apache.activemq.util.RestFilter.locateFile(RestFilter.java:74) 
        at org.apache.activemq.util.RestFilter.doPut(RestFilter.java:163) 
        at org.apache.activemq.util.RestFilter.doFilter(RestFilter.java:92) 
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187) 
        at
org.apache.activemq.util.FilenameGuardFilter.doFilter(FilenameGuardFilter.java:50) 
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187) 
        at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:425) 
        at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) 
        at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:494) 
        at
org.eclipse.jetty.server.session.SessionHandler.handle(SessionHandler.java:182) 
        at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:933) 
        at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:362) 
        at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:867) 
        at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) 
        at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126) 
        at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113) 
        at org.eclipse.jetty.server.Server.handle(Server.java:334) 
        at
org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:559) 
        at
org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1007) 
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:839) 
        at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:209) 
        at
org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:406) 
        at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:462) 
        at
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436) 
        at java.lang.Thread.run(Thread.java:619) 
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.util.URIUtil 
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200) 
        at java.security.AccessController.doPrivileged(Native Method) 
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188) 
        at
org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:304) 
        at
org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:266) 
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) 
        ... 25 more
============================================================== 
What do I need to change that I can send BlobMessages? 
this.producer = new
ProducerTool.Builder("tcp://localhost:61616?jms.blobTransferPolicy.defaultUploadUrl=http://localhost:8161/fileserver/", 
                "ServerProdTopic").topic(true) 
                .transacted(false).durable(false).timeToLive(0).build(); 

//some code here 
connection = createConnection(); 
session = createSession(connection); 
producer = createProducer(session); 
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); 
BlobMessage blobMsg = ((ActiveMQSession)
session).createBlobMessage(resource); 

producer.send(blobMsg); 

----------------------------------------------------------------------------------------------------------------- 
Where 
protected MessageProducer createProducer(Session session) throws
JMSException { 
        MessageProducer producer = session.createProducer(destination); 
        producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); 
        System.out.println("DeliveryMode: "+producer.getDeliveryMode()); 
        if (timeToLive != 0) 
            producer.setTimeToLive(timeToLive); 
        return producer; 
    } 
And 
protected Connection createConnection() throws JMSException, Exception { 
        ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory(url); 
       
//connectionFactory.getBlobTransferPolicy().setUploadUrl("http://localhost:8161/fileserver/"); 
        Connection connection = connectionFactory.createConnection(); 
        if (durable && clientID != null) { 
            connection.setClientID(clientID); 
        } 
        connection.start(); 
        ((ActiveMQConnection) connection).setCopyMessageOnSend(false); 
        return connection; 
    }
-- 
View this message in context: http://old.nabble.com/Sending-BlobMessage-to-Topic.-At-5.3.0-Valid.-At-5.4.0%28Snapshot%29-exception.-tp28014411p28014411.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.