Auto Deployment of Eclipse WAR fiel to Tomcat using ANT Scripts

0

Category:

Auto Deployment of Eclipse WAR fiel to Tomcat using ANT Scripts
Eclipse allows us to run the application and then export the application to a standard WAR file. But then someone has to manually do the following steps :
Export the project to a WAR file using Eclipse Interface
Copy the WAR file from the location created to the Tomcat webapps folder
Here is a better alternative and a solution to the question :
Create an ANT script that will look at the Eclipse Project structure and build the WAR file and copy over the WAR file to the destination (Tomcat WebApps folder)
Here is the ANT script:




















Save the above code into a file and name it “build.xml”. Place the build.xml into the root folder of your eclipse project. For example, if “c:\projects” is my eclipse workspace and “SanFrancisco” is the name of my project then all the files related to the project will be under “c:\projects\SanFrancisco”.
You can run the ant command inside the projects root folder either using any ANT tool installed or if you have ArcGIS Java ADF installed then there is a customized ANT tool executable available for use.
Here is the usage:
1. Create the WAR file and deploy it to tomcat
"c:\program files\arcgis\java\tools\ant\build\arcgisant" deploy
2. Just create the WAR file
"c:\program files\arcgis\java\tools\ant\build\arcgisant" create
3. Just copy over the WAR file to deploy location
"c:\program files\arcgis\java\tools\ant\build\arcgisant" copy
4. Unpack the WAR file to see the contents
"c:\program files\arcgis\java\tools\ant\build\arcgisant" unpack

Unpacking and Repacking EAR and WAR files

0

Category: , ,

Unpacking and Repacking EAR and WAR files
The procedures discussed in this chapter are specific to the Microsoft Windows platform.
To unpack the .ear or .war file:
1. Open the command prompt, and navigate to the folder that contains the EAR or WAR file.
2. Create a folder named "[Temporary EAR location]” or "[Temporary WAR location]”.
3. Go up one level to the folder that contains the EAR or WAR file.
4. Select the EAR or WAR file you want to unpack, right-click the file, select the Open with option,
and select WinZip to unpack the EAR or WAR file to the temporary location "[Temporary EAR
location]” or "[Temporary WAR location]”.
Note: You can choose to configure your computer to consider EAR or WAR files as ZIP files,
by performing the following steps:
1. Go to the Control Panel.
2. Double-click Folder Options.
The Folder Options dialog box is displayed.
3. Click the File Types tab.
4. Navigate to the EAR or WAR extension in the Registered file types list.
5. Click Change.
The Open With dialog box is displayed.
6. Select WinZip in the Programs list.
7. Click OK.
8. Click Apply.
9. Click OK.
To repack the .ear or .war file:
1. Access one folder level above "[Temporary WAR location]”.
2. Select the "[Temporary WAR location]”.
3. Right-click the folder, select WinZip, and choose the Add to Zip option.
4. In the Add to archive field of the Add dialog box, specify the name of the .ear or .war file you
are repacking.
5. Click Add.

How to Test a Database Connection String using NotePad

0

Category:

How to test a data providers connection string (like a SQL Server database) with the help of a plain text file using Notepad.

To investigate and test out if your connection string works, your going to want to create a UDL file. To do this, follow these steps:
Open up Notepad and create an empty text file, then
click File -> click Save ->
save it with the File name: TestConnection.udl to your desktop.
Go to your desktop and double-click on the TestConnection.udl file you just created and the Data Link Properties box will popup.
Select the Provider tab and Find the provider that you want to connect with and click Next >>.
Now from the Connection tab, select or enter your source/ server name -> then enter information to log on to server -> and select the database on the server.
Click Test Connection and click OK to save the file.
Note: If errors occur during testing of your connection string, you will get a popup box with the error message.
Once, you've successfully tested your connection string, now go and compare the details of your TestConnection.udl with your (website) project connection string to see if they are similiar.

OutOfMemoryError: Heap space and PermGen space

0

Category:

Solution for Tomcat Server

It’s quite common to run In memory problems when running some big Java EE application on a Tomcat server.Some of the most commmon errors are like the following ones.
This is about a full Heap space:
SEVERE: Servlet.service() for servlet jsp threw exceptionjava.lang.OutOfMemoryError: Java heap spaceThis other is about the PermGen space that’s a memory area, where compiled classes (and JSPs) are kept, and this error might happen often if the running web application have many .java and .jsp.
MemoryError: PermGen spacejava.lang.OutOfMemoryError: PermGen spaceTo increase the memory available to Tomcat, about heap and permgen the correct options are the following ones.
This sets the max heap available to Tomcat at 1Gb of memory:
--JvmMx 1024
This sets the max permgen available to Tomcat at 256Mb of memory:
-XX:MaxPermSize=256m
Just update memory settings from a GUI frontend, or to view what happened after running the command line tool. Running the following command:
tomcat6w //ES//Tomcat6a
window will open showing all the parameters about the windows service Tomcat6.
It’s possible to see in this image that, after running the previous command, for setting higher memory limits, in the sections Maximum memory pool and at the end of the Java Options the new memory limits are set.
Memory Settings on Windows
Solution for Unix based OS(Ubuntu, Linux, Solaris..etc)
It needs to increase the memory by making changes in catalina.sh file.
Follow the following(remove any spaces from the below given line when you add to script)
steps :1) vi /usr/local/jakarta/tomcat/bin/catalina.sh
Add below given line into the catalina.sh file.
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC"
Happy Coding