当前位置:编程学习 > JAVA >>

strtus2 需要连网才可正常运行,怎么办?!

刚开始学strtus2 刚开始没发现问题,结果断开网络后一运行就报以下错误,求帮助!谢谢!


严重: Dispatcher initialization failed
Unable to load configuration. - Class: java.net.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1


严重: Exception starting filter struts2
Unable to load configuration. - Class: java.net.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1


严重: Error filterStart
2013-1-17 19:17:17 org.apache.catalina.core.StandardContext startInternal
严重: Context [/UserManage2.0] startup failed due to previous errors
2013-1-17 19:17:17 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/UserManage2.0] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2013-1-17 19:17:17 org.apache.coyote.AbstractProtocolHandler start
信息: Starting ProtocolHandler ["http-apr-80"]
2013-1-17 19:17:17 org.apache.coyote.AbstractProtocolHandler start
信息: Starting ProtocolHandler ["ajp-apr-8009"]
2013-1-17 19:17:17 org.apache.catalina.startup.Catalina start
信息: Server startup in 2808 ms struts2 --------------------编程问答-------------------- 可能是你的web.xml文件里面配置的问题,检查一下是否配对了。。。。
或者把你的配置文件贴出来看看错在哪里。。。还有就是看看你的jar包是否都有。。。 --------------------编程问答-------------------- 问题应该出xml文件的dtd文件中, 联网状况下是用网上的dtd文件,而断网后找不到这个文件。你可以参考我这篇文章http://blog.csdn.net/xiaoliouc/article/details/8206519

如果通过这种方式还没法解决,把配置文件和代码贴上来 --------------------编程问答--------------------
2013-1-17 19:17:17 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/UserManage2.0] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
从你的错误信息中判断出
你数据库连的别人机器上的的吧。
一断网肯定会报错啊 --------------------编程问答-------------------- 你是不是用jndi了? --------------------编程问答-------------------- 配置的东西引用了互联网上的东西了哇. --------------------编程问答-------------------- 我用了二楼的方法,但还是报错,别人的都不会!纠结……
四楼说jndi,嘿嘿……恕我愚昧,还不知道那是什么! --------------------编程问答-------------------- 三楼说我数据库连到别人的机器上去了,怎么会呢?! --------------------编程问答--------------------
引用 3 楼 EverWHL 的回复:
Java code?122013-1-17 19:17:17 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc严重: The web application [/UserManage2.0] registered the JDBC driver [com.mysql.jdbc.Driver] ……
正解 --------------------编程问答-------------------- 因为xsd获取dtd检测错误,一般本地是有。但是也有可以你在清理垃圾的时候删了。在工具里面是可以设置的 --------------------编程问答-------------------- 我的错误信息跟楼主一样....SSH框架整合在一起,莫有网就报错,有网就可以了 --------------------编程问答-------------------- web.xml的配置文件 清大侠们看看
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">


<context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>/WEB-INF/classes/applicationContext.xml</param-value>  
</context-param> 
  

 <filter>
   <filter-name>struts2</filter-name>
   <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
  </filter>
  
  <filter-mapping>
   <filter-name>struts2</filter-name>
   <url-pattern>/*</url-pattern>
  </filter-mapping>
  
  
  <listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>


</web-app>
--------------------编程问答-------------------- 这个是struts.xml的配置文件

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">


<struts>    
     <package name="sturts2" namespace="/" extends="struts-default">

<action name="regist" class="myUsersAction">
<result name="success">/login.jsp</result>
<result name="error">/regist.jsp</result>
</action>


<action name="login" class="myUsersAction" >
<result name = "success">/homePage.jsp</result>
<result name = "error">/login.jsp</result>
</action>

<action name="fenye" class="myUsersAction" >
<result name = "success">/homePage.jsp</result>
<result name = "error">/login.jsp</result>
</action>


<action name="foodDetails" class="myFoodDetailsAction" >
<result name = "success">/foodDetails.jsp</result>
<result name = "error">/homePage.jsp</result>
</action>

<action name="commentList" class="myCommentListAction" >
<result name = "success">/comment .jsp</result>
<result name = "error">/homePage.jsp</result>
</action>


<action name="cartitem" class="myCartitemAction" >
<result name = "success">/footCart.jsp</result>
<result name = "error">/homePage.jsp</result>
</action>

<action name="delete" class="myCartitemAction" >
<result name = "success">/footCart.jsp</result>
<result name = "error">/homePage.jsp</result>
</action>

<action name="update" class="myCartitemAction" >
<result name = "success">/footCart.jsp</result>
<result name = "error">/homePage.jsp</result>
</action>

<action name="zhanghu" class="myZhanghuAction" >
<result name = "success">/amount.jsp</result>
<result name = "error">/homePage.jsp</result>
</action>

<action name="chongzhi" class="myZhanghuAction" >
<result name = "success">/amount.jsp</result>
<result name = "error">/homePage.jsp</result>
</action>


<action name="guanli" class="action.ZhanghuAction" >
<result name = "success">/accountMg.jsp</result>
<result name = "error">/homePage.jsp</result>
</action>



</package>

<package name="a2" extends="json-default" namespace="/">

<action name="ajaxUsers" class="action.AjaxUsersAction">

<result name="success" type="json"></result>

</action>
</package>




</struts>


--------------------编程问答-------------------- 用到struts的标签了吗? 标签引入路径用是公网的吗
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,