Run ATG application in Eclipse - atg

I was able to create an ATG project under Eclipse (using the wizard New ATG Application Moduke) but now I am not being able to run it on browser.
When I right-click on index.jsp file I have no option to "Run on server".
What I am missing or doing wrong?
Thanks

I don't know if it possible because when you want to build and deploy ATG application you need to run assembling process that is defined in ATG tool (doc). Probably you can only run ant/maven task that will do the deployment nothing more.
Other option is to use JRebel which can update you java classes and jsp files on the fly without restarting the server.

If you have a bat or shell script which run your app, you can apply approach from there https://stackoverflow.com/a/18729743/5049232

Related

Debug Tomcat Web Application in Eclipse

I have a Advanced Java Application(Spring+Hibernate) with Maven. Project runs without any error.
I follow below process to test the application.
Build War using below command.
C:\Dev\ProjectApp> mvn clean package -Dmaven.test.skip=true
This builds war file inside target folder(C:\Dev\ProjectApp\target).
Place Application.war inside webapps folder(C:\Apps\Apache\Jakarta\Tomcat6\webapps)
run startup.bat from Tomcat6\bin folder.
hit the application in web Browser (http://localhost:8080/).
I want to debug this application from eclipse IDE itself. While application runs in webbrowser. I want to debug using breakpoints.
What are the steps to run this application in eclipse? What are constraints involved in this?
Thanks in Advance !
To simply debug the flow of the application, you can use the eclipse as the basis.
Goto the server view and create a new tomcat server (or any server that you use for dev). Next right-click on your project --> run as --> run on server and select the server that you just created. Keep in mind that the server should have all the configurations that you need to have to run the application. If your project requires some custom settings in the application server, then tell eclipse to take control of the server installation by selecting "Use Tomcat installation". (double click on the server to configure it)
Next add debuggers and start the server from within eclipse.
Happy debugging !
Set the environment variables first
set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
You can edit the startup.bat to have
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
and start in the same way as above.
After this you can have your eclipse open a remote debugging session that connects to localhost:8000.
However, I would strongly recommend to use the WTP plugin in eclipse to build and start/stop the tomcat from within eclipse itself.

Is it possible to do Hotswapping of ATG classes

The deployment we follow is that we use runAssembler.bat to build an ear file and deploy it in a app server. We are using weblogic and jboss for testing purposes of the modules we built. However for every small change, we need to run runAssembler and build a new ear and deploy it in app server and restart the server.
I would like to find out if anyone figured out a way to do Hotswapping of class files which are generated by the code we write in ATG environment in either weblogic or jboss.
By attaching your IDE to your Application server on the Debug port it is generally possible to do hotswapping. Setting this up on Eclipse and JBoss is documented here, here and here. There is some information for setting it up in WebLogic here.
Attach your debugger, edit the java file, click 'save' and with hot code replacement in your IDE it should now update the running class file. In Eclipse it usually gives a popup if it was unable to do the sync. If you are using Eclipse, make sure the 'Build Automatically' flag under projects is ticked or you'll be waiting forever. I've not had any issues doing this via JBOSS (exploded ATG EAR) and variable success in doing this on WebSphere 7. It may also be prudent to make sure the same JAVAC you use to compile your build is the one loaded into your IDE compile path.
Another way to at least reduce the build/deploy time would be to deploy an unpacked/exploded EAR and simply copy your class files across (you could use the Eclipse FileSync plugin) and restart the server.
There are also some commercial options available, like JRebel
In our organization, we had good success in using DCEVM. It simply patches your JDK (in Windows: jvm.dll).
Download and patch your JDK
Launch your JBoss/Weblogic with the patched JDK
Set up Eclipse's Installed JRE's to point to patched JDK (restart and rebuild once)
Start the server, Launch debugger and connect
Ensure Eclipse's Debug view shows "Dynamic Code Evolution VM" (instead of something like "HotSpot VM")
Change your code, and voila!
You can do this with JRebel. After hotswapping you don't need to restart the server, only reload you deployment from Weblogic.

How to avoid that glassfish deploys all the previous project?

When I start the glassfish server I have noted that it loads all the previous projects that i have developed and previously deployed.
I think that somewhere there is a config file that tells the server to reload the projects, but if i would like to work just on one of them what i have to do?
i suppose that i have to change or delete some entry in a glassfish configuration file, but i don't know where it is and how to do that.
thanks
Massimo
You have different options.
You can go to the Glassfish admin GUI via http://localhost:4848 and look under "Applications". You can undeploy properly deployed applications there.
If this is not working you can manually delete the applications from the glassfish folder: Look at
/[glassfish_installation_path]/glassfish/domains/[your_domain]/applications
or
/[glassfish_installation_path]/glassfish/domains/[your_domain]/autodeploy
Glassfish is running applications in these folders at startup time.
The undeployment depends somehow on the method you used to deploy the applications...if you used NetBeans to deploy you can probably even select the application in NetBeans and click "Clean and build" do undeploy it.

One click build and deploy using Eclipse/Maven/JBoss AS 7

I was wondering if it is possible to make a Java EE application being managed by Maven and automatically deploy it to JBoss all from Eclipse. To my knowledge I current right click on my project and select "Make install". After that completes, I open the server pane and right click on my deployed ear and either select "Full Publish" or "Incremental Publish". Is there a way to condense these actions into one click? I tried to write a windows batch file but I didn't have much luck with that, and it would only work for our devs working on Windows machines. I know I can make run configurations but when I try to make one it is very intimidating and I get frustrated and give up.
Thanks for your help!
You can use JBoss Tools 3.3.0 (Current milestone M4) with the maven integration to easily deploy projects (wars or ears) to your AS7 server.
Once you defined your AS7 instance in eclipse, all you have to do is right click on your project > Run As ...> Run on Server. It'll start your app server if it's stopped, or just deploy your app if it's already running.
See http://vimeo.com/25768303
and http://community.jboss.org/en/tools/blog/2011/11/09/jboss-tools-shift-happens-in-m4
If you are using maven, you can use the cargo plugin: http://cargo.codehaus.org/Maven2+plugin
You just configure where the JBoss is installed, set the plugin to run in the phase you want (or make a new one) and you are all set.
You can also create different configurations for different profiles, so you have local, integration, test, production, etc... And just by running with the selected profile deploys the ear in the server, remote or local.
If you want more control, you can set the path of the container as a variable that you pass in the Eclipse run configuration, that way each developer can have their servers in different paths.

Tomcat & Eclipse integration

I'm developing on a Ubuntu 8.04 machine using Eclipse Ganymede. I installed Tomcat 5.5 using sudo apt-get install tomcat5.5 tomcat5.5-admin and using an Ant script I deploy my WAR file by copying it to $CATALINA_HOME/webapps.
I then created an Eclipse project and I have it output compiled source in a similar but separate directory structure under $PROJECT_ROOT/target/. I still deploy the WAR file by right clicking on the build.xml and choosing my deploy-war task.
As Tomcat is running as a deamon, automatically started up on booting, I'm not instructing it when to start or exit.
My problems with this setup are:
Using this approach I do not get any output to the Eclipse console, as Tomcat is running under the tomcat55 user and I have a different login and no access to Stdout of tomcat55.
The logging which occurs is also directed to Stdout at the moment, which I find pretty nice during development. But it's not nice when I can't see it. :-)
I don't have any servers under the Server tab and no Run configurations. This makes it impossible for me to use the Debug mode of Eclipse, which otherwise is quite convenient.
What do you think I should do to integrate them and in turn make my development environment much better?
I'd say forget the pre-packaged Tomcat. Grab the apache-tomcat-x.y.z.zip from the site, unzip it somewhere in your $HOME and add a Server to your eclipse workspace, pointing to your local installation of tomcat. Of course you need the j2ee/wtp Eclipse bundle. Works fine on Windows, can't see a reason for it not working on Linux.
Edit: You may have to fiddle with server ports if you have two tomcat installs.
Add Tomcat to the list of Eclipse servers and run your web-app on the server. If you need more details click here.
I never cared about 1 and 2, so I can't really help you with them.
regarding 3:
You don't need any servers under the server tab for debugging to work. Just start tomcat with these environment variables
export JPDA_ADDRESS=8000
export JPDA_TRANSPORT=dt_socket
and configure eclipse accordingly: run - open debug dialog - select remote java app and create a new configuration.
You need eclipse to manage a copy of tomcat, then it can debug it. The clue to the problem was that you have to push deploy-war, this means the files are leaving your development environment and entering an external server. On a properly configured development environment, you only need to save your java file, it will auto-compile and already be on the local tomcat install, which might try to auto reload the web-app, and you can refresh your browser without reloading anything on the server. Look up some more tomcat plugins, there are a few different ways to do this.
If you want to do regular debugging and relaunching of Tomcat apps, you might want to take a look at MyEclipse - it can make things a lot easier.