Hi all: I have resolved this problem by configuring a jndi datasource in tomcat. But I still want to find out why it throw an exception in DIH when I configure datasource in data-configure.xml but a jndi resource.
Regards. 2012/8/16 Jienan Duan <jnd...@gmail.com> > Hi all: > I'm using DataImportHandler load data from MySQL. > It works fine on my develop machine and online environment. > But I got an exception on test environment: > >> Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: >>> Communications link failure >> >> >>> The last packet sent successfully to the server was 0 milliseconds ago. >>> The driver has not received any packets from the server. >> >> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native >>> Method) >> >> at >>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) >> >> at >>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) >> >> at java.lang.reflect.Constructor.newInstance(Constructor.java:513) >> >> at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) >> >> at >>> com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) >> >> at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:343) >> >> at >>> com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2132) >> >> ... 26 more >> >> Caused by: java.net.ConnectException: Connection timed out >> >> at java.net.PlainSocketImpl.socketConnect(Native Method) >> >> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351) >> >> at >>> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213) >> >> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200) >> >> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) >> >> at java.net.Socket.connect(Socket.java:529) >> >> at java.net.Socket.connect(Socket.java:478) >> >> at java.net.Socket.<init>(Socket.java:375) >> >> at java.net.Socket.<init>(Socket.java:218) >> >> at >>> com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:253) >> >> at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:292) >> >> ... 27 more >> >> This make me confused,because the test env and online env almost > same:Tomcat runs on a Linux Server with JDK6,MySql5 runs on another. > Even I wrote a simple JDBC test class it works,a jsp file with JDBC code > also works.Only DataImportHandler failed. > I'm trying to read Solr source code and found that it seems Solr has it's > own ClassLoader.I'm not sure if it goes wrong with Tomcat on some specific > configuration. > Dose anyone know how to fix this problem? Thank you very much. > > Best Regards. > > Jienan Duan > > -- > ------------------------------------------------------ > 不走弯路,就是捷径。 > http://www.jnan.org/ > > -- ------------------------------------------------------ 不走弯路,就是捷径。 http://www.jnan.org/