Как отладить GlassFish 3 с помощью Eclipse Helios?

Я использую серверный адаптер GlassFish 3 с Eclipse Helios 3.6. Я могу запустить сервер, используя представление Servers в Eclipse, и все работает нормально - но я не могу отлаживать свой код.

После использования консоли GF Admin для включения отладки (Конфигурация → Параметры JVM → Отладка, затем перезапустите сервер), нажав "Отладка" (Ctrl + Alt + D), появится окно с ошибкой:

error window

Я предполагаю, что это связано с тем, что Eclipse не может подключиться к порту отладки JVM (по умолчанию 9009).

Каков правильный способ настройки отладки GlassFish 3 в Helios?


Изменить

Re: @The Elite Gentleman, нет никаких ошибок, которые появляются на консоли. Вот пример:

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}

Изменить 2

Мне удалось успешно отладить в Eclipse, запустив GlassFish извне, например

> asadmin start-domain myDomain

а затем создайте настраиваемую конфигурацию отладки:

bloody hell >:(

Так почему же серверный адаптер GlassFish не может это сделать?

Редактировать 3 - Проблема решена

Первоначально я добавил поддержку GlassFish через плагин GlassFish Tools. Я удалил плагин и добавил поддержку GlassFish с помощью серверов → Новый → Сервер → Загрузите дополнительные серверные адаптеры. Теперь я могу отлаживать. Woohoo!

Ответ 1

Вы должны запустить Glassfish с помощью отладки вместо опции run внутри представления Servers.

Ответ 2

Те же проблемы, что вы и это сводили меня с ума. Моя конфигурация - это eclipse индиго над окнами 7 и стеклянными рыбками 3.1.1. Используемый jdk - 1.7x64. Я загрузил инструменты сервера Glassfish через новое окно сервера.

Я решил (в настоящее время работает, кто знает, что происходит в ближайшем будущем), загружая и устанавливая jdk1.6.30. Я не удалил jdk1.7, но я настроил проект eclipse на использование jdk1.6.

Ответ 3

Привет всем Я нашел решение для проблемы отладки. В моем случае Eclipse Indigo и Linux x64 он работает. Подробнее в другой теме о той же ошибке fooobar.com/info/468612/...