How do I run rake rake tasks in a rails app which is served by tomcat with jruby war deployment? - rake

I have a rails application deployed to tomcat, the code has been compiled to java classes and packed to a war file. And I'm wondering, is there a way for me to run rake tasks as I always did ?

I'd like a convenient way of doing this too, although I'm not sure it's possible.
From the exploded (unzipped) WAR, you can get somewhere with this kind of thing:
java -cp WEB-INF/lib/jruby-core-1.6.4.jar -S rake

java -jar WEB-INF/lib/jruby-core-1.6.4.jar -S rake
This worked for me. Possibly the same as the previous answer, but I do not know enough about java, .war files, or jruby, to say in any certainty.

Related

Vert.x deployment on aws (best practice)

I'm beginner in web development. I used Vert.x framework. And I got app.jar file for the server on aws. Every time I run it with this command:
java -jar app.jar
But I'm not sure, that is right way (I think it's nonprofessional). Who Can tell, what is best practice? I heard that, most of apps are deployed on web application containers, such as Tomcat, JBoss, Jetty etc. Please, show me right way.
Disclaimer: I am a member of the Vert.x core team.
It is not more professional to deploy a webapp in a container environment than running it directly with an executable JAR.
Actually, the opposite movement can be observed: SpringBoot and Wildfly-Swarm are tools to let you run Spring and JavaEE applications as an executable JAR.
So the real question is: does the tool do the job for you?

How to deploy a web application on Jetty

I create a war file , then i executed in eclipse, like described here.
I don't know configure the context path, how can I run the war file?
There are two ways you can run your webapp using Jetty Server
Configure jetty server using Jetty_WTP_Plugin and run webapp within eclipse
Download stand alone jetty server from Jetty Distributions from Eclipse
If you use second option, you need to create war file keep war file interface /webapps folder.
I haven't used jetty but I know that its quite similar to tomcat. Just place your war file (say foo.war) in webapps directory; Start jetty by the following command in
java -jar start.jar
and hit http://localhost:8080/foo in your browser
By the way the tutorial you're using is quite an old one and may not work for jetty 8 or 9

Compiling GWT via command line

We have an application that we currently deploy using Capistrano. The application make use of php as it's backend and GWT as a frontend.
I have managed to compile the GWT via an Ant file, but would like to replace the Ant file with a custom Capistrano task.
In order for me to to be able to replace it with a Capistrano task, I need to be able to compile the GWT from the command line.
I have been looking around and Google for quite a while, but have no luck. Does any one know if it is possible to compile GWT using only a single command?
Since it is possible to do it via Apache Ant, I believe it should be possible via command line.
Operating system we want to compile on is Linux, Ubuntu to be exact.
Sure, this is documented at https://developers.google.com/web-toolkit/doc/latest/DevGuideCompilingAndDebugging#DevGuideCompilerOptions
java -cp gwt-dev.jar com.google.gwt.dev.Compiler ...

Is there a way to deploy exploded bundles in Apache Felix?

We are looking at rearchitecting our web application and want to move to a more modular solution, OSGi seems to meet a lot of our needs.
I've come across the Apache Felix project and taken it for a spin. It looks solid yet I find the development cycle a bit slow as it requires a maven build of the bundle(s) to make any code changes effective.
Instead I would like to be able to reload a bundle once classes have been compiled by Eclipse, without any extra building/packaging. Similar to how Tomcat and other servlet containers support deployment of "exploded" war files.
Is this possible to do with Felix or any other OSGi container?
In the Gogo shell, you can do:
install reference:file:/path/to/exploded/directory
This will install an exploded bundle. The format of the exploded directory should be exact that of a bundle JAR file.
Apache Felix FileInstall supports exploded bundles out of the box. Just install it, and put a directory with your bundle in the load directory (or configure FileInstall to look somewhere else).
Not exactly answering your question, but if you have issues with the build cycle, you should take a look at bndtools, which is a plugin for Eclipse that a.o. automatically builds and deploys your bundles in a running framework when your code changes.

eclipse + maven + tomcat debugging

I'm developping a web application in Eclipse and I'm using maven, spring and tomcat.
Now the problem I have is that debug as => debug on server doesn't work.
I just get exceptions. (and yes I've created the server)
If I use the mvn command to compile it, put the war in my tomcat webapps dir and start my tomcat the application works fine. But for the functionallity I'm now working on debugging would be usefull.
I found the answer for this in http://jacksonps4.me/wordpress/?p=868
Worked like a charm for me, yet I don't understand anything!
We used to test our application with Tomcat as well, but switched to starting an embeddable Jetty. Here's a sample app. It's JSF, but it doesn't really matter. The pseudo-unit test simply starts a jetty "before" and shuts stops it "after". No need for external server infrastructure, no need for IDE dependencies.
you can run tomcat with maven with this command:
mvn tomcat:run
and if you want to debug, set this maven options:
export MAVEN_OPTS=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
if you are in windows, use the set command:
set MAVEN_OPTS=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
then you can debug with eclipse Remote Java Application.
Hope this help.