Glassfish管理控制台在创建JDBC池

时间:2015-10-09 23:13:22

标签: java mysql jdbc glassfish-4

一周前我下载了Glassfish 4.1。拉链安装。尝试使用管理控制台创建JDBC连接池。收到此错误消息:

java.lang.IllegalStateException: getOutputStream() has already been called for this response

很多对该错误的引用。很多人都宣称它是'#34; Asked&回答&#34 ;.但我找不到任何问题的单一参考,更不用说解决方案了。

但如果有人认为已经回答了这个问题,请务必添加指向此问题的解决方案的链接:新安装。除了打开控制台并尝试创建新的JDBC连接池之外什么都没做。

Resource Type: javax.sql.DataSource.  
Vendor: MySql. 

我在\ glassfish4 \ glassfish \ lib中存储了mysql-connector-java-5.1.35.jar

这是我找到的最接近解决方案的东西。但它适用于GF v3。

  

我终于找到了我的domain.xml中的实际问题:   -Dorg.glassfish.web.rfc2109_cookie_names_enforced=false   在asupgrade创建的domain.xml中丢失了。我刚刚将它添加到domain.xml jvm-options中,GF v3现在按预期工作。   补充:
  <jvm-options>-Dorg.glassfish.web.rfc2109_cookie_names_enforced=false</jvm-options>

试过了。没有工作。 (我粘贴了GF日志条目,显示推荐的行被添加到启动时使用的domain.xml GF中。)

我尝试从旧的v3服务器中挖掘出domain.xml并在新的v4中使用它。那不行。

涉及我的Exception消息的其他问题都与使用已部署的应用程序(主要是servlet)相关。但这是一个干净的服务器。没有安装任何应用程序。

我发现很多链接到处理此异常的人作为GF错误。大多数人都是前一段时间。没有给出解决方法,甚至说他们已经解决了它。

有人能提供解决方案吗? 或者让我知道这是否只是Oracle决定不修复的错误? 或者知道我在哪里可以找到帮助?这让我很难过。

如果有帮助,可以使用GF日志进行干净启动(在domain.xml中使用jvm插入。)它还显示了创建JDBC连接池失败尝试的堆栈跟踪。

注意:我拉出了所有[INFO]日志条目。所有留下的[警告]条目似乎都与Grizzly有关。

[2015-10-09T12:21:24.598-1000] [] [INFO] [NCLS-GFLAUNCHER-00005] [javax.enterprise.launcher] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1444429284598] [levelValue: 800] [[
  JVM invocation command line:
C:\Program Files\Java\jdk1.8.0_05\bin\java.exe
-cp
C:/glassfish4/glassfish/modules/glassfish.jar
-XX:+UnlockDiagnosticVMOptions
-XX:NewRatio=2
-XX:MaxPermSize=192m
-Xmx512m
-javaagent:C:/glassfish4/glassfish/lib/monitor/flashlight-agent.jar
-client
-Djavax.xml.accessExternalSchema=all
-Djavax.net.ssl.trustStore=C:\glassfish4\glassfish\domains\domain1/config/cacerts.jks
-Djdk.corba.allowOutputStreamSubclass=true
-Dfelix.fileinstall.dir=C:\glassfish4\glassfish/modules/autostart/
-Dorg.glassfish.additionalOSGiBundlesToStart=org.apache.felix.shell,org.apache.felix.gogo.runtime,org.apache.felix.gogo.shell,org.apache.felix.gogo.command,org.apache.felix.shell.remote,org.apache.felix.fileinstall
-Dcom.sun.aas.installRoot=C:\glassfish4\glassfish
-Dfelix.fileinstall.poll=5000
-Djava.endorsed.dirs=C:\glassfish4\glassfish/modules/endorsed;C:\glassfish4\glassfish/lib/endorsed
-Djava.security.policy=C:\glassfish4\glassfish\domains\domain1/config/server.policy
-Dosgi.shell.telnet.maxconn=1
-Dfelix.fileinstall.bundles.startTransient=true
-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory
-Dfelix.fileinstall.log.level=2
-Dorg.glassfish.web.rfc2109_cookie_names_enforced=false
-Djavax.net.ssl.keyStore=C:\glassfish4\glassfish\domains\domain1/config/keystore.jks
-Djava.security.auth.login.config=C:\glassfish4\glassfish\domains\domain1/config/login.conf
-Dfelix.fileinstall.disableConfigSave=false
-Dfelix.fileinstall.bundles.new.start=true
-Dcom.sun.aas.instanceRoot=C:\glassfish4\glassfish\domains\domain1
-Dosgi.shell.telnet.port=6666
-Dgosh.args=--nointeractive
-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as
-Dosgi.shell.telnet.ip=127.0.0.1
-DANTLR_USE_DIRECT_CLASS_LOADING=true
-Djava.awt.headless=true
-Dcom.ctc.wstx.returnNullForDefaultNamespace=true
-Djava.ext.dirs=C:\Program Files\Java\jdk1.8.0_05/lib/ext;C:\Program Files\Java\jdk1.8.0_05/jre/lib/ext;C:\glassfish4\glassfish\domains\domain1/lib/ext
-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver
-Djava.library.path=C:/glassfish4/glassfish/lib;C:/ProgramData/Oracle/Java/javapath;C:/Windows/Sun/Java/bin;C:/Windows/System32;C:/Windows;C:/glassfish4/glassfish/ C:/Program Files/Dell/Dell Data Protection/Drivers/TSS/bin;C:/Program Files (x86)/Common Files/Intuit/QBPOSSDKRuntime;C:/Program Files (x86)/QuickTime/QTSystem;D:/Bulletproof/bpMySql/bin;C:/glassfish4/glassfish
com.sun.enterprise.glassfish.bootstrap.ASMain
-upgrade
false
-domaindir
C:/glassfish4/glassfish/domains/domain1
-read-stdin
true
-asadmin-args
--host,,,localhost,,,--port,,,4848,,,--secure=false,,,--terse=false,,,--echo=false,,,--interactive=true,,,start-domain,,,--verbose=false,,,--watchdog=false,,,--debug=false,,,--domaindir,,,C:\glassfish4\glassfish\domains,,,domain1
-domainname
domain1
-instancename
server
-type
DAS
-verbose
false
-asadmin-classpath
C:/glassfish4/glassfish/lib/client/appserver-cli.jar
-debug
false
-asadmin-classname
com.sun.enterprise.admin.cli.AdminMain]]

 [2015-10-09T12:21:27.864-1000] [glassfish 4.1] [WARNING] [] [org.glassfish.grizzly.config.Utils] [tid: _ThreadID=17 _ThreadName=RunLevelControllerThread-1444429287050] [timeMillis: 1444429287864] [levelValue: 900] [[
  Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-1, realClassName=org.glassfish.grizzly.http2.Http2AddOn]]

