Lift debugging in Intellij IDEA 13

702 views
Skip to first unread message

yakov...@gmail.com

unread,
Jan 18, 2014, 7:09:16 AM1/18/14
to lif...@googlegroups.com
Hello,

I'm just staring with Lift, and trying to debug a very simple application, which doesn't work for some unknown reason. The code of the app is taken from "Simply Lift" book's first chapter, the "Chat app". I typed it by hand, so I've probably made a mistake somewhere, that's why it doesn't work as expected (chat message doesn't appear in the list on submit, but text disappear from the text box).

I thought debugging it would help me find the problem quickly, however setting the debugging up itself is quite time-consuming, and I'm not there yet. I encounter one issue which I can't resolve myself, could you kindly guide me in the right direction?

What I've achieved so far: I have my Lift app running in the browser, and following instructions from https://groups.google.com/forum/#!topic/liftweb/ixWOc9H9aJ0 I created a "remote" debugging configuration in IDEA. I can run the Jetty container from SBT, and I even can connect my remote debug configuration to the SBT session, because I see Connected to the target VM, address: 'localhost:5005', transport: 'socket' message in the IDEA's debugging output.

The problem is, my breakpoints are not hit. I put breakpoints to every method in the Chat.scala, ChatIn.scala and ChatServer.scala, but none of them appears as active (there's no check-mark inside the red circle). What could that mean? Another interesting symptom is that I can already successfully start remote debugging when I launch just SBT, but don't call the "container:start" command there. Maybe I'm debugging just the SBT session?

I create default "remote" configuration for debugging in IDEA. I'm on Windows 8.1, and here's code for my sbt.bat:

echo
"starting debugging..."
set SCRIPT_DIR=%~dp0
java
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -Drun.mode=development -Xms512M -Xmx712M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M -jar "%SCRIPT_DIR%sbt-launch.jar" %*



Thanks in advance,
Roman.

Vasya Novikov

unread,
Jan 19, 2014, 8:44:31 AM1/19/14
to lif...@googlegroups.com
Can you place/catch breakpoints in Boot.scala ?
> --
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Lift" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to liftweb+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

yakov...@gmail.com

unread,
Jan 19, 2014, 2:01:13 PM1/19/14
to lif...@googlegroups.com, n1m5-goo...@yandex.ru
No, it's the same story with Boot.scala. No breakpoints are hit, even though I attach my remote debugging session before calling container:start. This is the output of sbt console when I do container:start:

> container:start
[info] Compiling 4 Scala sources to C:\Users\Roman\Downloads\LiftHelloWorld\target\scala-2.10\classes...
[warn] C:\Users\Roman\Downloads\LiftHelloWorld\src\main\scala\Chat.scala:26: non-variable type argument String in type pattern Vector[String] is unchecked since it is eliminated by erasure
[warn]     case v: Vector[String] => msgs = v; reRender()
[warn]             ^
[warn] one warning found
[info] jetty-8.1.7.v20120910
[info] NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
[info] started o.e.j.w.WebAppContext{/,[file:/C:/Users/Roman/Downloads/LiftHelloWorld/src/main/webapp/]}
[info] started o.e.j.w.WebAppContext{/,[file:/C:/Users/Roman/Downloads/LiftHelloWorld/src/main/webapp/]}
[info] Started SelectChann...@0.0.0.0:8080
[success] Total time: 7 s, completed 19.01.2014 19:57:12

I'm not sure if the warning about "NO JSP Support for /" is important. Could that be the source of problems?

Another thing to mention, I downloaded sample Lift projects from the official site, and there debugging works! It seems that something is totally broken in my own project. Would posting complete source code help solving the problem?

Thanks,
Roman.

воскресенье, 19 января 2014 г., 14:44:31 UTC+1 пользователь Vasya Novikov написал:

Alexandre Richonnier

unread,
Jan 22, 2014, 11:58:45 AM1/22/14
to lif...@googlegroups.com
Hello,

You can try something like:
java -Xms512M -Xmx768M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -server -XX:+TieredCompilation -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=127.0.0.1:5005 -noverify -jar `dirname $0`/sbt-launch.0.12.1.jar "$@"

David Whittaker

unread,
Jan 22, 2014, 1:06:09 PM1/22/14
to liftweb

I use a different method when debugging with Intellij that works well for me. Instead of setting it up for remote debugging and connecting to SBT, set it up as a local Jetty server. In the deployment tab make sure that it references /path_to_your_project/webapp. Do a single SBT package and then launch the server in debug mode within Intellij and your breakpoints should work. If you use JRebel, you can add a rebel.xml to src/main/resources that looks similar to:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
    <classpath>
        <dir name="/path_to_your_project/target/scala-2.10/classes">
        </dir>
    </classpath>
    <web>
        <link target="/">
            <dir name="path_to_your_project/doccenter/src/main/webapp">
            </dir>
        </link>
    </web>
</application>

Then if you launch the server in JRebel Debug (icon looks like a bug with a little JR in the corner) changes to static assets are picked up as you make them and changes to classes are picked up as you compile them (shift-command-f9 for an incremental compile of the selected tab).

yakov...@gmail.com

unread,
Jan 25, 2014, 3:30:06 PM1/25/14
to lif...@googlegroups.com
Thanks for the tip, I tried to configure Jetty local server, but since it's my first attempt to do that, I expectedly failed at that. I guess, this may be not a right forum for Jetty config questions, but I'll still ask, if no one minds.

Basically, I downloaded Jetty 9.1.1, set up a local Jetty run config in IDEA, setting the deployment to the webapp directory, as proposed. When I try to run, I get this exception:

java.io.IOException: Cannot bind to URL [rmi://localhost:1099/jmxrmi]: javax.naming.NoPermissionException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: |?java.rmi.AccessException: Cannot modify this registry]

Any ideas what's going on here? Googling this exceptions doesn't really help.

Thanks in advance.

среда, 22 января 2014 г., 19:06:09 UTC+1 пользователь David Whittaker написал:

David Whittaker

unread,
Jan 28, 2014, 11:36:04 AM1/28/14
to liftweb
Sorry, but that's a new one to me.  I'm still using Jetty 8 for most things, but I just tried Jetty 9.1.1 now and it started up fine.  Is it possible that you have a file permission issue?
Reply all
Reply to author
Forward
0 new messages