小编Han*_*ath的帖子

如何更改Activemq的默认端口号

我正在使用Windows 7OS.我apache-activemq-5.8.0.zip从这些链接下载并在C:\Users\Infratab Bangalore\Desktop\Queueing\apache-activemq-5.8.0目录中解压缩.

Activemq初始化时,我Pre-Installation Requirements从这些链中读取概念.

我已经安装apache-maven-3.0.5在我的系统中.对于我的构造,我在我的系统中运行以下命令.

   mvn -version
Run Code Online (Sandbox Code Playgroud)

我收到以下消息,所以Maven安装成功.

 Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21:
 28+0530)
 Maven home: P:\Software\apache-maven-3.0.5
 Java version: 1.7.0_21, vendor: Oracle Corporation
 Java home: C:\Program Files\Java\jdk1.7.0_21\jre
 Default locale: en_US, platform encoding: Cp1252
 OS name: "windows 7", version: "6.1", arch: "x86", family: "windows" 
Run Code Online (Sandbox Code Playgroud)

geronimo-spec-corba-1.0.jar从这些链接下载并设置classpth.

在此输入图像描述

Activemq以下面的方式开始初始化.

  C:\Users\Infratab Bangalore\Desktop\Queueing\apache-activemq-5.8.0\bin>activemq
Run Code Online (Sandbox Code Playgroud)

我收到错误,所以我测试了是否61616(Activemq default port no) …

java apache activemq-classic jms java-ee-7

10
推荐指数
1
解决办法
3万
查看次数

哪里可以更改activemq中的预取值

我阅读了有关的文档prefetch buffer.按照我的理解,如果我将Prefetch值= 1 分配给消费者A.一次将Activemq push 1消息发送给A .once A向activemq发送确认,然后只有activemq将另一条消息发送给A.

我怀疑的是,我需要为消费者分配预取值.

我需要在消费者程序中分配预取值.如果它是正确的,你能用简单的代码解释.

谢谢.

activemq-classic jms

7
推荐指数
1
解决办法
1万
查看次数

如何在普通Java类中找到上下文路径

我想在普通的Java类中找到我的Web应用程序的上下文路径.如果我发现我可以/Rod1/thermalMap.exe在任何需要的地方指定这样的路径.

我知道,如何找到servlet使用以下代码

   getServletContext().getRealPath("");
Run Code Online (Sandbox Code Playgroud)

我的webApps文件夹的方式如下.

图片

java path

7
推荐指数
2
解决办法
3万
查看次数

如何在线程"main"java.util.ConcurrentModificationException中修复Exception

我有2个HashMap<Integer,Point3D>对象名称positiveCoOrdinate and negativeCoOrdinates.

我正在检查PositiveCoOrdinates以下条件.如果它满足相应的点添加negativeCoOrdinates和删除positiveCoOrdinates.

  HashMap<Integer, Point3d> positiveCoOrdinates=duelList.get(1);
  HashMap<Integer, Point3d> negativecoOrdinates=duelList.get(2);
  //condition
  Set<Integer> set=positiveCoOrdinates.keySet();
    for (Integer pointIndex : set) {
        Point3d coOrdinate=positiveCoOrdinates.get(pointIndex);
        if (coOrdinate.x>xMaxValue || coOrdinate.y>yMaxValue || coOrdinate.z>zMaxValue) {
            negativecoOrdinates.put(pointIndex, coOrdinate);
            positiveCoOrdinates.remove(pointIndex);
        }
    }
Run Code Online (Sandbox Code Playgroud)

添加,删除时间我收到以下错误.

 Exception in thread "main" java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
at java.util.HashMap$KeyIterator.next(Unknown Source)
at PlaneCoOrdinates.CoordinatesFiltering.Integration(CoordinatesFiltering.java:167)
at PlaneCoOrdinates.CoordinatesFiltering.main(CoordinatesFiltering.java:179)
Run Code Online (Sandbox Code Playgroud)

对于我的测试,我System.out.println(coOrdinate.x);If条件内提到了声明.工作正常.

如果我在If条件中添加2行(我上面提到的内容),则会抛出错误.

我怎样才能解决这个问题.

谢谢.

java

6
推荐指数
1
解决办法
4055
查看次数

如何在Activemq中订阅Java程序作为使用者?

我想Pub/Sub在项目中实现域.基本上我不是java开发人员,使用谷歌帮助.我读了这个链接.我开始实现以下结构. 在此输入图像描述

我编写了Java Application名称,MessageConsumer.java用于从AMQ代理接收消息并放置在Webserver(Apache Tomcat)中.

