小编hbp*_*oss的帖子

mvn compile:无法找到包java.lang

我有下面的maven-compiler-plugin设置:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
        <compilerArguments>
            <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
        </compilerArguments>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

执行时mvn compile,它会报告Unable to find package java.lang in classpath or bootclasspath.但我确实找到了java.lang包裹/Library/Java/JavaVirtualMachines/jdk1.8/Contents/Home/jre/lib/rt.jar:

java/lang/Thread$UncaughtExceptionHandler.class
java/lang/ThreadGroup.class
java/lang/Runnable.class
java/lang/Thread.class
java/lang/ref/Finalizer.class
java/lang/ref/PhantomReference.class
java/lang/ref/FinalReference.class
java/lang/ref/WeakReference.class
java/lang/ref/SoftReference.class
java/lang/ref/Reference.class
......
Run Code Online (Sandbox Code Playgroud)

我在OS X 10.11.3上使用Oracle JDK 1.8.我应该提供哪些额外信息?问题来自JDK还是项目的maven设置?

编辑:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8/Contents/Home
Run Code Online (Sandbox Code Playgroud)

EDIT2:

Maven不同:无法在OS X上找到java.lang问题,我正在使用Oracle JDK

EDIT3:

maven版本

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /usr/local/Cellar/maven/3.3.9/libexec
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre
Default locale: …
Run Code Online (Sandbox Code Playgroud)

java maven

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

mysql utf8mb4_unicode_ci 导致唯一键冲突

我有一张这样的桌子

CREATE TABLE `mb1` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `u_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Run Code Online (Sandbox Code Playgroud)

我插入两行

insert into mb1(name) values('K'),('?');
Run Code Online (Sandbox Code Playgroud)

注意,第二个 K 是 unicode 字符

+------+-----------+
| name | hex(name) |
+------+-----------+
| K    | 4B        |
| ?   | EFBCAB    |
+------+-----------+
Run Code Online (Sandbox Code Playgroud)

为什么它们会导致唯一的密钥冲突?它们在 utf8mb4 中不是不同的字符吗?

删除 COLLATE utf8mb4_unicode_ci 后,问题消失。

mysql utf-8 utf8mb4

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

多继承自QObject和QRunnable错误

我正在使用pyqt4.我有一个继承自QObject和QRunnable的类,如下所示:

class DownloadTask(QObject, QRunnable):
    def __init__(self):
        QObject.__init__(self)
        QRunnable.__init__(self)
        self.setAutoDelete(False)
Run Code Online (Sandbox Code Playgroud)

当DownloadTask的一个实例正在初始化时,最后一行抛出异常:

TypeError: could not convert 'DownloadTask' to 'QRunnable'
Run Code Online (Sandbox Code Playgroud)

但我认为它在语法中是正确的,QRunnable有方法setAutoDelete.为什么它不能转换为QRunnable?

更新:
我打算使用QThreadPool管理多线程从Internet下载资源,并在完成后发出信号.我怎样才能做到这一点?

python qt pyqt pyqt4 python-3.x

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

春季会议数据redis无法正常工作

我已经尝试了官方参考Spring Session提供的示例。通过http:// localhost:8080 / login登录后,似乎会话数据仍存储在内存中,并且没有Redis交互(通过redis-cli monitor命令观察)。Cookie中仅存储JSESSIONID

以下设置:

web.xml

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring.xml</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
    <servlet-name>springmvc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
Run Code Online (Sandbox Code Playgroud)

spring.xml:

<context:annotation-config/>
<beans:bean class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration"/>
<beans:bean class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
            p:hostName="192.168.1.230"
            p:port="6379"
/>

<security:authentication-manager>
    <security:authentication-provider>
        <security:user-service>
            <security:user name="root" password="123456" authorities="ROLE_ADMIN"/>
        </security:user-service>
    </security:authentication-provider>
</security:authentication-manager>
<security:global-method-security secured-annotations="enabled"/>
<security:http auto-config="true">
    <security:intercept-url pattern="/ping" access="hasRole('ROLE_ADMIN')"/>
    <security:form-login default-target-url="/ping"/>
    <security:csrf disabled="true"/>
</security:http>

<mvc:annotation-driven/>

<context:component-scan base-package="io.hbprotoss.demo.controller"/>
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc spring-security spring-session

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

在python中使用*运算符创建列表

为什么要[0] * 5创建一个列表[0, 0, 0, 0, 0],而不是[[0], [0], [0], [0], [0]]

*操作员是否重复[0]5次导致[[0], [0], [0], [0], [0]]

python list

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