I would like to use moskito monitoring within my grails 2.3.9 application.
I already added the dependencies for moskito and the webui into BuildConfig.groovy
compile 'net.anotheria:moskito-core:2.4.2'
compile 'net.anotheria:moskito-aop:2.4.2'
runtime 'net.anotheria:moskito-webui:2.4.2'
runtime 'net.anotheria:moskito-web:2.4.2'
runtime 'net.anotheria:moskito-webui-jersey:2.4.2'
I also marked the classes i want to monitor with the #Monitor annotation.
Now i need to get access to the moskito-webui. I need to add a servlet filter to the web.xml of the grails application (regarding to the documentation). I just installed the grails templates with grails install-templates and modified the web.xml file but i can't get access to the webui of moskito.
Does somebody know how to create an urlmapping or servlet filter for moskito webui within grails? How to integrate it correctly?
if you upgrade to 2.5.0 you don't need an embedded webui, instead you can use a standalone tool called MoSKito Inspect (actually same as WebUI, nicer name).
First add
moskito-inspect-remote
to your dependencies. This jar includes a web-fragment that starts a local listener on RMI port 9041 (port can be altered later).
Second: Download or build your own MoSKito Inspect (take tomcat7 and drop in http://search.maven.org/remotecontent?filepath=net/anotheria/moskito-inspect-standalone/2.5.0/moskito-inspect-standalone-2.5.0.war or build from github source).
Download link is:
http://www.moskito.org/download.html
Third: start your application and MoSKito Inspect. Enter in quickconnect localhost and port 9401. You should see your annotated classes now.
If you have further problems you can also use moskito mailing list: moskito-users#lists.anotheria.net
regards
Leon
Related
refresh dependencies fails due to firewall+proxy combonation.
The corporate IT is not going to make an exception. I have found that I can do a recursive wget on the repo url and generate duplicate their folder structure.
What can I do locally so that all developers can use this "mirror" by default?
If the above is not possible, where does grail usually put these files on a windows based installation?
Try adding local repo to your BuildConfig and of course make it accessible over your LAN, or perhaps tell other devs to make their local cloned repos. The path to this local repo could be ENVARIONMENT_VARIABLE, too (that makes it fully customizable)
repositories {
grailsPlugins()
grailsHome()
mavenCentral()
mavenRepo('/path/to/my-local-maven-repo')
}
http://jdpgrailsdev.github.io/blog/2014/02/10/grails_maven_local_repo.html
You have a couple of options here.
First, if it's just a normal proxy than you can configure grails to utilise it. Take note of the following grails commands:
grails add-proxy
grails set-proxy
These in turn will establish a file in your home directory in .grails called ProxySettings.groovy (i.e. ~/.grails/ProxySettings) that is then used by all grails commands for all projects.
However, if you're behind a Microsoft NTLM proxy (as I am) then I'd suggest still doing the above by making use of Java NTLM Proxy.
(Keep in mind though, that the grails wrapper does not use the above ProxySettings.groovy and then you need to use the standard JAVA_OPTS of -Dhttp.proxyPort, -Dhttp.proxyHost, etc.)
But I appreciate maybe you've done all that and you still want to avoid the proxy. I'd suggest the next solution - and one that should be considered anyway - is setting up a corporate/internal Maven repository server with something like Artifactory or Nexus.
Lastly, there is the instruction from MamyKryzysKryzysKryzys with using mavenRepo( <localPath> ). More info on that is available in the grails doco.
Finally, to address your question of "where does grail usually put these files". Under the hood grails is simply using maven so it's stored in your normal maven local repo which is ~/.m2/repository.
Good luck! Proxies make things hard, but once you figure your solution it's a thing of the past. Personally, we now use a combination of the Java NTLM Proxy and an internal Artifactory server.
I have a JSF 2.0 web project and I use Glassfish 3.1.2 server. In this project, I have among other things :
a class called AjaxServlet annotated with #javax.servlet.annotation.WebServlet
a class called Session annotated with #javax.ejb.Stateful
When I deploy this project to Glassfish from eclipse, everything runs perfectly : in the administration console of Glassfish, the engines associated with the application are [ejb, jpa, web, weld]. But when I first export the project as a war, then from the admin console I deploy the war, the application doesn't work : the engines associated to the application are then [web] only.
How can I export an application to a war without loosing any information (all the engines)? I didn't declare my Servlet in web.xml because in JSF 2.0, we don't need that: the annotations are enough. Does anyone have an idea about what is going on here? I'm quite sure it is not a problem of Glassfish distributions (Web Profile Vs Full Platform) as the same Glassfish server is used for the 2 scenarios above.
Note for those who erroneously think my question is off-topic : Jsf is a framework for programming Java EE web applications. war is a way to package a Jsf application, in the same as jar is a way to package java classes. So my question is totally a programming topic! It is totally legitimate to have it here in StackOverflow. If exporting JSF application into war is not a programming issue, then compiling java classes into .class should not be a programming topic neither! So Pleaze don't downgrade for this reason!
You have to understand the difference between your eclipse environment and your glassfish environment. Not all your libraries that are available in eclipse might be included in your external environment. There are cases where programs compile in eclipse, but not when run from console.
Here's a tip:
Right click on project -> Navigate to Properties > Java Build Path > Order and Export, and ensure that all libraries you require are going to be exported.
I am following this tutorial on Grails and Cloudbees And it says :
"to use CloudBees databases locally from your application, you first need to add the CloudBees SDK's appserver.jar file to your grails classpath"
Does anyone know what is this appserver.jar? Where can I find it?
Yes, as mentioned in the comment - you can get that jar file from the SDK you download.
However, it is perfectly find (and possibly better) to use the mysql driver directly as mentioned.
When running on cloudbees, you can bind your app to a database - so that at runtime the right database is injected - using the bees db:bind SDK command.
I have 2 grails applications packed with --nojars parameter in grails war command. All grails framework libraries are moved to server and they are loader in shared.loader line in tomcat servlet container.
My question is, how can I set different loggers for this different application.
Now log4j = {..} produce the static variable which is shared between two applications.
I'd like to have different logs for each one.
When deploying the war files produced by grails build command without --nojars everithing went well, and each application had its own log file.
Any suggestions ?
I think there should be two different web applications as well. If you do not want the duplicate libraries packaged again, just give them a 'provided' scope and make sure they are available in your instance of Tomcat.
I have a legacy application that I'm trying to port to Java EE. Presently this application calls URL.setURLStreamHandlerFactory() to register some custom URL protocol handlers. This call fails under Glassfish v 2.1 and 3 because glassfish has already registered a factory.
I've tried using the java.protocol.handler.pkgs system property, but that doesn't work for me due to classloader issues. The handler classes are all part of the application and I'm not keen on trying to extract them and put a jar in the container's classpath.
I've got a whiff of osgi bundles - apparently I could write a Bundle that'll deal with the new protocols. I'm not keen on making this web application an osgi bundle (one step at a time! EE first, then osgi if the need arises).
Is it possible to pop a bundle jar in to my WEB-INF/lib directory and have Glassfish load it as a bundle? The bundle will need to import packages from the web applications (another jar in WEB-INF/lib or in WEB-INF/classes). I'm willing to package this app as an EAR if that'll work, I just can't justify osgifying the entire application without knowing more.
I've solved my issue. Apparently I had some wires crossed as the java.protocol.handler.pkgs system property works fine.
For any one else tripping up, I put a jar with my handlers in $DOMAINDIR/lib/ext/ as well as in my WAR's WEB-INF/lib directory. In my application's configuration I've also put a jvm option -Djava.protocol.handler.pkgs=my.handlers.pkg.prefix
I've noticed in glassfish 2.1 it works without the jvm option if I put the prefix in to some startup code, but in glassfish 3 the jvm option is necessary because felix (the osgi implementation glassfish is using) only consults the property upon the server startup, not for each request.