MessageConsumercode:

 package PackageName;
 import java.io.IOException;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.jms.*;
 import org.apache.activemq.ActiveMQConnectionFactory;
 public class Consumer extends HttpServlet {
 @Override
 protected void service(HttpServletRequest arg0, HttpServletResponse arg1)
    throws ServletException, IOException {
try {
//creating connectionfactory object for way
ConnectionFactory connectionFactory=new ActiveMQConnectionFactory("admin","admin","tcp://localhost:61617");
//establishing the connection b/w this Application and Activemq
Connection connection=connectionFactory.createConnection();
Session session=connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Topic queue=session.createTopic("MessageTesting");
javax.jms.MessageConsumer consumer=session.createConsumer(queue);
//fetching queues from Activemq
MessageListener listener = new MyListener(); …
Run Code Online (Sandbox Code Playgroud)

java activemq-classic jms

5
推荐指数
2
解决办法
1万
查看次数

我如何向Activemq发送消息

我从不工作JMS.最近我下载Activemq和从没有改变端口6161661617所有conf/activemq-*.xmlfiles.I在浏览器中运行的命令提示符,然后打开控制台页面下面的命令.

  C:\Users\Infratab Bangalore\Desktop\Queueing\apache-activemq-5.8.0\bin>activemq
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

现在我想给使用Java代码的消息JMSActivemq.对于这一点,我写了下面的代码.并使用Apache Tomcat server.it运行我的代码

此代码在Eclipse中实现.

package PackageName;

import java.io.IOException;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.activemq.ActiveMQConnectionFactory;

public class MessageProducer extends HttpServlet {
    @Override
    protected void service(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
        try {
            //created ConnectionFactory object for creating connection 
            ConnectionFactory factory = new ActiveMQConnectionFactory("admin", "admin", "tcp://localhost:61617");
            //Establish the connection …
Run Code Online (Sandbox Code Playgroud)

java activemq-classic jms java-ee-6

4
推荐指数
1
解决办法
2万
查看次数

如何异步从Activemq中提取消息

我想编写用于从中提取消息的代码Activemq.我不想Activemq一次从所有消息中提取所有消息,因为我的要求是每当我的Java应用程序收到1条消息时Activemq,根据消息正文我将找到相应的HTTP Link并转发给链接.对于这整个逻辑,我写了2个.java文件名

MessageConsumer.java

MyListener.java

MessageConsumer.java文件仅用于连接建立.相应的代码如下.

 package PackageName;
 import java.io.IOException;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.jms.*;
 import org.apache.activemq.ActiveMQConnectionFactory;
 public class MessageConsumer extends HttpServlet {
@Override
protected void service(HttpServletRequest arg0, HttpServletResponse arg1)
    throws ServletException, IOException {
    try {
      //creating connectionfactory object for way
      ConnectionFactory connectionFactory=new        
      ActiveMQConnectionFactory("admin","admin","tcp://localhost:61617");
     //establishing the connection b/w this Application and Activemq
     Connection connection=connectionFactory.createConnection();
     Session session=connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
     Queue queue=session.createQueue("MessageTesing");
     javax.jms.MessageConsumer consumer=session.createConsumer(queue);
     //fetching queues from Activemq
     MessageListener …
Run Code Online (Sandbox Code Playgroud)

java activemq-classic jms java-ee-6

3
推荐指数
1
解决办法
8571
查看次数

如何将http请求发送到另一个servlet

在我的项目文件夹中,我们有2个ContextPath/WEB-INF/Classes/*.class名称为App1.class和的java文件App2.class

如果我想运行App1.class,我只需要在浏览器中触发URL.

  http://localhost:8080/Mapping/App1
Run Code Online (Sandbox Code Playgroud)

同样,如果要触发App2.class,请使用以下链接

 http://localhost:8080/Mapping/App2
Run Code Online (Sandbox Code Playgroud)

我想触发App2App1,意味着如果触发App1在浏览器对应的URL,这将是触发App2.

我也不想做任何回应.

我怎样才能做到这一点.

谁能帮我.

谢谢.

java java-ee-6

1
推荐指数
1
解决办法
2万
查看次数

如何动态创建HashMap

我有.txt以下列方式使用5L值(行)的文件,并且还具有分区大小50000.

 1
 3
-1546.9
-67.90
3456
.
.
.
Run Code Online (Sandbox Code Playgroud)

通过以下示例,您可以从我的角度理解分区的含义.

将文件数据导入列表后,我们可以通过以下方式看到.

 importingdata={1,2,3,4,5,.........500000};
Run Code Online (Sandbox Code Playgroud)

分区后,您可以通过以下方式查看.

PartitionList={{1,2,3,...50000},{50001,....,100000},{100001,......,150000},...{450000,.....500000}};
Run Code Online (Sandbox Code Playgroud)

partitionList数据类型是ArrayList<HashMap<Integer,Double>>.it表示分区列表的所有子列表HashMap<Integer,Double>.

所有HashMap列表以1 to 50000下列方式从.like 开始其键值.

     PartitionList={{1->1,2->2,3->3,...,50000->50000},{1->50001,.....,50000->100000},{1->100001,....,50000->150000},...,{1->450000,.....,50000->500000}};
Run Code Online (Sandbox Code Playgroud)

我希望在文件导入时间的同时以上述方式排列文件数据.

为此我尝试了示例代码,但它不起作用.

public static void main(String[] args) {
    ArrayList<HashMap<Integer, Double>> finalList=new ArrayList<>();
    HashMap<Integer, Double> hash1=new HashMap<>();
    hash1.put(1, 1.0);
    hash1.put(2, 2.0);
    hash1.put(3, 3.0);
    finalList.add(hash1);
    System.out.println(finalList.size());
    System.out.println(hash1.size());
    hash1.clear();
    System.out.println(hash1.size());
    hash1.put(1, 1.0);
    hash1.put(2, 2.0);
    hash1.put(3, 3.0);
    finalList.add(hash1);
    System.out.println(finalList.size());
    System.out.println(hash1.size());
    hash1.clear();
    System.out.println(hash1.size());
    HashMap<Integer, Double> hash2=finalList.get(1);
    HashMap<Integer, Double> hash3=finalList.get(2);
    System.out.println(hash2.size());
    System.out.println(hash3.size());
}
Run Code Online (Sandbox Code Playgroud)

我希望,你们明白我在尝试什么.在这里我提到 …

java

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

java ×8

activemq-classic ×5

jms ×5

java-ee-6 ×3

apache ×1

java-ee-7 ×1

path ×1