Why does Eclipse skip lines when I debug JBoss?

别说谁变了你拦得住时间么 提交于 2019-12-23 12:17:19

问题


I am trying to debug web service call which uses JMS in the background.I have JBoss running in debug mode. What happens is that when I press F6 in Eclipse (to execute current line) it skips certain lines. I have this method:

@Override
    public void log(MsgPayload payload) {

    1   Date startTime = new Date();
        logger.info("Publishing with BufferedPublisher.java start time:"+startTime);
    3   publisher.send(payload);
        Date endTime = new Date();
        logger.info("Publishing with BufferedPublisher.java end time:"+endTime);
        long mills = endTime.getTime()-endTime.getTime();
        double secs = mills/1000.0;
        logger.info("Publishing with BufferedPublisher.java total time (seconds):"+secs);
    }

So what happens? I have breakpoint at line 1. When I press F6 it skips that line and goes to line 3. When I press F6 again it goes to the end of the method. Half of the code is never executed..??? My question is why. I am assuming my source is not well attached to the real code that is being executed.But how do I change this?

Thanks.


回答1:


Often this happens when the source that you're looking at with the debugger isn't the same version of the code that the app is actually running. Potentially a previous version had code at lines 1 and 3, and whitespace (or comment) on line 2, and no other code. Make sure that you've got the most recent code deployed (and your debugger configured to point to the most recent source) and see if it still happens.




回答2:


I've just solved similar problem. I had some external jars in my java build path that were bad configured. I fixed it, cleaned and rebuilded project. After that everything worked just fine.




回答3:


I am running MyEclipse 9.1 and my problem was resolved by changing the .classpath file that is just under the project name directory. I do not know how it changed, but it was sending hot deploys into target.

Once the code was changed to deploy to the WEB-INF/classes, the debugger lines became synchronized and all worked well.



来源:https://stackoverflow.com/questions/2968904/why-does-eclipse-skip-lines-when-i-debug-jboss

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!