Is there any way of configuring Oracle ATG to load java class changes dynamically? - jboss

I am interested in setting up a development environment for ATG in which changes on class will take effect immediately after the build is done, without restarting server and building again the ear file.
I have searched in the product documentation but the only thing I saw you can configure to load dynamically would be the configuration files section.
Is there any other way of configuring the environment for better productivity?

Use JRebel. That will do dynamic re-loading for java classes, property files and other deployable assets. Great for productivity.

If your purpose is to debug and most of time is getting wasted packing and unpacking the ear, you can always use remote debugging with JBoss and Eclipse, but for major changes like adding a method wont be working in that case. One solution to this is use Java DCEVM which will dynamically update code in the JVM. Its a simple jdk just point your Java_home to this jdk and in debug mode you can add code to you class see changes. Use the below link for more information about DCEVM
https://github.com/dcevm/dcevm

Related

GWT SuperDevMode overwrites production code when using launcherdir

I'm trying to use the new SuperDevMode with -launcherdir parameter and currently I point launcherdir to the same folder as where production code is deployed.
The effect is that the .nocache.js file gets overridden by SuperDevMode's nocache.js file and it's impossible to run the app in production-mode(hosted mode) without doing another full recompile.
Is there any way to switch back and forth between SuperDevMode and production mode?
Thank you!
This is indeed how SDM works; the solution is to use distinct output folders for production and dev modes, but this all depends on your build tools, etc.
For instance you could assemble your web app in a distinct folder so you can run it with DevMode.
Or you can use a separate server (or even possibly a reverse proxy) that you configure to load the CodeServer-generated nocache.js in priority over the production one from your assembled webapp. This is what I do in Maven with the Tomcat or Jetty plugins for instance.

Build vs Deploy vs Publish (Eclipse IDE)

I'm a newbie to J2ee though not a complete newbie. I'm unable to find a good resource (book or video) that could help me understand what exactly happens when we build, deploy and publish. I have a fair idea though. So my questions are -
Is there a good resource out there that can help me understand these concepts? I've read some books on struts and servlets/jsp but they don't delve into eclipse and how/what it does. The eclipse documentation has been helpful but only slightly.
When we build an application the the java files are converted into the class files and stored in the java build path. What else happens during build? Many people use the term 'library dependencies', what does this mean? Also, when people refer to dependencies do they refer to files like xml and tld?
At what stage (build or run on server) does the container check to see if the dependencies are alright? Say for instance, if the servlet class/name in the web.xml file.
Is it appropriate to say that build is basically compilation while deploying the project and running it is the same as executing it?
Familiarity with the servlet specification would help you (perhaps some older version would be quicker to read like 2.4), but general understanding of what you build and how you do it in Eclipse is what you are after.
The way I see it is that during the build Eclipse creates almost complete version of WAR (or some other archive, if you use EJBs for instance) and by publishing you deploy it to some server (this is practically the same thing although Eclipse might just configure the server to use exploded WAR that it just prepared instead of copying it to some "deploy" dir that you are supposed to do if you work without an IDE).
If you configure your project well, the build can only mean compilation, but if you have more ceremony in it, then some source generation and moving files around might happen too.
To address your second question, library dependencies can be files that reside in WEB-INF/lib for instance. Read the spec to know what should be there and what should not. Eclipse tries to copy there all defined dependencies of your project.

GWT Appliaction with 3rd Party Library works in Development mode but not Deployed mode

I am working on a GWT application and I am using 3rd party Java-R wrapper library. This will be converted into Java Bytecode and (I guess) call some methods via the R libraries.. I was able to successfully get it to work on eclipse development mode.
In order to get it to work, I had to add the .jar to the classpath, and add to the java path (Under Run-Configurations->Environment Variables) variable to add location of the folder containing several .dll which are required for the execution of the program.
Everything seems to work fine in development mode but stuff seems to break when I deploy it via Tomcat 7. Is there anything else I need to do when I modify the environment variables in GWT?
Initially the Tomcat server would crash because of
May 06, 2013 4:08:22 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/r] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation.
I changed the code a little differently and now the it just entered what appears to be an infinite while loop. These details seem unimportant to my question, however.
I assume there's two ways of using third party libraries for GWT
It's just a Jar that you just include (as well as in your web-inf/lab) and everything works
You use a Jar and a bunch of other .dlls whose path you set in the Enviroment Variables for the project. this what I did and, again, it works in development mode but not in deployed mode.
Any and all feedback/advice is GREATLY appreaciated. Thanks!
The jar you are including in the classpath are not available in the server runtime, If you do not want to put them explicitly in WEB-INF/lib, you can try by copying those jars into tomcat's server/lib folder
Since you have .dlls also they need to set by passing the jvm argument
java -Djava.library.path=/dlls.folder
for tomcat you can edit the bin/startup.sh (or .bat) and modify java.library.path variable, in some systems you might need to set LD_LIBRARY_PATH variable too
see similar discussion here