[2015-10-09T12:21:27.962-1000] [glassfish 4.1] [WARNING] [] [org.glassfish.grizzly.config.Utils] [tid: _ThreadID=17 _ThreadName=RunLevelControllerThread-1444429287050] [timeMillis: 1444429287962] [levelValue: 900] [[
  Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-2, realClassName=org.glassfish.grizzly.http2.Http2AddOn]]

[2015-10-09T12:21:27.970-1000] [glassfish 4.1] [WARNING] [] [org.glassfish.grizzly.config.Utils] [tid: _ThreadID=17 _ThreadName=RunLevelControllerThread-1444429287050] [timeMillis: 1444429287970] [levelValue: 900] [[
  Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=admin-listener, realClassName=org.glassfish.grizzly.http2.Http2AddOn]]

[2015-10-09T12:21:31.120-1000] [glassfish 4.1] [WARNING] [] [org.glassfish.grizzly.config.Utils] [tid: _ThreadID=75 _ThreadName=pool-13-thread-1] [timeMillis: 1444429291120] [levelValue: 900] [[
  Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-1, realClassName=org.glassfish.grizzly.http2.Http2AddOn]]

[2015-10-09T12:21:31.135-1000] [glassfish 4.1] [WARNING] [] [org.glassfish.grizzly.config.Utils] [tid: _ThreadID=75 _ThreadName=pool-13-thread-1] [timeMillis: 1444429291135] [levelValue: 900] [[
  Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-2, realClassName=org.glassfish.grizzly.http2.Http2AddOn]]

[2015-10-09T12:21:37.895-1000] [glassfish 4.1] [WARNING] [] [javax.enterprise.system.container.web.com.sun.web.security] [tid: _ThreadID=48 _ThreadName=admin-listener(4)] [timeMillis: 1444429297895] [levelValue: 900] [[
  Context path from ServletContext:  differs from path from bundle: /]]

 [2015-10-09T12:22:46.963-1000] [glassfish 4.1] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=48 _ThreadName=admin-listener(4)] [timeMillis: 1444429366963] [levelValue: 900] [[
  StandardWrapperValve[FacesServlet]: Servlet.service() for servlet FacesServlet threw exception
java.lang.IllegalStateException: getOutputStream() has already been called for this response
    at org.apache.catalina.connector.Response.getWriter(Response.java:777)
    at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:224)
    at com.sun.faces.context.ExternalContextImpl.getResponseOutputWriter(ExternalContextImpl.java:851)
    at com.sun.faces.context.PartialViewContextImpl.createPartialResponseWriter(PartialViewContextImpl.java:504)
    at com.sun.faces.context.PartialViewContextImpl.access$300(PartialViewContextImpl.java:79)
    at com.sun.faces.context.PartialViewContextImpl$DelayedInitPartialResponseWriter.getWrapped(PartialViewContextImpl.java:642)
    at javax.faces.context.PartialResponseWriter.startDocument(PartialResponseWriter.java:120)
    at com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError(AjaxExceptionHandlerImpl.java:202)
    at com.sun.faces.context.AjaxExceptionHandlerImpl.handle(AjaxExceptionHandlerImpl.java:127)
    at javax.faces.context.ExceptionHandlerWrapper.handle(ExceptionHandlerWrapper.java:100)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:233)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    at org.apache.catalina.core.StandardPipeline.doChainInvoke(StandardPipeline.java:678)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
    at java.lang.Thread.run(Thread.java:745)
]]

