小编Nik*_*ail的帖子

实现接口方法时不允许@Override

我有标题中提到的问题.你可以说这个线程重复另一个:如何关闭IntelliJ IDEA注释的错误验证?

但那里给出的解决方案不起作用.他们说我需要采取以下行动:

在项目结构中| 在Project对话框中,将Project语言级别更改为6.0 - 接口中的@Override.

但是,目前Project语言级别为6.0,但我仍然看到错误.

维克,这里是窗口,在语言级别下没有JVM版本(遗憾的是我不能发布图像因为我有10个声誉)

java overriding extjs intellij-idea gxt

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

RabbitMQ"Hello World"示例给出"Connection Refused"

我试图从这里制作"hello world"应用程序:RabbitMQ Hello World

这是我的生产者类的代码:

package com.mdnaRabbit.producer;

import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;

import java.io.IOException;

public class App {

    private final static String QUEUE_NAME = "hello";

    public static void main( String[] argv) throws IOException{
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("localhost");
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();

        channel.queueDeclare(QUEUE_NAME, false, false, false, null);
        String message = "Hello World!";
        channel.basicPublish("", QUEUE_NAME, null, message.getBytes());
        System.out.println(" [x] Sent" + "'");
        channel.close();
        connection.close();
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我实现这个时得到的:

Exception in thread "main" java.net.ConnectException: Connection refused …
Run Code Online (Sandbox Code Playgroud)

java exception-handling rabbitmq

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

此语言级别IDEA不支持lambda表达式

我正在尝试创建我的第一个fxml java项目,并且在初始化阶段我正在尝试为表columnt设置单元格值工厂,例如

      @FXML
        private void initialize() {
        agentId.setCellValueFactory(cellData -> cellData.getValue().getIdProperty());
       .....}
Run Code Online (Sandbox Code Playgroud)

这是红色下划线,并给出标题中提到的错误.更改项目结构中的语言级别不起作用.还有什么可能是错误的原因?

UPD:我发现安装带有lambda的java是必要的,而lambdas并未包含在官方发行版中.我做到了,但它没有帮助.我在这里下载了它

ide lambda javafx intellij-idea

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

如何使用apache.commons获取属性列表

我需要获取.properties文件中的属性列表.例如,如果有以下.properties文件:

users.admin.keywords = admin
users.admin.regexps = test-5,test-7
users.admin.rules = users.admin.keywords,users.admin.regexps

users.root.keywords = newKeyWordq
users.root.regexps = asdasd,\u0432[\u044By][\u0448s]\u043B\u0438\u0442[\u0435e]
users.root.rules = users.root.keywords,users.root.regexps,rules.creditcards

users.guest.keywords = guest
users.guest.regexps = *
users.guest.rules = users.guest.keywords,users.guest.regexps,rules.creditcards

rules.cc.creditcards = 1234123412341234,11231123123123123,ca
rules.common.regexps = pas
rules.common.keywords = asd
Run Code Online (Sandbox Code Playgroud)

因此,我想得到一个ArrayList,它包含如下字段的名称: users.admin.keywords, users.admin.regexps, users.admin.rules依此类推.正如您所注意到的,我需要使用apache.commons.config来完成此操作

java apache-commons-config

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

使用RabbitMQ发送对象

我理解这个问题重复了 使用rabbitmq发送消息而不是字符串而不是struct的问题

如果用第一种方式做到这一点

第一种方式

我有以下痕迹:

java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2304)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2773)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:798)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:298)
at com.mdnaRabbit.worker.data.Data.fromBytes(Data.java:78)
at com.mdnaRabbit.worker.App.main(App.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Run Code Online (Sandbox Code Playgroud)

我已经检查并确保在发送方类中将消息转换为字节,但是消费者无法接收它.

这是我的制作人类:

package com.mdnaRabbit.newt;

import java.io.IOException;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.MessageProperties;
import org.apache.commons.lang.SerializationUtils;
import com.mdnaRabbit.worker.data.Data;

public class App {

    private static final String TASK_QUEUE_NAME = "task_queue";

    public static void main( String[] argv) throws IOException{

        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("localhost");
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel(); …
Run Code Online (Sandbox Code Playgroud)

java messaging rabbitmq

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

需要帮助配置maven .pom来构建.exe文件

我需要使用maven构建exe文件.我听说gradle更适合这个目的,但我甚至都不知道.我当前的.pom文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.ediagent.edi</groupId>
    <artifactId>javafx</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>exe</packaging>

    <name>javafx</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <mainClass>com.myapp.Main</mainClass>
    </properties>

    <organization>
        <!-- Used as the 'Vendor' for JNLP generation -->
        <name>Your Organisation</name>
    </organization>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <excludeScope>system</excludeScope>
                            <excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>

                        <phase>package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>${java.home}/../bin/javafxpackager</executable>
                            <arguments>
                                <argument>-createjar</argument>
                                <argument>-nocss2bin</argument>
                                <argument>-appclass</argument>
                                <argument>${mainClass}</argument>
                                <argument>-srcdir</argument>
                                <argument>${project.build.directory}/classes</argument>
                                <argument>-outdir</argument>
                                <argument>${project.build.directory}</argument>
                                <argument>-outfile</argument>
                                <argument>${project.build.finalName}.jar</argument>
                            </arguments>
                        </configuration>
                    </execution> …
Run Code Online (Sandbox Code Playgroud)

java javafx pom.xml maven

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

NoClassDefFoundError:org/apache/commons/configuration/ConfigurationException

我有一个应用程序,我需要解析配置文件,当在服务器上运行此程序时,它提供以下跟踪:

java.lang.NoClassDefFoundError: org/apache/commons/configuration/ConfigurationException
    at com.messagedna.server.startup.StartupServlet.init(StartupServlet.java:19)
    at javax.servlet.GenericServlet.init(GenericServlet.java:160)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1274)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1186)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1081)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5320)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1553)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:791)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:622)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:569)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:791)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1486)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:96)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1327)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1419)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:847)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601) …
