java server: all kinds of errors

时间:2021-12-23 16:08:50

1、在开启java服务器程序时候,web.xml中一直有各种各样错误,查找解决方案好久,都没有靠谱的,头大。忽然看到一条,司马当成活马医:http://*.com/questions/13437569/what-does-this-web-xml-error-mean,其中一条解决方案如下:

replace

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">

with

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee;http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">

The solution is that you have to put semicolon between URLs

I am sure you will not get the error again :)

很好,try it and all errors gone. solved perfectly.

2、

Caused by: java.lang.IllegalStateException: Target host must not be null, or set in parameters.

 报错的原因是因为没有在加url中加“http://”,加上http://就是解决方案。

3、

org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:8080 refused 

or Caused by: java.net.ConnectException: failed to connect to /192.168.1.108 (port 8080): connect failed: ENETUNREACH (Network is unreachable)

or Caused by: java.net.ConnectException: failed to connect to /127.0.0.1 (port 8080): connect failed: ECONNREFUSED (Connection refused)

这个问题可能原因有(1)Android平台的网络没开(我就死在这半天)(2)Manifest.xml的internet权限没有添加。(3)系统防火墙没有关闭。(4)url书写错误。

4、eclipese连接MySQL出错,出错位置在“Class.forName("com.mysql.jdbc.Driver")”

解决方法为:将mysql-connector-java-5.0.3-bin.jar导入eclipse中就可以了。