草庐IT

tcp-connections

全部标签

java - 无法创建 PoolableConnectionFactory(Io 异常 : The Network Adapter could not establish the connection)

您好,我在spring应用程序中遇到了上述异常,我正在尝试连接到集群Oracle数据库,但即使我尝试连接到单个实例仍然有相同的异常。bean定义如下:完整的堆栈跟踪是:2012-02-1313:18:45,0841375[main]INFOorg.hibernate.connection.ConnectionProviderFactory-Initializingconnectionprovider:org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider2012-02-1313:18:45,2071498

java - 提供的 java.sql.Connection 对象为空

我正在尝试将jrxml文件导出为pdf,但出现此错误:WARNquery.JRJdbcQueryExecuter-Thesuppliedjava.sql.Connectionobjectisnull.我只得到一个空白的pdf文件..这是我导出为PDF的方法:publicvoidprintReport(ActionEventevent)throwsJRException,IOException{StringreportPath=FacesContext.getCurrentInstance().getExternalContext().getRealPath("/test.jrxml")

java - 如何将 Jdbc4Connection 转换为 PGConnection?

我想像这样使用postgresCopyManager:CopyManagercp=((PGConnection)dataSource.getConnection()).getCopyAPI();当我使用spring-boot时,数据源是org.apache.tomcat.jdbc.pool.DataSource,因此连接是Jdbc4Connection。问题:转换抛出以下错误:java.lang.ClassCastException:com.sun.proxy.$Proxy55cannotbecasttoorg.postgresql.PGConnection此外,当我尝试转换为Jdbc

java - Tomcat : HikariCP issue when deploying two applications with DB connection

我试图在同一个tomcat7实例上部署两个WAR文件(app1.war和app2.war)。我收到此错误:UnabletoregisterMBean[HikariDataSource(HikariPool-0)]withkey'dataSource';nestedexceptionisjavax.management.InstanceAlreadyExistsException:com.zaxxer.hikari:name=dataSource,type=HikariDataSource如果我在tomcat上只部署了一个应用程序,我就不会出现这个错误。有办法解决这个问题吗?

javax.mail.MessagingException : Could not connect to SMTP host?

以下是我发送邮件的代码:importjava.util.Properties;importjavax.mail.Authenticator;importjavax.mail.Message;importjavax.mail.Message.RecipientType;importjavax.mail.MessagingException;importjavax.mail.PasswordAuthentication;importjavax.mail.Session;importjavax.mail.Transport;importjavax.mail.internet.Internet

java - 如何在 Spring Boot 应用程序启动时启动 H2 TCP 服务器?

通过将以下行添加到SpringBootServletInitializermain方法中,我可以在将应用程序作为SpringBoot应用程序运行时启动H2TCP服务器(文件中的数据库):@SpringBootApplicationpublicclassNatiaApplicationextendsSpringBootServletInitializer{publicstaticvoidmain(String[]args){Server.createTcpServer().start();SpringApplication.run(NatiaApplication.class,args)

java.net.SocketException : Network is unreachable: connect 异常

我正在尝试使用此方法从Web服务器下载xml文本文件:staticvoiddownload(Stringurl,StringfileName)throwsIOException{FileWriterxmlWriter;xmlWriter=newFileWriter(fileName);System.out.println("URLtodownloadis:"+url);//hereExceptionisthrown/////////////////////////////////BufferedReaderinputTxtReader=newBufferedReader(newBuff

java - PreparedStatement 的 "close"与 Connection 的关系?

Javadoc说PreparedStatement的.close()说它..ReleasesthisStatementobject'sdatabaseandJDBCresourcesimmediatelyinsteadofwaitingforthistohappenwhenitisautomaticallyclosed.Itisgenerallygoodpracticetoreleaseresourcesassoonasyouarefinishedwiththemtoavoidtyingupdatabaseresources.CallingthemethodcloseonaStatem

Java TCP 连接

如何在Java中创建TCP套接字?如何创建这样的TCP连接,使其仅在我告诉它时终止,否则它会保持打开状态?如何使用keepalive知道服务器或客户端是否仍然可用?请帮忙! 最佳答案 HowdoIcreateaTCPsocketinJava?Socketsocket=newSocket(hostname,port);http://docs.oracle.com/javase/tutorial/networking/sockets/index.htmlHowdoIcreatesuchaTCPconnectionthatittermin

java - 即时通讯工具 TCP 或 UDP 哪个更好?

我需要在Java语言中使用纯套接字实现客户端/服务器即时消息。服务器应该为大量客户端提供服务,我需要决定应该使用哪个套接字-TCP或UDP。谢谢,科斯塔。 最佳答案 TCP原因:TCP:“绝对保证传输的数据保持完整,并按照发送时的相同顺序到达。”UDP:“根本无法保证发送的消息或数据包一定会到达。”了解更多信息:http://www.diffen.com/difference/TCP_vs_UDP您是否希望您的聊天消息可能丢失?编辑:我错过了关于“大型聊天程序”的部分。我认为由于聊天程序的性质,它需要一个TCP服务器,我无法想象用户