Run Code Online (Sandbox Code Playgroud)

java apache-commons maven apache-commons-config

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

如何配置log4j只记录信息消息和更高?

我没有使用config或xml文件来配置log4j,因为不需要深入配置它.我只需要将消息打印到控制台.所以我这样做:

BasicConfigurator.configure();
Run Code Online (Sandbox Code Playgroud)

并且只打印信息和更高的消息我这样做:

Logger LOG = Logger.getLogger(MyClass.class)
LOG.setLevel(Level.INFO);
Run Code Online (Sandbox Code Playgroud)

但是我在控制台中也看到了调试消息.但我只需要打印信息和实际错误消息.

这该怎么做?

UPD:我创建了一个包含的配置文件,如本教程中所述: 手动以下内容:

  log4j.rootLogger=INFO, stdout

  # Direct log messages to stdout
  log4j.appender.stdout=org.apache.log4j.ConsoleAppender
  log4j.appender.stdout.Target=System.out
  log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
  log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L        %m%n

log4j.logger.com.messagedna.facade=INFO
log4j.logger.com.messagedna.receiver=INFO
log4j.logger.com.messagedna.util=INFO
log4j.logger.com.messagedna.parser=INFO
Run Code Online (Sandbox Code Playgroud)

我把它放到了 com.messagedna

在我需要记录器的每个班级中,我写了以下内容:

Properties props = new Properties();
try {
    props.load(new FileInputStream("/log4j.properties"));
    } catch (Exception e){
      LOG.error(e);
      }
PropertyConfigurator.configure(props);
Run Code Online (Sandbox Code Playgroud)

但是当我运行我的应用程序时,我得到以下内容:

log4j:WARN No appenders could be found for logger (com.messagedna.server.util.Config).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Run Code Online (Sandbox Code Playgroud)

java log4j

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

-source 1.3不支持泛型

我在maven包装时遇到问题.在这段代码中:

public class LoginDialog extends Dialog {

