Como eu depuro o GlassFish 3 usando o Eclipse Helios?

Eu estou usando o adaptador de servidor GlassFish 3 com o Eclipse Helios 3.6. Eu posso iniciar o servidor usando a visualização Servers no Eclipse e as coisas funcionam muito bem – mas não consigo depurar meu código.

Depois de usar o GF Admin Console para ativar a debugging ( Configuração → Configurações da JVM → Depurar e , em seguida, reiniciar o servidor), clicar em Depurar ( Ctrl + Alt + D ) me fornecerá uma janela de erro:

janela de erro

Eu estou supondo que isso é porque o Eclipse não pode se conectar à porta de debugging da JVM (9009 por padrão).

Qual é a maneira correta de configurar a debugging do GlassFish 3 no Helios?


Editar

Re: @The Elite Gentleman, não há erros que aparecem no console. Aqui está um exemplo:

Nov 29, 2010 11:47:42 AM com.sun.enterprise.admin.launcher.GFLauncherLogger info INFO: JVM invocation command line: C:\Program Files\Java\jdk1.6.0_22\bin\java.exe -cp C:/glassfishv3/glassfish/modules/glassfish.jar -XX:+UnlockDiagnosticVMOptions -XX:MaxPermSize=192m -XX:NewRatio=2 -XX:+LogVMOutput -XX:LogFile=C:\glassfishv3\glassfish\domains\myDomain/logs/jvm.log -Xmx512m -client -javaagent:C:/glassfishv3/glassfish/lib/monitor/btrace-agent.jar=unsafe=true,noServer=true -Dosgi.shell.telnet.maxconn=1 -Djdbc.drivers=org.apache.derby.jdbc.ClientDriver -Dfelix.fileinstall.dir=C:\glassfishv3\glassfish/modules/autostart/ -Djavax.net.ssl.keyStore=C:\glassfishv3\glassfish\domains\myDomain/config/keystore.jks -Dosgi.shell.telnet.port=6666 -Djava.security.policy=C:\glassfishv3\glassfish\domains\myDomain/config/server.policy -Dfelix.fileinstall.poll=5000 -Dcom.sun.aas.instanceRoot=C:\glassfishv3\glassfish\domains\myDomain -Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory -Dosgi.shell.telnet.ip=127.0.0.1 -Djava.endorsed.dirs=C:\glassfishv3\glassfish/modules/endorsed;C:\glassfishv3\glassfish/lib/endorsed -Dcom.sun.aas.installRoot=C:\glassfishv3\glassfish -Djava.ext.dirs=C:\Program Files\Java\jdk1.6.0_22/lib/ext;C:\Program Files\Java\jdk1.6.0_22/jre/lib/ext;C:\glassfishv3\glassfish\domains\myDomain/lib/ext -Dfelix.fileinstall.bundles.new.start=true -Djavax.net.ssl.trustStore=C:\glassfishv3\glassfish\domains\myDomain/config/cacerts.jks -Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as -Djava.security.auth.login.config=C:\glassfishv3\glassfish\domains\myDomain/config/login.conf -DANTLR_USE_DIRECT_CLASS_LOADING=true -Dfelix.fileinstall.debug=1 -Dorg.glassfish.web.rfc2109_cookie_names_enforced=false -Djava.library.path=C:/glassfishv3/glassfish/lib;C:/Program Files/Java/jdk1.6.0_22/bin;C:/glassfishv3/glassfish;C:/Windows/Sun/Java/bin;C:/Windows/System32;C:/Windows;C:/Program Files/Java/jdk1.6.0_22/jre/bin/server;C:/Program Files/Java/jdk1.6.0_22/jre/bin;C:/Program Files/Java/jdk1.6.0_22/jre/lib/amd64;C:/Python26/Scripts;C:/Python26;C:/Windows/System32/wbem;C:/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static;C:/Program Files (x86)/Common Files/Roxio Shared/DLLShared;C:/Program Files (x86)/Common Files/Roxio Shared/10.0/DLLShared;C:/Program Files (x86)/Microsoft SQL Server/100/Tools/Binn;C:/Program Files/Microsoft SQL Server/100/Tools/Binn;C:/Program Files/Microsoft SQL Server/100/DTS/Binn;C:/Windows/System32/WindowsPowerShell/v1.0;C:/Program Files (x86)/Microsoft SQL Server/100/Tools/Binn/VSShell/Common7/IDE;C:/Program Files (x86)/Microsoft SQL Server/100/DTS/Binn;C:/Program Files (x86)/PuTTY;C:/Program Files (x86)/jboss-4.2.2.GA/bin;C:/Program Files/MySQL/MySQL Server 5.0/bin;C:/Program Files/IBM/SQLLIB/BIN;C:/Program Files/IBM/SQLLIB/FUNCTION;C:/Program Files/IBM/SQLLIB/samples/repl;C:/Program Files/TortoiseSVN/bin;C:/jboss-5.1.0.GA/bin;C:/Program Files (x86)/QuickTime/QTSystem;C:/Program Files (x86)/Git/cmd;C:/Program Files/SlikSvn/bin;C:/glassfishv3/glassfish/%APPDATA%/Python/Scripts;C:/Program Files (x86)/Apache/apache-ant-1.7.0/bin;C:/Program Files (x86)/CVSNT/C:/jboss-5.1.0.GA/bin;C:/Program Files (x86)/Java/jdk1.6.0_14;C:/Program Files (x86)/Apache/apache-maven-2.1.0/bin;C:/glassfishv3/glassfish/bin com.sun.enterprise.glassfish.bootstrap.ASMain -domainname myDomain -asadmin-args start-domain,,,--domaindir,,,C:\glassfishv3\glassfish\domains,,,--debug,,,--verbose=true,,,myDomain -instancename server -verbose true -debug true -asadmin-classpath C:/glassfishv3/glassfish/modules/admin-cli.jar -asadmin-classname com.sun.enterprise.admin.cli.AsadminMain -upgrade false -domaindir C:/glassfishv3/glassfish/domains/myDomain -read-stdin true Nov 29, 2010 11:47:43 AM com.sun.enterprise.admin.launcher.GFLauncherLogger info INFO: Successfully launched in 4 msec. INFO: Running GlassFish Version: GlassFish Server Open Source Edition 3.0.1 (build 22) INFO: Perform lazy SSL initialization for the listener 'http-listener-2' INFO: Starting Grizzly Framework 1.9.18-o - Mon Nov 29 11:47:46 EST 2010 INFO: Starting Grizzly Framework 1.9.18-o - Mon Nov 29 11:47:46 EST 2010 INFO: Grizzly Framework 1.9.18-o started in: 40ms listening on port 7676 INFO: Grizzly Framework 1.9.18-o started in: 50ms listening on port 3700 INFO: Grizzly Framework 1.9.18-o started in: 90ms listening on port 80 INFO: Grizzly Framework 1.9.18-o started in: 60ms listening on port 4848 INFO: Grizzly Framework 1.9.18-o started in: 67ms listening on port 8181 INFO: The Admin Console is already installed, but not yet loaded. INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate INFO: SEC1002: Security Manager is OFF. INFO: Security startup service called INFO: SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper. INFO: Realm admin-realm of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created. INFO: Realm file of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created. INFO: Realm certificate of classtype com.sun.enterprise.security.auth.realm.certificate.CertificateRealm successfully created. INFO: Realm jdbc of classtype com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm successfully created. INFO: Security service(s) started successfully.... INFO: Created HTTP listener http-listener-1 on port 80 INFO: Created HTTP listener http-listener-2 on port 8181 INFO: Created HTTP listener admin-listener on port 4848 INFO: Created virtual server server INFO: Created virtual server server INFO: Created virtual server __asadmin INFO: Created virtual server __asadmin INFO: Created virtual server __asadmin INFO: Virtual server server loaded system default web module |#] INFO: Virtual server server loaded system default web module INFO: Initializing Mojarra 2.0.2 (FCS b10) for context '/richfaces-showcase' INFO: Selected fallback cache factory INFO: Creating LRUMap cache instance using parameters: {org.richfaces.enableControlSkinningClasses=false, javax.faces.PROJECT_STAGE=Development, com.sun.faces.validateXml=true, com.sun.faces.forceLoadConfiguration=true, javax.faces.STATE_SAVING_METHOD=server, org.richfaces.enableControlSkinning=true, javax.faces.FACELETS_LIBRARIES=/WEB-INF/app-tags.taglib.xml, org.richfaces.skin=#{skinBean.skin}} INFO: Creating LRUMap cache instance of 512 items capacity INFO: RichFaces Core Implementation by JBoss, a division of Red Hat, Inc., version v.4.0.0-SNAPSHOT SVN r.20127 INFO: Monitoring jndi:/server/richfaces-showcase/WEB-INF/faces-config.xml for modifications INFO: Loading application richfaces-showcase at /richfaces-showcase INFO: Loading application richfaces-showcase at /richfaces-showcase INFO: Loading richfaces-showcase Application done is 7895 ms INFO: Hibernate Validator bean-validator-3.0-JBoss-4.0.2 INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver. INFO: Portable JNDI names for EJB UserBean : [java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/UserBean, java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/UserBean!com.lapis.retailerportal.demo.ejb.UserBean] INFO: Portable JNDI names for EJB DbTestBean : [java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/DbTestBean!com.lapis.retailerportal.demo.ejb.DbTestBean, java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/DbTestBean] INFO: Portable JNDI names for EJB NewsBean : [java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/NewsBean!com.lapis.retailerportal.demo.ejb.NewsBean, java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/NewsBean] INFO: Portable JNDI names for EJB GameConfigBean : [java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/GameConfigBean!com.lapis.retailerportal.demo.ejb.GameConfigBean, java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/GameConfigBean] INFO: Initializing Mojarra 2.0.2 (FCS b10) for context '/RetailerPortalDemo' INFO: com.lapis.retailerportal.demo.entity.Retailer actually got transformed INFO: Selected fallback cache factory INFO: Creating LRUMap cache instance using parameters: {javax.faces.PROJECT_STAGE=Development, com.sun.faces.validateXml=true, com.sun.faces.forceLoadConfiguration=true, org.richfaces.skin=tweaked} INFO: Creating LRUMap cache instance of 512 items capacity INFO: RichFaces Core Implementation by JBoss, a division of Red Hat, Inc., version v.4.0.0.20101110-M4 SVN r.20021 INFO: com.lapis.retailerportal.demo.entity.GameConfig actually got transformed INFO: com.lapis.retailerportal.demo.entity.NewsItem actually got transformed INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver. INFO: EclipseLink, version: Eclipse Persistence Services - 2.0.1.v20100213-r6600 INFO: file:/C:/glassfishv3/glassfish/domains/myDomain/eclipseApps/RetailerPortalDemo/RetailerPortalDemo_Bean_jar/_RPD_Persistence_CTX login successful INFO: Loading application RetailerPortalDemo#RetailerPortalDemo_Web.war at RetailerPortalDemo INFO: Loading application RetailerPortalDemo#RetailerPortalDemo_Web.war at RetailerPortalDemo INFO: Loading RetailerPortalDemo Application done is 5656 ms INFO: GlassFish Server Open Source Edition 3.0.1 (22) startup time : Felix(2386ms) startup services(14265ms) total(16651ms) INFO: Binding RMI port to *:8686 INFO: JMXStartupService: Started JMXConnector, JMXService URL = service:jmx:rmi://192.168.5.10:8686/jndi/rmi://192.168.5.10:8686/jmxrmi INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\glassfishv3\glassfish\modules\autostart, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\mjball\AppData\Local\Temp\fileinstall-2104459395405070416, felix.fileinstall.filter = null} INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\glassfishv3\glassfish\domains\myDomain\autodeploy\bundles, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\mjball\AppData\Local\Temp\fileinstall-286375592969619901, felix.fileinstall.filter = null} INFO: Started bundle: file:/C:/glassfishv3/glassfish/modules/autostart/osgi-web-container.jar INFO: Updating configuration from org.apache.felix.fileinstall-autodeploy-bundles.cfg INFO: Installed C:\glassfishv3\glassfish\modules\autostart\org.apache.felix.fileinstall-autodeploy-bundles.cfg INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\glassfishv3\glassfish\domains\myDomain\autodeploy\bundles, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\mjball\AppData\Local\Temp\fileinstall--3209587030652226629, felix.fileinstall.filter = null} 

