debug grails application in eclipse IDE - grails

i want to debug Grails application in the eclipse kepler,i tried Debug As in eclipse and added break points but it runs normally as it in normal run mode , how i do that ?
Thanks

Burt's answer from here
You can start a Grails app (one that has an Eclipse Grails nature,
i.e. it was created in STS or was converted via Configure | Convert to
Grails Project) in STS in debug mode using Run | Debug As | Grails
Command (run-app)
You can also attach to any app that you start from the commandline via
"grails-debug run-app" by creating a Debug Configuration. Go to Run |
Debug Configurations and select Remote Java Application. Click the
'New' button or right-click the Remote Java Application node and
select New. Select the project that you're debugging and give the
configuration a meaningful name (I usually call them "attach
"). Change the port from 8000 to 5005, and I always check
the "Allow termination of remote VM" checkbox so I can kill the app
from the IDE, but that's optional. Click Debug and it'll attach. Note
that this will work for any Grails project that's in your workspace,
not just ones that have a Grails nature.
Burt

in order to allow eclipse or any other debugger to connect to an external grails app running you need to start grails in debug mode:
grails-debug run-app
Doing this grails has to pause and wait for a remote debugger to connect.

The grails-debug appears to be deprecated. Nowadays use:
grails --debug-fork run-app

Related

Grails application doesn't start in debug mode

A grails application i work on can not start on debug mode. During start up, the application waits endlessly after the first "Running Grails application" message. Waited for a very long time but no error message is given. What can i do to find the source of the problem? With debug mode turned off, project starts. Tried with grails 2.3.6 and 2.4.1.
The application is probably waiting for the remote debugger to connect. That is by design. Once you connect the remote debugger the process should continue the startup procedure.

How to have grails run-app use https by default (without the -https command line option)

I would like to be able to run
grails run-app
and have it, by default, use ssl as if I ran
grails run-app -https
I would like this behavior for a couple reasons. The most important is that I want the Netbeans IDE grails integration to start up the https connection by default. But also, running on the command line, I won't have to remember or type the https since I always want that in my development environment.
The most important is that I want the Netbeans IDE grails integration to start up the https connection by default.
Surely this can be configured within the IDE?
also, running on the command line, I won't have to remember or type the https since I always want that in my development environment.
If you're using Linux or Mac, I would define an alias
alias run-app='grails run-app -https'
so you can get the behaviour you want simply by typing run-app on the command line. You could similarly achieve this on windows by creating a file run-app.bat whose contents are
grails run-app -https
and put this file in a directory that's on the PATH

Trying to debug adapter Java Code in worklight 6.1

I'm trying to debug worklight 6.1 adapter code (java). I figured the most logical way would be to restart the imbedded liberty server in debug mode. That fails with a message:
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Error occurred during initialization of VM
agent library failed to init: jdwp
I followed the process documented for 6.0 at Logging and debugging Java on Worklight Server but I get the same issue there.
Ok, this is silly, but I just figured it out. You do not need to set anything for debug mode. Apparently in 6.1 this is already set. To begin debugging of your java code in the adapter you need to do the following:
Create a debug configuration for a "Remote Java Application".
Set the project to your worklight hybrid project
I set the port to 10777. which is what jdwp was set to in the jvm.options file for the worklight server.
Once you click on debug for that configuration, it will allow you to debug your adapter.
You can see the jvm.options file if you expand the Worklight Development Server definition in the Servers view. See below for an example of the contents of that file.
-Dfile.encoding=UTF-8
-Duser.language=en
-Duser.country=US
-Djava.awt.headless=true
-Dwas.debug.mode=true
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=10777
-Dcom.ibm.websphere.ras.inject.at.transform=true
Uploaded video to youtube on how to do this

MSDeploy WMSVC is not working in .net environment

I have a build/test server which is currently running Jenkins for my continuous integration and it also is acting as my test server where code will be deployed to once built (i hope to rectify this and seperate these at a later date when budget allows)
I have a .NET web solution (nothing complex just Umbraco essentially) that i have in SVN and Jenkins is now building correctly. I now want to deploy it onto the same server using MSDeploy. After the build completes the package is generated but the deploy fails with the error
ERROR_DESTINATION_NOT_REACHABLE: Web deployment task failed. (Could not connect to the remote computer ("xxxxx.xxxxxxx.xxx.xxxx"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started
Here is my msbuild parameters that Jenkins uses
/P:Configuration=Release
/P:DeployOnBuild=True
/P:MSDeployPublishMethod=WMSVC
/P:DeployTarget=MSDeployPublish
/P:PublishProfile=GetSomePixels
/P:MsDeployServiceUrl=https://build.########
/P:AllowUntrustedCertificate=True
/P:CreatePackageOnPublish=True
/P:UserName=#######
/P:Password=########
I've checked the server and the Web Management Service is running and is starting up manually
I've also gone into IIS 8 manager (server 2012) and checked the "Allow Remote Connections" box under "Management Service". Restarted IIS and the WMSVC and still not working.
If i go to https://myserver.co.uk:8172/MsDeploy.axd in a browser it resolves (gives you the warning about an untrusted cert) and then displays a blank page.
Anyone got any ideas as to what i can do? I thought that it may be firewall related and even though it had added an exception to windows firewall for 8172 i have turned the entire firewall off to completely rulle that out and still no luck.
Have run this on the server to check its listening on the correct port
C:\Users\Administrator>netstat -a | findstr 8172
TCP 0.0.0.0:8172 GSP-BUILD:0 LISTENING
TCP [::]:8172 GSP-BUILD:0 LISTENING
Ok i've resolved this. It appears you have to activate the web management service first and then install web deploy and i'd done it the other way round. I uninstalled WebDeploy and re-installed it, restarted the server and its working
Agree with comment.
We had a similar issue. Initial installation even post Web Management Service activation appeared to be incomplete. In our case, even though the service said it was started we couldn't achieve the "green tick" when testing the connection from the Publish dialog when defining a profile.
Reinstalling WebDeploy 3.6 made it function properly.

How to specify Java Option (System Property) for embedded Tomcat while running Grails App?

Specifically, I want to have my grails app under development to connect to an Oracle db defined by an tnsnames.ora file. I have the tnsnames.ora file located in c:\drivers\Network\ on my PC. When I run the grails app via "grails run-war", the db connection string defined in the tnsnames.ora file doesn't seem to be picked up:
grails prod run-war -Dserver.port=62215 -Doracle.net.tns_admin=C:\drivers\Network\
It seems the name-value pair of oracle.net.tns_admin is not being passed to the JVM used by the the embedded Tomcat that comes with Grails 1.2.0. If not, what is the proper way of specifying it, or pass any JAVA_OPTS to the underlying JVM?
You're best off setting your JAVA_OPTS in the Grails startup script (%GRAILS_HOME%/bin/grails.bat). See this link for an example.

Resources