    private final TextField<String> customer;
                          ^here
    private final TextField<String> login1;
    private final TextField<String> password1;
    private final MainController controller= new MainController();
    private String customerId;
    private String login;
    private String password;
Run Code Online (Sandbox Code Playgroud)

我有一个错误:

[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
...src/main/java/com/messagedna/web/client/widget/LoginDialog.java:[19,27] error: generics are not supported in -source 1.3
Run Code Online (Sandbox Code Playgroud)

这可能是什么原因?

java gwt maven

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

在存储库中找不到maven依赖项

我正在尝试运行使用gwt-dev的项目. 当我在终端中创建依赖关系时,说明位于:http://neiliscoding.blogspot.ru/2012/05/how-to-setup-examples-for-use-in-gxt-3.html?showComment = 1362999279386:mvn install:install-file -DgroupId=com.google.gwt -DartifactId=gwt-dev -Dversion=2.5.0 -Dpackaging=jar -Dfile='/home/mikhail/????????/libraries/gwt-2.5.0/gwt-dev.jar' 并将依赖项添加到pom.xml:

 <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-dev</artifactId>
      <version>2.5.0</version>
  </dependency>
Run Code Online (Sandbox Code Playgroud)

玛文说:

    [WARNING] You should not declare gwt-dev as a project dependency. This may introduce complex dependency conflicts
Downloading: http://repo1.maven.org/maven2/com/google/gwt/gwt-dev/2.5.0/gwt-dev-2.5.0-linux-libs.zip
[INFO] Unable to find resource 'com.google.gwt:gwt-dev:zip:linux-libs:2.5.0' in repository central (http://repo1.maven.org/maven2)
Run Code Online (Sandbox Code Playgroud)

否则如果我删除它maven说:

[INFO] using GWT jars from project dependencies : 2.5.0
Downloading: http://repo1.maven.org/maven2/com/google/gwt/gwt-dev/2.5.0/gwt-dev-2.5.0-linux-libs.zip
[INFO] Unable to find resource 'com.google.gwt:gwt-dev:zip:linux-libs:2.5.0' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
Run Code Online (Sandbox Code Playgroud)

所以我在两种情况下都有Build错误.如何应对这种情况?请帮帮我.

我没有解决这个问题,但我刚刚发现我使用了1.2版本的maven插件.我不是害羞这是主要问题,但无论如何我还是要处理它.所以,sinse我根据你的第一个链接添加了这个插件,maven drop …

gwt dependencies extjs gxt maven

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

GXT网格自动列宽

我有一个GXT网格,并希望其中的列适合屏幕.这里我的网格现在看起来像: 在此输入图像描述

它看起来是因为我已经为列宽设置了具体的值,这适合我的屏幕.我希望列自动适应网格的宽度

java grid gxt

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

无法解析符号“不可变”

我是Java线程技术的新手,现在阅读“实践中的Java并发性”。如您可能的理解,我正在尝试做任何示例,但不能。当我尝试使用@Immutable注释IDE(Idea)时,它用红色强调。这可能是什么原因?

java concurrency annotations intellij-idea immutability

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

无法启动rabbitmq-server

昨天我一直在寻找提高rabbitmq应用程序发送/接收速度的方法,并在10分钟后改变了一些东西,我的操作系统(ubuntu)说只有100mb的可用磁盘空间。我必须删除这些文件或文件夹在哪里?

更实际的问题是如何运行rabbitmq-server。以前它一直在系统启动时启动。现在不是这样,当我试图启动它descrybed这里,并在控制台看到如下:

mikhail@mikhail-GA-880GA-UD3H:~$ sudo rabbitmq-server -detached
Warning: PID file not written; -detached was passed.
Run Code Online (Sandbox Code Playgroud)

当我尝试按照这里所说的去做时,我收到了以下信息:

* Starting message broker rabbitmq-server                                       
* FAILED - check /var/log/rabbitmq/startup_\{log, _err\}
                                                                         [fail]
invoke-rc.d: initscript rabbitmq-server, action "start" failed.
Run Code Online (Sandbox Code Playgroud)

日志文件中的内容如下:

{"could not start kernel pid",application_controller,"error in config file \"/etc/rabbitmq/rabbitmq.config\" (none): no ending <dot> found"}
Run Code Online (Sandbox Code Playgroud)

在 startup_err 文件中是这样的:

Crash dump was written to: erl_crash.dump
could not start kernel pid (application_controller) (error in config file "/etc/rabbitmq/rabbitmq.config" (none): no ending <dot> found)
Run Code Online (Sandbox Code Playgroud)

UPD:我删除了我的 /config …

ubuntu rabbitmq

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