• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to convert the classes in WEB-INF/classes folder to java source in Eclispe?

 
Greenhorn
Posts: 8
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

One of our old windows IIS is going to be dismissed soon so I am asked to migrate one of the web application(Yes a Java based web application was on IIS!) to Tomcat 8 / Java 1.8 on linux box. I wasn't aware a Java based web application can sit on IIS. But apparently IIS is a proxy and Tomcat(old version) was in the background accepting the servlet requests.Anyways, all this old installation and deployment has to be moved to current versions. Now starts the funny part. There is no code base for me to pick from repositories(like svn) that was pointing to the production environment. So I will be picking the bits from webapps folder from IIS server and reverse generate the project in eclispe. I didn't find any WAR file that I could have imported in Eclipse and all the source would have been generated for me. I have managed to restructure it manually according to Tomcat-specific web application structure(please see the attached image).Now my problem is I need to generate Java files from class files in WEB-INF/classes folder. I have used JADclipse to decompile the class files but they wont convert it to .java automatically and put it in src folder. Is there any way I can achieve this without converting each class into .java manually?
Thanks in advance.
sample.png
[Thumbnail for sample.png]
 
Rancher
Posts: 1093
29
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are several decompilers out for Java, do a Google on "java .class to .java" and it will give you a listing. I have tried a few of them, the free ones, and I ended up doing it manually.
 
Aurelia Soni
Greenhorn
Posts: 8
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like I mentioned, I used Jadclipse which is an eclipse plugin for decompiling class files, but it won't convert all the classes of my web application into Java files. I am coming to think this is going to be a manual process
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IIS is often used in Microsoft shops as a reverse proxy for Tomcat. Like the Apache HTTPD server, which runs on both Windows and Linux (and many other OS's!), what you have is a central webapp contact port that listens to the common HTTP and HTTPS ports (80 and 443). This gives you 2 advantages. First, it allows combining both Java and non-Java apps addressable from a common container (IIS, in your case). Secondly, ports 80 and 443 are privileged ports, and thus require administrative privileges to listen on. In Apache, Apache starts privileged, opens the listening ports, then drops down to run as an unprivileged user. I've never actually checked to see what user ID IIS runs under, so I don't know if it limits itself or not.

On the backend, your Tomcat appears to be dealing with what's known as an "exploded" WAR. Which is simply what you get when you unzip a WAR file. Since everything's in the exploded copy, an actual ".war" file may not exist (and if it does, it would be ignored in favor of the exploded WAR anyway!)

So you could theoretically just jar up the webapp, WEB-INF and all and install that (war) file on a new Tomcat and avoid all the pain of reconstructing source. In real life, however, a newer version of Tomcat might not run the old app properly, and not having source code to an app is not a safe way to run a business.

People think that "software doesn't wear out". That you pay for it once and it's forever. Here, as in so many other cases I've seen, software rots from the outside in. The core code is still good, but the environment changes over time until the core code is useless.
 
Aurelia Soni
Greenhorn
Posts: 8
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You Tim. I have no experience of working on IIS so appreciate your knowledge sharing.
I know tomcat deals with exploded war and doesn't care about the actual .war file but generally haven't seen the war file removed from the server, in case of Tomcat atleast (unless size is a concern).
Like you said, theoretically I might just War up the exploded content and deploy on a newer version of Tomcat but I have to be extremely lucky to make this application work because I am talking about Java and Tomcat's huge version difference here.
But indeed no source code at all has put me in quite a trouble here
 
reply
    Bookmark Topic Watch Topic
  • New Topic