Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

What to do with edited servlet.

 
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I have an existing servlet in Eclipse that needs to be edited.

I have edited the servlet.

What do I do now to get the servlet to do its thing? Do I need to compile it?

Redistribute it?

I am unsure as to what to do with it. Using Apache Tomcat server 6.0.x

Thanks,
Michele
 
Ranch Hand
Posts: 344
Oracle Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the project not come with a build file, for instance build.xml for ANT, or something like it? The deployment details should be in there.

A servlet is really nothing more than a normal Java class file, so yes just like any other .java source files it needs to be recompiled. How it is "distributed" depends on the actual application it is part of. You'll need to look at how the application is currently set up on the web or app server (i.e. Tomcat, JBoss, Websphere, ...). Most likely it will either be sitting as a .class (compiled file) somewhere under the WEB-INF/classes directory in your web app work directory, or somewhere inside a jar file under WEB-INF/lib, or inside a war file. Jar and war files are essentially nothing more than zip files.
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's nothing inside the WEB-INF directory that has the words *.class

I am also having trouble deploying to a server, there is already an instance of Jakarta on the machine. I guess I will uninstall that and reinstall regular old Apache Tomcat.

I would like to do what is required to the servlet and redistribute it but I am unsure as to how to do this. I have the build automatically checked.

I notice the previous developer has a build directory but nothing is in it.

Any thoughts?

Thanks, Michele
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like Koen said, there are many ways of deploying the servlet. You should do the same thing that the previous developer was doing. You should either ask the previous developer or look at the deployment scripts that s/he has already implemented.

If you have the deployment scripts, you can post them here, and people can help you reverse engineer them. Given what you have told us until now, there is not enough information
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do see a script, utilizing ant. I am including the code here



I am attaching a screen shot of the servlet.

Lemme know, thanks, Michele
servlet.JPG
[Thumbnail for servlet.JPG]
screenshot of servlet example
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I appears that the Ant build script you posted should compile the servlet and add it to the WEB-INF/classes directory. The build, however, does not create a WAR file so I assume that the app will be deployed in its exploded form to Tomcat.

I assume that you obfuscated the values of src.dir and dest.dir. If the dest.dir is within your project's directory, then you will have to still copy the entire WAR contents to to the Tomcat/webapps directory. Unfortunately, because of the directory name obfuscation, I cannot tell you exactly what to copy over (based on dest.dir value, it would be the contents of d:/blah, expect that I would not expect to see src within that directory, as given in src.dir)
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure I understand, can you break this down more for me?

Thanks,
Michele
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just run ant recompile and see if it works.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cannot be any clearer because of lines 20 and 29 in the build.xml file you posted. The values (directory locations)) make no sense to me. Are those the correct directory locations or did you change them before posting? If you changed them, could you either post the real directory names or do a better job of changing the names.

For example, one of my projects has these directories:

src.dir = d:/opt/workspace/helloweb/src

dest.dir = d:/opt/workspace/helloweb/webapp/WEB-INF/classes

Note that if I would have changes the name the same way you did, then in line 20 the "blah" would be "/opt/workspace/helloweb" while in line 29 the "blah" is "/opt/workspace/helloweb/webapp". Now, I would line to tell you to copy "blah" to some location, but if I tell you that, you won't know whether I mean /opt/workspace/helloweb or /opt/workspace/helloweb/webapp.
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok thanks, but what is the relationship of these directories to the project itself? Does this match the project directories or is it a different place where they point to.

Also, I do not have a server installed on this, I am using JDK 1.5 and have been trying to download jboss 4.2.2 to configure with this.

My screenshot is like this, showing me the server is not installed.

I believe this means that I cannot compile anything without a server, right?

I inherited this from someone else and am having trouble sorting it all out. Any help is greatly appreciated. thanks!

Thanks,
Michele
server2.jpg
[Thumbnail for server2.jpg]
Screen capture of workspace without server
 
Acetylsalicylic acid is aspirin. This could be handy too:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic