Archive for the 'tomcat' Category

Integrating tomcat 6.0 and Eclipse europa

Till now I was using eclipse and tomcat separately, I was not that much serious about deployment, generally I goto the web application folder and edit/compile there itself. I know tomcat can be integrated with Eclipse, but I never tried. Today I have no other go. I need to do it. Here are the steps.

Register Tomcat with Eclipse

Select Window>Preferences

select the server you want to add, here we are adding tomcat 6.0 available under apache node

fill the necessary details

Here you can see the server is added to the list

You can see a new Project called Servers added to the Project explorer, If it is already there, the server might have been appended to the list

now open the corresponding web project to be deployed and start running it (ctrl + F11). Select Run on Server option

specify the server in which the application is to be deployed.

Move the projects to be deployed to the server. Here we have only one.

Thats it. done! see the web page is getting loaded!

https - Servlet - Attachment - IE not working

Hi, I have a servlet which will send me PDF stream. It is working good in IE and Firefox. When operating in secured mode (https), IE couldnt download the attachment. it stops in halfway. There were no exceptions thrown at the servlet end. Atlast, we found the line

response.setHeader(”Pragma”, “no-cache”);

is the culprit. when we dint set this header param when operating in secured mode,
it is working fine. :)

Microsoft site says “This behavior occurs when the Content Expiration option in the
Hypertext Transfer Protocol (HTTP) Headers, within IIS, is set to
Expire Immediately. Internet Explorer must save any Microsoft Office
file to the local cache directory, and then use the associated
application to open the file. If you set Content Expiration to Expire
Immediately, the Office documents are not cached locally and the
operation fails.”

mm. anyway, it dint take much time. we cud guess this from another servlet we have :)

tomcat - struts datasource - mysql

I was configuring struts DS to connect to mysql today morning. i got failed day be4 yesterday, it ended with some classnot found exception. ooops! i noted tday, there was some error in the webpage i read. here is the details.

mydb name: shiksha
u/n: root
pwd: mysql

here is the datasource part of my struts-config.xml

<>
< type="org.apache.tomcat.dbcp.dbcp.BasicDataSource">
< property="driverClassName" value="com.mysql.jdbc.Driver">
< property="url" value="jdbc:mysql://localhost:3306/shiksha">
< property="username" value="root">
< property="password" value="mysql">
< property="maxActive" value="10">
< property="maxWait" value="5000">
< property="defaultAutoCommit" value="false">
< property="defaultReadOnly" value="false">
< property="validationQuery" value="SELECT COUNT(*) FROM test">
< /data-source>
< /data-sources>

and my action mapping goes like this

< path="/DataSource" type="org.shiksha.TestDB">
< name="success" path="/pages/Welcome.jsp">
< /action>

when i hit
http://localhost/shiksha/DataSource.do

I got the following in the trace

******************************************
********Out Put from TestDataSource ******
User Name is: rajesh
User Name is: george
User Name is: prakash
******************************************

Enjoy buddy, have a nice day.

help: http://forum.java.sun.com/thread.jspa?threadID=528490&messageID=2974589

Next Page »