最近在学习ssh,咨询个问题,请知道的指点,先谢谢。

alphat 发布于 2017/01/10 23:45
阅读 466
收藏 0

我用的是intellij idea ,创建项目采用maven的方式快速安装了SSH,但是这时候我希望采用零配置,我需要导入Convention plugin ,我采用了maven的方式下载了与struts相同版本的插件,我的方法是这样操作的

File->project structures->Libraries ->点击上面绿色的+->From Maven->搜索Convention plugin安装后一切OK

我点击->Artifacts-> 在Available Elements 中,刚刚下载的插件右键->Put into/Web-INF/lib ,导入到lib中。

但是运行项目却一直出错。


 Unable to load configuration. - bean - jar:file:/D:/IdeaProjects/ssh/out/artifacts/ssh_war_exploded/WEB-INF/lib/struts2-core.jar!/struts-default.xml:57:72
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
	at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:967)
	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:435)
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:479)
	at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
	at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4572)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5215)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
	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:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	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:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	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:1468)
	at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
	at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/D:/IdeaProjects/ssh/out/artifacts/ssh_war_exploded/WEB-INF/lib/struts2-core.jar!/struts-default.xml:57:72
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:247)
	at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:240)
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
	... 53 more
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name struts has already been loaded by bean - jar:file:/D:/IdeaProjects/ssh/out/artifacts/ssh_war_exploded/WEB-INF/lib/struts2-core-2.3.20.1.jar!/struts-default.xml:57:72 - bean - jar:file:/D:/IdeaProjects/ssh/out/artifacts/ssh_war_exploded/WEB-INF/lib/struts2-core.jar!/struts-default.xml:57:72
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:231)
	... 56 more



然后我又到官方下载了相同版本的struts-all.zip ,解压了里面的Convention plugin 然后是这样操作的

File->project structures->Modules->点击右侧绿色的+->Jars or directories ->选中Convention plugin导入。

然后,我点击->Artifacts-> 在Available Elements 中,刚刚下载的插件右键->Put into/Web-INF/lib ,导入到lib中。

这一次就Ok了,工程没有出错。

为什么会这样?我就选择了Libraries中添加Convention,但是工程总是出现上面错误,我用Modules导入官方下载的就没问题,请问这是怎么回事?

加载中
0
哎码
哎码
不好意思,看了半天没整明白。。建议直接在pom.xml里面直接添加jar的地址,而不是用ide自带的快捷功能进行添加,否则真的找不到错误 http://mvnrepository.com/ 在这里面搜索你需要的jar包
0
夜苍狼
夜苍狼
你是在学写代码还是在学怎么用 intelliJ idea
0
百世经纶之傲笑红尘
百世经纶之傲笑红尘
不要用eclipse的目光看idea
0
土卫十六
土卫十六
ssh不是只要输入用户名密码以后,就和Linux命令没有区别了吗?还用学?
乌龟壳
乌龟壳
这楼歪的。。。。
0
a
alphat

引用来自“土卫十六”的评论

ssh不是只要输入用户名密码以后,就和Linux命令没有区别了吗?还用学?
Java的Web开发框架 Struts 2 + Spring + Hibernate 不是远程登录的Secure Shell 
0
a
angryid

另外,如果你遇到的是classNotFound异常,或者not defind bean,可以复制类名,或者报错的类全路径到 http://www.mvnjar.com/ 搜索一下,可以搜类名

返回顶部
顶部