8 个答案:

答案 0 :(得分:30)

根据以下JIRA门票:

这仍然是一个尚未解决的问题。尽管从Oracle abandoned a commercial support for Glassfish开始我们可以期待这样的事情,但这种基本功能不起作用仍然很可怕。

然而,如果你真的很绝望,那就有一个非常讨厌的解决方法。除非您正在处理Java DB,否则Glassfish会使用您可能不会需要的预定义JDBC池 DerbyPool 到达。通过将Datasource classname更改为com.mysql.jdbc.jdbc2.optional.MysqlDataSource并调整其他属性以指向MySQL Server实例,可以随意编辑它。在做这个hack之前,请确保将MySQL连接器放到Glassfish的lib文件夹中。

<强>更新

注意到有一个已修补的Glassfish版本,它被称为Payara并可供下载here。根据文档,它是一个GlassFish 4.1克隆,由社区修补并进一步开发。

答案 1 :(得分:18)

我刚从4.1.1回滚到4.1.0 - 工作正常。真是疯狂的GlassFish的错误:(

答案 2 :(得分:8)

有同样的问题,这肯定会让我选择其他应用程序服务器,为什么不选择,jboss,wildfly,......

无论如何这里是另一个workarround,只需将这个xml的和平粘贴到domain.xml中(在其他连接池之间)

<jdbc-connection-pool connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" wrap-jdbc-objects="false" res-type="javax.sql.DataSource" name="mysql_dbuser_rootPool">
      <property name="URL" value="jdbc:mysql://localhost:3306/ANYDB?zeroDateTimeBehavior=convertToNull"></property>
      <property name="driverClass" value="com.mysql.jdbc.Driver"></property>
      <property name="Password" value="THEPASS"></property>
      <property name="portNumber" value="3306"></property>
      <property name="databaseName" value="ANYDB"></property>
      <property name="User" value="THEUSER"></property>
      <property name="serverName" value="localhost"></property>
    </jdbc-connection-pool>

希望有帮助

答案 3 :(得分:8)

可以使用asadmin实用程序管理JDBC连接 - AFAIK管理GUI只是它的前端。

此处描述asadmin用法: https://docs.oracle.com/cd/E26576_01/doc.312/e24928/jdbc.htm#GSADG00420

E.g。

asadmin> create-jdbc-connection-pool --datasourceclassname org.apache.derby.jdbc.ClientDataSource \\
  --restype javax.sql.XADataSource \\
  --property portNumber=1527:password=APP:user=APP:serverName=localhost:databaseName=sun-appserv-samples:connectionAttributes=\;create\\=true \\
  sample_derby_pool

干杯,

答案 4 :(得分:4)

这是DIMExCand_means = DIMExCand_means.reset_index() DIMExCand_master = DIMExCand_master.reset_index() pd.merge(DIMExCand_means, DIMExCand_master, left_on=['cycle','coded_state'], right_on=['Cycle','State']) 中的一个错误,因为兄弟已被提及,但它已在GlassFish 4.1.1中得到解决,因此您只需下载here,有关详情,请访问{{} 3}}

答案 5 :(得分:3)

如果您使用的是Oracle,只需编辑文件..glassfish / domains / domain1 / config / domain.xml。查找资源标记并添加:

Showable

别忘了在lib中复制jdbc驱动程序,并根据需要更改URL。接下来启动glassfish,转到JDBC连接池并测试连接。

答案 6 :(得分:3)

我必须在我的任务中执行此操作,并在创建JDBC资源(Java运行时异常)和JDBC连接池时遇到相同的错误(已经为此响应调用了java.lang.IllegalStateException:getOutputStream())

我后来意识到这是一个有缺陷的版本,我们的教授已经告诉我们使用Glassfish 4.1(https://glassfish.java.net/download-archive.html)并且一切正常。 如果您不必使用4.1.1。请改为4.1。

答案 7 :(得分:2)

每晚构建包含修复!。您可以从Oracle下载每晚构建