我正在尝试使用 GAE 向 tibco 设计师发送 JMS 消息。这是我的代码:
try{
Connection connection = null;
Session session = null;
MessageProducer msgProducer = null;
Destination destination = null;
String userName = null;
String password = null;
String destName = "q.message";
TextMessage msg = null;
ConnectionFactory factory = new TibjmsConnectionFactory("localhost");
connection = factory.createConnection(userName, password);
/* create the session */
session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
/* create the destination */
destination = session.createQueue(destName);
//replyDestination = session.createTopic("reply.topic");
/* create the producer */
msgProducer = session.createProducer(null); //changed for request-reply
//replyConsumer = session.createConsumer(replyDestination); //for request-reply
/* start the connection */
connection.start();
/* create text message */
msg = session.createTextMessage();
/* set message text */
msg.setText(message);
//msg.setJMSReplyTo(replyDestination); //for request-reply
/* publish message */
msgProducer.send(destination, msg); //Send XML message to destination
}catch(JMSException e){
System.out.println("Error");
}
但是,运行此 Web 应用程序后,我收到以下错误:
Nov 10, 2013 11:04:36 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: /process_message.do
java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
at java.security.AccessController.checkPermission(AccessController.java:549)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:383)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:408)
at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:299)
at java.lang.Thread.init(Thread.java:336)
at java.lang.Thread.<init>(Thread.java:434)
at com.tibco.tibjms.TibjmsxLinkTcp$Pinger.<init>(TibjmsxLinkTcp.java:142)
at com.tibco.tibjms.TibjmsxLinkTcp._createPinger(TibjmsxLinkTcp.java:223)
at com.tibco.tibjms.TibjmsxLinkTcp._doHandshake(TibjmsxLinkTcp.java:900)
at com.tibco.tibjms.TibjmsxLinkTcp.connect(TibjmsxLinkTcp.java:923)
at com.tibco.tibjms.TibjmsConnection._create(TibjmsConnection.java:1299)
at com.tibco.tibjms.TibjmsConnection.<init>(TibjmsConnection.java:4155)
at com.tibco.tibjms.TibjmsxCFImpl._createImpl(TibjmsxCFImpl.java:209)
at com.tibco.tibjms.TibjmsxCFImpl._createConnection(TibjmsxCFImpl.java:253)
at com.tibco.tibjms.TibjmsConnectionFactory.createConnection(TibjmsConnectionFactory.java:58)
at com.ebs.process_buy.doPost(process_buy.java:108)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:368)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:351)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:97)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:485)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
这是否意味着 GAE 不能与 JMS 一起使用,因为 JMS 使用数据库连接,而 GAE 需要使用自己的云数据库?我该如何解决这个问题?
谢谢您的帮助。