JBOSS Eclipse Integration

I am working with Eclipse and JBOSS. I was wondering if there is a way to do hot in-place deployment for a web project, by integrating the JBOSS server with Eclipse.
By hot in-place deployment, I mean, I should be able to view the change made to a jsp , by refreshing the page on the browser, not required to go through the routine , build-deploy-test cycle.
Take a look at JBoss Tools. That has everything you need.
JBoss Tools seems to do auto-redeploy by default when you create a web application with their wizard: http://docs.jboss.org/tools/3.1.0.CR1/en/GettingStartedGuide/html/jsp_application.html#AutoRedeploy
AFAIK every time you save a JSP they copy it to the application deploy directory in JBoss, but if your source layout matches the WAR layout they might run the application directly from your project directory (I know some versions of WTP did this with Tomcat, but with JBoss it's probably harder).
You are after "Exploded Hot Deployment" - deploys a directory of your files rather than an archive and then any subsequent "explode" will only deploy changes rather than the whole project (depending on how you have Ant configured).
Frameworks like Seam do this for you. Maybe worth grabbing a build.xml file from them and modifying it for your use?
Have you tried using JSP-Weaver?
Here is the Wikipedia description:
JSP Weaver is a JavaServer Pages
interpreter. Unlike JSP compilers it
evaluates the JSP files directly,
without generating or compiling
intermediate Java source files for the
JSP Java servlet.
Although this sacrifices some
performance on page rendering (10%-20%
overhead depending on the compiler in
question) it enables a much faster
reloading of changes made to the
source of the JSP file (10-20 times
decrease in time depending on the page
and the compiler in question).
Unlike simpler attempts at
interpreting JSP-like syntax (e.g.
Facelets) it supports embedded Java
statements called Scriptlets (a
standard JSP feature). This allows
full compatibility with the JSP
specification versions 1.0 to 2.1.
I also agree with Sietse in you should check out JBoss Tools. It is a great free alternative to the JBoss Developer Studio

Can I update the HTML files using Wicket and Eclipse without recompiling the classes?

I'm using Eclipse and Maven-2 and I'd like to be able to edit my HTML files without "it" (not sure if it's Eclipse or Maven) recompiling my application. I understand that usually Eclipse tries to do a hot replace of new compiled Java classes with Eclipse and Tomcat.
Can I use something like this?
getResourceSettings().setResourcePollFrequency(null);
I know I can turn auto update off for Tomcat in Eclipse but I'd like the HTML file to update and the classes not to update if possible.
BTW, my primary concern is that Tomcat tends to get Perm gen errors after I (hot) reload too many java classes.
You're sort of correct, you're supposed to use setResourcePollFrequency(Duration.ONE_SECOND); or similar. This link has more detailed information. However what I've found is that due to Wicket's caching internal cache containers like to get really messed up after any hotswapping so you may just have to learn the hotkey for restarting Tomcat or start doing Wicket development with the integrated Jetty and WicketTester.
You may want to consider increasing the permgen space when you run eclipse. There is a command line argument:
eclipse [normal arguments] -vmargs -XX:PermSize=64M -XX:MaxPermSize=128M
(copied from:)
http://wiki.eclipse.org/FAQ_How_do_I_increase_the_permgen_size_available_to_Eclipse%3F
I am not sure offhand how to prevent wicket from reloading HTML files but I will see if I can find it.
Edit:
If setting the poll frequency to null doesn't work, try using Duration.MAXIMUM. Also, you can uncheck "Build Automatically" in the eclipse Project menu, though this is more of a hassle then it's worth, IMHO.
According to the wicket FAQ, wicket only reloads changed markup files when you explicitly set the resource poll frequency:
http://www.wicketframework.org/faqs.html
I am not sure how to prevent eclipse from copying altered files to the output aside from disabling build automatically.
If Build Automatically is enabled (it is by default: Project->Build Automatically) then any modification to the project files will trigger the build, regardless of whether they are in source folders or not.
I always work with Build Automatically disabled as I find it too intrusive (for reasons like this), and just hit ctrl-B when I want the project to build, or alt-P N to launch the clean dialog if needed.
I understand you're using (and might want to keep using) Tomcat, but during Wicket development you can run the supplied Jetty server onder /src/test/java/com/your/package/Start.java in debug mode to get this behaviour.. Set Wicket to development mode to use this feature.
HTML files or jsp files?
Are you using tomcat? If you are editing only html files, go ahead and change them as you wish. As long as you don't deploy them somewhere else for tomcat to fetch them, you'll see the update(s).
If it's jsp, save your new file, delete the files under the old work folder. This will make tomcat think it's the first time the file is requested and it will re-compile the jsp on the fly.