Editar 2

Consegui depurar com sucesso no Eclipse iniciando o GlassFish externamente, por exemplo

 > asadmin start-domain myDomain 

e, em seguida, criando uma configuração de debugging personalizada:

:(“>

Então, por que o adaptador para servidor GlassFish não pode fazer isso?

Editar 3 – Problema solucionado

Originalmente, eu tinha adicionado suporte GlassFish através do plugin GlassFish Tools . Eu desinstalei o plug-in e adicionei o suporte do GlassFish usando Servidores → Novo → Servidor → Fazer o download de adaptadores de servidor adicionais . Agora eu posso depurar. Woohoo!

Você deve iniciar o Glassfish com a opção de debugging em vez da opção de execução dentro da visualização Servidores.

O mesmo problema que você e isso estava me deixando louco. Minha configuração é eclipse indigo sobre windows 7 e glassfish 3.1.1. O jdk que estou usando é 1.7×64. Eu baixei as ferramentas do servidor glassfish através da nova janela do servidor.

Eu resolvi isso (atualmente funciona, quem sabe o que está acontecendo no futuro próximo) baixando e instalando o jdk1.6.30. Eu não tenho desinstalado o jdk1.7, mas configurei meu projeto eclipse para usar o jdk1.6.

Oi tudo que eu encontrei solução para o problema de debugging. No meu caso, Eclipse Indigo e Linux x64, funciona. Mais detalhes em outro tópico sobre o mesmo erro https://stackoverflow.com/a/14551690/1976844