I'm trying to debug a play application in order to see how things
work...
I've already downloaded the sources
compiled them with ant
created an application with play new myApp
netbeansfied it
and opened both apps (the framework and myApp) with netbeans
then I set a breakpoint on Server.Java main method
then I click Run -> Run project (nb-debug) and I get the following
error:
nb-debug:
/home/sas/play/src/play/framework/build.xml:158: Source resource does
not exist: /home/sas/play/src/play/framework/${application.path}/conf/
application.conf
BUILD FAILED (total time: 0 seconds)
checking build.xml I find
<target name="nb-profile-application">
<property name="application.path" value="/Users/guillaume/
Desktop/webmail" />
I tried changing it to
/home/sas/play/src/play/myApp
same error, so I added it to
<target name="nb-debug">
<property name="application.path" value="/home/sas/play/src/
play/myApp" />
and this time it seems to work...
but when I try to run the project
in the debugger console I get
Attaching to localhost:8000
Connection refused.
and in the output
nb-debug:
org.netbeans.api.debugger.jpda.DebuggerStartException: Conexión
rechazada
at
org.netbeans.modules.debugger.jpda.JPDADebuggerImpl.waitRunning
(Unknown Source)
at org.netbeans.api.debugger.jpda.JPDADebugger.attach(Unknown
Source)
at org.netbeans.modules.debugger.jpda.ant.JPDAConnect$1.run
(JPDAConnect.java:212)
at org.openide.util.RequestProcessor$Task.run(Unknown Source)
at org.openide.util.RequestProcessor$Processor.run(Unknown
Source)
Caused by: java.net.ConnectException: Conexión rechazada
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect
(AbstractPlainSocketImpl.java:310)
at java.net.AbstractPlainSocketImpl.connectToAddress
(AbstractPlainSocketImpl.java:176)
at java.net.AbstractPlainSocketImpl.connect
(AbstractPlainSocketImpl.java:163)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
at java.net.Socket.connect(Socket.java:542)
at com.sun.tools.jdi.SocketTransportService.attach
(SocketTransportService.java:222)
at com.sun.tools.jdi.GenericAttachingConnector.attach
(GenericAttachingConnector.java:116)
at com.sun.tools.jdi.SocketAttachingConnector.attach
(SocketAttachingConnector.java:90)
at
org.netbeans.api.debugger.jpda.AttachingDICookie.getVirtualMachine
(Unknown Source)
at
org.netbeans.modules.debugger.jpda.actions.StartActionProvider.doStartDebugger
(Unknown Source)
at
org.netbeans.modules.debugger.jpda.actions.StartActionProvider.access
$100(Unknown Source)
at
org.netbeans.modules.debugger.jpda.actions.StartActionProvider$1.run
(Unknown Source)
... 2 more
BUILD FAILED (total time: 0 seconds)
then I click debug, attach to debugger, choose port 8000
run again
and this time
nb-debug:
Attached JPDA debugger to localhost:8000
BUILD SUCCESSFUL (total time: 0 seconds)
but in the debugger console I get
Attaching to localhost:8000
Connection refused.
and the server is not running (
http://localhost:9000/ not working)
--
if instead of run, I try to debug the project, I'm told I have to
create a build target.
I configure the main class
<!-- TODO configure the main class for your project here: -->
<java classname="play.server.Server" fork="true">
but I get the following error:
debug-nb:
Exception in thread "main" java.lang.NoClassDefFoundError: play/server/
Server
Caused by: java.lang.ClassNotFoundException: play.server.Server
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:
294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:
332)
Could not find the main class: play.server.Server. Program will exit.
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
this is the generated ide-file-targets.xml
<?xml version="1.0" encoding="UTF-8"?>
<project basedir=".." name="Play! framework 1.0-IDE">
<property name="ant.script" value="framework/build.xml"/>
<!-- TODO: edit the following target according to your needs -->
<!-- (more info:
http://www.netbeans.org/kb/articles/freeform-config.html#debugj2se)
-->
<target name="debug-nb">
<path id="cp">
<!-- TODO configure the runtime classpath for your project
here: -->
</path>
<nbjpdastart addressproperty="jpda.address" name="Play!
framework 1.0" transport="dt_socket">
<classpath refid="cp"/>
</nbjpdastart>
<!-- TODO configure the main class for your project here: -->
<java classname="play.server.Server" fork="true">
<classpath refid="cp"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=$
{jpda.address}"/>
</java>
</target>
</project>
--
and finally, if I just debug file, on Server.java I get:
debug-selected-file-in-src:
Exception in thread "main" java.lang.NullPointerException
at java.io.File.<init>(File.java:239)
at play.server.Server.main(Server.java:82)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)
the error takes me to
File root = new File(System.getProperty("application.path"));
I guess it can't read the application root path...
So I tried adding <property name="application.path" value="/home/sas/
play/src/play/myApp" /> to ide-file-tagets.xml...
but with no luck...
any idea?
some info:
Product Version: NetBeans IDE 6.7.1 (Build 090826)
Java: 1.6.0_0; OpenJDK Client VM 14.0-b16
System: Linux version 2.6.31-16-generic running on i386; UTF-8; es_AR
(nb)
Userdir: /home/sas/.netbeans/6.7