web-dev-qa-db-ja.com

Glassfish + Postgresは接続プールにpingできません

Glassfish3.1とPostgresを使用してWebアプリケーションのログインページを作成しようとしています。ローカルデータベース(localhost:5432)があります。これは私の接続プールです:

Pool Name:pacjentauth
Resource Type:javax.sql.DataSource
Datasource Classname:org.postgresql.ds.PGSimpleDataSource
Driver Classname: [nothing here]

portNumber、ServerName、ユーザー、パスワードは問題ありません。これは私が得るエラーです:

[#|2013-01-03T20:13:44.110+0100|WARNING|glassfish3.1.2|javax.enterprise.system.container.web.com.Sun.web.security|_ThreadID=113;_ThreadName=Thread-2;|WEB9102: Web Login Failed: com.Sun.enterprise.security.auth.login.common.LoginException: Login failed: Security Exception|#]

[#|2013-01-03T20:21:54.567+0100|WARNING|glassfish3.1.2|org.Apache.catalina.connector.Request|_ThreadID=50;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context , because request parameters have already been read, or ServletRequest.getReader() has already been called|#]

[#|2013-01-03T20:21:54.924+0100|WARNING|glassfish3.1.2|org.Apache.catalina.connector.Request|_ThreadID=38;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context , because request parameters have already been read, or ServletRequest.getReader() has already been called|#]

[#|2013-01-03T20:21:54.976+0100|WARNING|glassfish3.1.2|org.Apache.catalina.connector.Request|_ThreadID=34;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context , because request parameters have already been read, or ServletRequest.getReader() has already been called|#]

[#|2013-01-03T20:21:55.032+0100|WARNING|glassfish3.1.2|org.Apache.catalina.connector.Request|_ThreadID=49;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context , because request parameters have already been read, or ServletRequest.getReader() has already been called|#]

[#|2013-01-03T20:21:55.084+0100|WARNING|glassfish3.1.2|org.Apache.catalina.connector.Request|_ThreadID=50;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context , because request parameters have already been read, or ServletRequest.getReader() has already been called|#]

[#|2013-01-03T20:21:55.691+0100|INFO|glassfish3.1.2|org.glassfish.admingui|_ThreadID=38;_ThreadName=Thread-2;|Redirecting to /common/security/realms/realms.jsf|#]

[#|2013-01-03T20:21:55.751+0100|INFO|glassfish3.1.2|org.glassfish.admingui|_ThreadID=49;_ThreadName=Thread-2;|Admin Console: Initializing Session Attributes...|#]

[#|2013-01-03T20:22:06.541+0100|SEVERE|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.Sun.gjc.util|_ThreadID=163;_ThreadName=Thread-2;|RAR5099 : Wrong class name or classpath for Datasource Object 
Java.lang.ClassNotFoundException: org.postgresql.ds.PGSimpleDataSource
    at Java.net.URLClassLoader$1.run(URLClassLoader.Java:366)
    at Java.net.URLClassLoader$1.run(URLClassLoader.Java:355)
    at Java.security.AccessController.doPrivileged(Native Method)
    at Java.net.URLClassLoader.findClass(URLClassLoader.Java:354)
    at Java.lang.ClassLoader.loadClass(ClassLoader.Java:423)
    at Java.lang.ClassLoader.loadClass(ClassLoader.Java:356)
    at Java.lang.Class.forName0(Native Method)
    at Java.lang.Class.forName(Class.Java:264)
    at com.Sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.Java:285)
    at com.Sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.Java:114)
    at com.Sun.gjc.spi.ManagedConnectionFactory.getDataSource(ManagedConnectionFactory.Java:1307)
    at com.Sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.Java:163)
    at com.Sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.Java:102)
    at com.Sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getUnpooledConnection(ConnectorConnectionPoolAdminServiceImpl.Java:697)
    at com.Sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.testConnectionPool(ConnectorConnectionPoolAdminServiceImpl.Java:426)
    at com.Sun.enterprise.connectors.ConnectorRuntime.pingConnectionPool(ConnectorRuntime.Java:1086)
    at org.glassfish.connectors.admin.cli.PingConnectionPool.execute(PingConnectionPool.Java:130)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.Java:348)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.Java:363)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.Java:1085)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.Java:95)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.Java:1291)
    at com.Sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.Java:1259)
    at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.Java:214)
    at org.glassfish.admin.rest.resources.TemplateExecCommand.executeCommand(TemplateExecCommand.Java:127)
    at org.glassfish.admin.rest.resources.TemplateCommandGetResource.processGet(TemplateCommandGetResource.Java:78)
    at Sun.reflect.GeneratedMethodAccessor186.invoke(Unknown Source)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke(Method.Java:601)
    at com.Sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.Java:60)
    at com.Sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.Java:205)
    at com.Sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.Java:75)
    at com.Sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.Java:288)
    at com.Sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.Java:134)
    at com.Sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.Java:147)
    at com.Sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.Java:134)
    at com.Sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.Java:147)
    at com.Sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.Java:108)
    at com.Sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.Java:147)
    at com.Sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.Java:84)
    at com.Sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.Java:1469)
    at com.Sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.Java:1400)
    at com.Sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.Java:1349)
    at com.Sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.Java:1339)
    at com.Sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.Java:182)
    at com.Sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.Java:147)
    at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.Java:148)
    at com.Sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.Java:179)
    at com.Sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.Java:117)
    at com.Sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.Java:354)
    at com.Sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.Java:195)
    at com.Sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.Java:849)
    at com.Sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.Java:746)
    at com.Sun.grizzly.http.ProcessorTask.process(ProcessorTask.Java:1045)
    at com.Sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.Java:228)
    at com.Sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.Java:137)
    at com.Sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.Java:104)
    at com.Sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.Java:90)
    at com.Sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.Java:79)
    at com.Sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.Java:54)
    at com.Sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.Java:59)
    at com.Sun.grizzly.ContextTask.run(ContextTask.Java:71)
    at com.Sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.Java:532)
    at com.Sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.Java:513)
    at Java.lang.Thread.run(Thread.Java:722)
|#]

[#|2013-01-03T20:22:06.542+0100|WARNING|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.Sun.enterprise.connectors.service|_ThreadID=163;_ThreadName=Thread-2;|RAR8054: Exception while creating an unpooled [test] connection for pool [ pacjentauth ], Class name is wrong or classpath is not set for : org.postgresql.ds.PGSimpleDataSource|#]

[#|2013-01-03T20:22:06.546+0100|SEVERE|glassfish3.1.2|org.glassfish.admingui|_ThreadID=161;_ThreadName=Thread-2;|RestResponse.getResponse() gives FAILURE.  endpoint = 'http://localhost:4848/management/domain/resources/ping-connection-pool.json'; attrs = '{id=pacjentauth}'|#]

何が間違っている可能性があるアイデアはありますか?十分な情報がない場合は、plzが必要なものを教えてください。

11
Iwo Kucharski

わかりました、それはすべてjarについてでした。私はこれらのファイルをコピーしました:

postgresql-9.2-1002.jdbc4
postgresql-9.2-1002.jdbc3

to C:\Users\epcs\GlassFish_Server\glassfish\domains\epacjent\libそしてそれはついに機能します。

21
Iwo Kucharski

GlassFishlibディレクトリにPostgresJDBCドライバーjarを配置しようとしましたか? MySQLでは、MySQL JDBCドライバーをダウンロードし、jarファイルを/opt/glassfishv3/glassfish/libにコピーする必要がありました。

3
blackpanther