[pgsql-jp: 31646] Re: postgreSQLをクライアントからTCP/ip接続するには?

T.Suzuki t_suzuki @ kenwood-eng.co.jp
2003年 11月 27日 (木) 15:52:14 JST


鈴木@KEGと申します。

[pgsql-jp: 31640] 堀田さん wrote:
> > # psql の"-h" でホスト指定したのでしょうか?
> > # だとしたら、libpqを使用したネイティブ接続になっているかも
>
> 「libpq プロトコルを使った TCP/IP 接続」だと思います。
失礼しました、TCP/IP接続ですね。
postgresql.conf の ”tcpip_socket = true” を false にして再起動し
他のサーバから接続できなくなる事を確認しました。

[pgsql-jp: 31642]
> このへんのソースから postgresql.jar を作って、tomcat/hoge/lib に
> あるものと替えたりする必要はないんでしょうか? --with-java とか
> つければ(ツールが入っていれば)勝手に作ってくれるものなのかもし
> れませんが。
PostgreSQL 7.4 のインストールが成功したと思えなかったので、
JDBC の更新を怠っていました(ClassPath上に古いJDBCドライバがありました)。

[pgsql-jp: 31643]  三淵@NWC さん wrote:
> http://ml.postgresql.jp/pipermail/pgsql-jp/2003-November/006600.html
>
> 7.4RC2の書き込みですが
> ひょっとするとこの辺で
> ワーニングも出なくなるかも・・・
7.4 リリース日にWarningが出たので、すぐ上記のソースを追ってみましたが、
解決できなかった次第です。

JDBCを入れ替え、再検証をしてみます。

ぱっと試した所、JDBCのコンパイルは失敗してしまったので
http://jdbc.postgresql.org/download.html
からダウンロードした ”7.4beta3” のJDBCをドライバを使用した限りでは
Tomcatから socket接続できませんでした。

------------------------------------------------
Tomcat の logs/catalina.out の ログを以下に記載します。
"Check that the hostname and port are correct and that the postmaster is accepting TCP/IP
connections."
とエラーにあるので、
socket 通信が出来ない状態で postmasterが起動したのかと思い込んでましたが
違うのですね…

//--- catalina.out の抜粋 ---
2003/11/27 14:23:33 org.apache.commons.modeler.Registry loadRegistry
情報: Loading registry information
2003/11/27 14:23:33 org.apache.commons.modeler.Registry getRegistry
情報: Creating new Registry instance
2003/11/27 14:23:35 org.apache.commons.modeler.Registry getServer
情報: Creating MBeanServer
2003/11/27 14:23:37 org.apache.coyote.http11.Http11Protocol init
情報: Initializing Coyote HTTP/1.1 on port 8080
ServerLifecycleListener: createMBeans: MBeanException
java.lang.Exception: ManagedBean is not found with Ajp13Connector
     at org.apache.catalina.mbeans.MBeanUtils.createMBean(MBeanUtils.java:224)
     at
org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecycleListener.java:369)
     at
org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecycleListener.java:777)
     at
org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecycleListener.java:751)
     at
org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecycleListener.java:339)
     at
org.apache.catalina.mbeans.ServerLifecycleListener.lifecycleEvent(ServerLifecycleListener.java:206)
     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
     at org.apache.catalina.core.StandardServer.start(StandardServer.java:2182)
     at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
     at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
     at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
サービス Tomcat-Standalone を起動します
Apache Tomcat/4.1.18-LE-jdk14
Catalina.start: LifecycleException:  データベース接続オープン時の例外:
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct
and that the postmaster is accepting TCP/IP connections.
LifecycleException:  データベース接続オープン時の例外:  org.postgresql.util.PSQLException:
Connection refused. Check that the hostname and port are correct and that the postmaster is
accepting TCP/IP connections.
     at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:681)
     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1173)
     at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
     at org.apache.catalina.core.StandardService.start(StandardService.java:497)
     at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)
     at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
     at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
     at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
----- Root Cause -----
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct
and that the postmaster is accepting TCP/IP connections.
     at
org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:204)
     at org.postgresql.Driver.connect(Driver.java:138)
     at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:616)
     at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:679)
     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1173)
     at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
     at org.apache.catalina.core.StandardService.start(StandardService.java:497)
     at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)
     at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
     at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
     at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)




pgsql-jp メーリングリストの案内