公共类 PtpReceiver {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
MQEnvironment.hostname = "192.168.120.28:1415";
MQEnvironment.channel = "SFMS.TO.CBS";
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,
MQC.TRANSPORT_MQSERIES);
System.out.println("Q manager");
MQQueueManager qMgr = new MQQueueManager("GSCBBRQM");
System.out.println("Q manager11");
}
catch (MQException ex) {
System.out.println(ex.completionCode+ ex.reasonCode);
}
}
Run Code Online (Sandbox Code Playgroud)
}
我收到以下错误:
MQJE001:完成代码“2”,原因“2538”。
任何人都可以帮我解决这个错误
我正在使用Maven 3.2.5.我有一个多模块项目,父P和子模块A(jar),B(战争),C(EAR).我希望始终使用最新版本的依赖项,因为我们每晚都会在QA环境中构建.我们可以通过使用'LATEST'代替版本号在Maven2中实现这一点.但看起来在MAVEN3中禁用了此功能.现在我试图在versions-maven-plugin中使用"use-latest-versions"目标.
我试图在模块B和C上运行这个插件,这样模块B将使用模块A中的最新工件,模块C将使用模块B中的最新工件来构建最终的EAR.
**My parent POM**
<modelVersion>4.0.0</modelVersion>
<groupId>GGGGGGG</groupId>
<artifactId>JARJARAJR</artifactId>
<version>19.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>JARJARAJR</name>
//Modules of this project
<modules>
<module>../../../Module A</module>
<module>../../../Module Bs</module>
<module>../../../Module C</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>update-dependency-versions</id>
//Asking maven to run this goal in 'pre-clean' phase
<phase>pre-clean</phase>
<goals>
<goal>use-latest-versions</goal>
</goals>
</execution>
</executions>
<configuration>
<allowSnapshots>true</allowSnapshots>
<excludeReactor>false</excludeReactor>
</configuration>
</plugin>
</plugins>
</pluginManagement>
The command I am using to run parent POM is : **mvn -U clean install -P devb - Dmaven.test.skip=true**
Run Code Online (Sandbox Code Playgroud)
我试图在"预清理"阶段调用"use-latest-versions"目标(我也尝试验证并初始化阶段).在构建模块A之后,我尝试解析旧版本的模块B而不运行"versions-maven-plugin"的目标"use-latest-versions".
我应该在哪个阶段运行"use-latest-versions"目标,以便maven在尝试构建之前更新模块B中的依赖项版本?
我有一个来自服务器的json,它是-
{"canApprove": true,"hasDisplayed": false}
Run Code Online (Sandbox Code Playgroud)
我可以这样解析json-
var msg = JSON.parse('{"canApprove": true,"hasDisplayed": false}');
alert(msg.canApprove); //shows true.
Run Code Online (Sandbox Code Playgroud)
在我的Ajax响应函数我赶上了相同的JSON早些时候方法的参数中提到jsonObject-
//response function
function(jsonObject){
//here jsonObject contains the same json - {"canApprove":true,"hasDisplayed": false}
//But without the surrounding single quote
//I have confirmed about this by seeing my server side log.
var msg = JSON.parse(jsonObject); // this gives the error
}
Run Code Online (Sandbox Code Playgroud)
但是现在我遇到了以下错误-
SyntaxError:JSON.parse:JSON数据的第1行第2列出现意外字符
谁能告诉我为什么我得到这个错误?
感到惊讶的是,这还没有发布.我正在制作一个for循环,它之前有效,但由于某种原因我无法找到boolean数组的长度.
for(int z = 0; z < keyIsFound.length(); z++){
//do something
}
Run Code Online (Sandbox Code Playgroud) unicode在java中显示字符显示“?” 标志。例如,我试图打印“?”。其unicode编号为 U+0905,html 表示为“अ”。下面的代码打印“?” 而不是unicode性格。
char aa = '\u0905';
String myString = aa + " result" ;
System.out.println(myString); // displays "? result"
Run Code Online (Sandbox Code Playgroud)
有没有办法unicode直接从unicode自身显示字符而不使用unicode数字?IE ”?” 保存在文件中现在在jsp中显示文件。
我现在正在使用@EnableAsync和@Async注释在 Spring Boot 中使用多线程。我有服务 A(快)和服务 B(慢)。
如何为他们设置不同的池?因此,当有大量对 B 的调用时,应用程序仍然可以在与 B 不同的池中处理服务 A。
@Configuration
@EnableAsync
public class ServiceExecutorConfig implements AsyncConfigurer {
@Override
public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
taskExecutor.setCorePoolSize(30);
taskExecutor.setMaxPoolSize(40);
taskExecutor.setQueueCapacity(10);
taskExecutor.initialize();
return taskExecutor;
}
}
Run Code Online (Sandbox Code Playgroud) 创建两个Integer ArrayLists包含n个元素,每个元素将从用户获取n.
所以基本上如果用户输入'6',则需要创建具有6个元素的两个数组.我该怎么做?
这就是我所拥有的......但它甚至没有远程正确.
Scanner input= new Scanner(System.in);
System.out.println("please enter a integer 'n' ");
int x= input.nextInt();
int[] a = { 1, 4, 9, 16 };
int[] b = { 9, 7, 4, 9, 11 };
Run Code Online (Sandbox Code Playgroud) 我想使用服务器端数据选择和使用cassandraspark连接器进行过滤.事实上,我们有许多传感器每1秒发送一次值,我们对使用数月,日,小时等的这些数据聚合感兴趣,我提出了以下数据模型:
CREATE TABLE project1(
year int,
month int,
load_balancer int,
day int,
hour int,
estimation_time timestamp,
sensor_id int,
value double,
...
PRIMARY KEY ((year, month, load_balancer), day, hour, estimation_time, sensor_id)
Run Code Online (Sandbox Code Playgroud)
然后,我们有兴趣获得2014年12月的负载均衡器IN(0,1,2,3)的数据汇总.所以它们是4个不同的分区.
我们使用的是cassandraspark连接器版本1.1.1,我们使用了一个按查询组合来获取所有值的平均值按小时汇总.
因此处理时间为4,341,390个元组,spark需要11分钟才能返回结果.现在的问题是我们正在使用5个节点,但是spark 只使用一个worker来执行任务.您能否建议更新查询或数据模型以提高性能?
Java线程中的数组操作是否安全?
如果不是如何在Java中为读取和写入访问数组线程安全?
我正在尝试编写一个程序,它接受一个庞大的数据集,然后使用它运行一些查询mapreduce.我有这样的代码:
public static class MRMapper
extends Mapper<LongWritable, Text, Text, IntWritable>{
String output2="hdfs://master:9000/user/xxxx/indexln.txt";
FileSystem Phdfs =FileSystem.get(new Configuration());
Path fname1=new Path(output2);
BufferedWriter out=new BufferedWriter(new OutputStreamWriter(Phdfs.create(fname1,true)));
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
long max=0;
public void map(LongWritable key, Text value, Context context
) throws IOException, InterruptedException {
String binln = Long.toBinaryString(0x8000000000000000L | key).substring(1);
out2.write(binln+"\n");
out2.flush();
String line = value.toString();
String [] ST = line.split(",");
long val=Math.abs(Long.parseLong(ST[2]));
if (max < val){
max= val;
} …Run Code Online (Sandbox Code Playgroud)