HiSEN

Personal Technology Blog


  • 归档

  • 分类

  • 标签

  • 书单

  • 关于

  • 搜索
close
HiSEN

java.lang.IllegalArgumentException: addChild: Child name '/hisen' is not unique

发表于 2017-02-27

报错如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
27-Feb-2017 12:53:31.268 严重 [RMI TCP Connection(13)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method manageApp
java.lang.IllegalArgumentException: addChild: Child name '/hisen' is not unique
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:738)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1702)
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:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:482)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:431)
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:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
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:606)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

重要的是:

1
2
org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method manageApp
java.lang.IllegalArgumentException: addChild: Child name '/hisen' is not unique

IDEA解决办法

Project Structure -> Artifacts

查看里面是否有配置相同的Artifacts

删除即可

HiSEN

查看linux进程 - 多重方式

发表于 2017-02-27 | 分类于 linux

可以使用ps命令。
它能显示当前运行中进程的相关信息,包括进程的PID。

Linux和UNIX都支持ps命令,显示所有运行中进程的相关信息。

ps命令能提供一份当前进程的快照。如果想状态可以自动刷新,可以使用top命令。

ps命令

输入下面的ps命令,显示所有运行中的进程:

1
ps aux | less

这个命令按 q 退出
后面加了“| less”就会分页显示,如果去掉会一次性显示出所有结果

输出:

阅读全文 »

HiSEN

Java开发的一点思考

发表于 2017-02-26 | 分类于 java

目前的形式来说java后台市场还是挺大,虽然也有很多python和php的系统。

要想从事企业级的项目开发,你必须掌握如下要点:

  1. 掌握项目开发的基本步骤
  2. 具备极强的面向对象的分析与设计技巧
  3. 掌握用例驱动、以架构为核心的主流开发方法

没有人愿意自己一辈子就满足于掌握了一些代码实现的技巧,

别人告诉你要实现什么,你就用代码堆砌来实现别人的要求!

你必须学会从整个项目的角度去思考!

你必须学会假如你是项目经理,你该如何思考!

你必须学会假如你是架构师,你该如何思考!

你必须掌握针对某个特定问题领域的分析方法!

关于基础知识:

阅读全文 »
HiSEN

Ubuntu 16 LTS 安装zookeeper并开机启动

发表于 2017-02-24 | 分类于 linux

一、安装

1
sudo apt-get install zookeeper

默认信息

1
2
3
4
#安装路径
/usr/share/zookeeper
#配置文件
/etc/zookeeper/conf/zoo.cfg

二、启动服务端

阅读全文 »
HiSEN

Ubuntu 16 LTS 安装redis - apt-get install redis-server

发表于 2017-02-23 | 分类于 linux

配置文件的路径: /etc/redis/redis.conf

redis服务路径: /etc/init.d/redis-server

默认是开机启动

阅读全文 »
HiSEN

BeanCreationException: Error creating bean with name 'xxxService'

发表于 2017-02-23

出现的问题:

1
2
3
[platform] ERROR 2017-02-22 17:46:05,756 [RMI TCP Connection(4)-127.0.0.1] org.springframework.web.context.ContextLoader.() | Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pmTranLimitLiteServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.msds.zkutil.ZkLockFactory] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(mappedName=, shareable=true, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER, lookup=)}
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306) ~[spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116) ~[spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

最重要的是这句

1
2
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name'pmTranLimitLiteServiceImpl'

出现的原因:
缺少相关的jar包或者依赖

建议不要自己配置idea的module和artificts

直接在pom.xml文件添加

1
2
<artifactId>hisen-project</artifactId><!--加在这句话后面-->
<packaging>war</packaging><!--加上这句话就会自动给你打war包-->


其他原因

开始不知道什么问题,后来搜索这个服务。

发现这跟dubbo有关,于是百度搜索进了官网

没想到常见问题里面就有说这个事情

1
2
3
13. 出现org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxService': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Method must not be null怎么办?

通常是classpath下存在spring多个版本的jar包,排除掉不需要的spring包即可。

更多dubbo问题:点击查看

HiSEN

IDEA - Java.Lang.OutOfMemoryError: PermGen Space

发表于 2017-02-22 | 分类于 java

Java.Lang.OutOfMemoryError: PermGen Space

Tomcat只分配了非常小的PermGen内存,这里重新设置一下

直接在配置tomcat的时候,在VM options填入:

1
-XX:PermSize=97m -XX:MaxPermSize=256m

HiSEN

Maven目录下*.lastupdated命令行批量删除

发表于 2017-02-20 | 分类于 java

windows系统

1
2
cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i

或者新建一个bat文件,批处理。就不用每次都在cmd敲命令了

1
2
3
4
5
6
7
8
9
10
11
12
13
@echo off
echo 确认删除maven仓库下*.lastUpdated文件?
pause
::create by hisenyuan([email protected])

::这里写你的仓库路径
set REPOSITORY_PATH=C:\hisenwork\soft\maven
echo 正在搜索...
for /f "delims=" %%i in ('dir /b /s "%REPOSITORY_PATH%\*lastUpdated*"') do (
del /s /q %%i
)
echo 完毕
pause

linux系统

1
find /app/maven/localRepository -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;

HiSEN

IDEA maven项目通过mongo-java-driver折腾一下MongoDB

发表于 2017-02-20 | 分类于 java

这几天折腾ubuntu然后安装了下mongodb

通过Oracle VM VirtualBox端口转发,连接了虚拟机的MongoDB

1.用idea创建一个maven项目

2.在pom.xml中添加mongodb java驱动

1
2
3
4
5
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.2.2</version>
</dependency>

3.参考官方:MongoDB Driver Quick Tour

本用例github地址:mongodbTest

贴下代码:

阅读全文 »

HiSEN

Windows10开机bat启动VirtualBox虚拟机并且后台运行

发表于 2017-02-20 | 分类于 软件

1.制作启动脚本

新建一个start.bat文件,内容如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
@echo off

echo 本命令可让us在后台运行
echo 启动之后可以关闭本窗口

::进入虚拟机目录
cd C:\"Program Files"\Oracle\VirtualBox

::执行相关命令 同时启动两台虚拟机
VBoxManage startvm "us" --type headless
::VBoxManage startvm "ubuntu" --type headless

::执行完之后按回车退出窗口
pause

2.设置开机启动

把start.bat文件复制到[启动]文件夹里面

[启动]文件夹路径

1
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

文件管理器地址栏显示大概是这样

1
Windows > [开始]菜单 > 程序 > 启动

放进去之后就可以开机启动了!

启动之后Xshell连接即可

1…212223…27
hisenyuan

hisenyuan

Java R & D

266 日志
33 分类
112 标签
GitHub Weibo
Links
  • 科技爱好者周刊
  • 美团技术团队
  • duanple(老师木)
  • 当然我在扯淡(王垠)
  • 段永平的博客
  • 梦殇国际
© 2016 - 2024 hisenyuan
由 Hexo 强力驱动
您是第  个访问者    |   
主题 - NexT.Mist