facebook

Local Debugging and the Application Context Root

  1. MyEclipse IDE
  2.  > 
  3. Installation, Configuration & Updates
Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #247799 Reply

    mcroft
    Member

    I have been using WSAD and we are looking to convert to MyEclipse. I am researching the tool and I am trying to get our existing application running locally with MyEclipse.

    The application is a large J2EE app, and all of our files currently are configured to use “/” as the context root within WSAD for local debugging. This is also the same context we use when we deploy our apps to production, so we cannot change these links for local testing, because of course these would remain when deployed and break.

    So for example, our links are /SomeServlet, or /images/someImage, etc.

    In MyEclipse, if I leave the context root as “/” as we do in WSAD, it actually creates a folder called “root” in the deploy folder. When I try to run localhost:8080/default.html, it cannot find any of my files since of course there is no “root” specified in my links. If I manually add the root folder to the local debug browser path, it works.

    Is there a way to specify “/” as the context root without changing all the links?

    #247859 Reply

    Riyad Kalla
    Member

    This is a bug, the problem is that some app servers call the root app “ROOT” and that resolves to localhost:8080/, but WSAD doesn’t. As a workaround you can just create a Custom Location deployment and deploy directly to the dir you need.

    #248059 Reply

    mcroft
    Member

    Im not sure I understand what you are saying. If I use a “custom location” for my deployment, it still requires my context root point to that location, and then my links in all my files need to change to reference that new location. I do not have the option to change the links in my files since they would not work in production. Did I misunderstand your reply? Is there a way to have my local MyEclipse debug console reference my files without changing the files themselves?

    #248064 Reply

    Riyad Kalla
    Member

    mcroft,
    Are you not able to create a custom location deployment type, and have it go directly into the WSAD root deployment dir so then you could access it using /mypage.jsp?

    #248077 Reply

    mcroft
    Member

    We are looking to get rid of WSAD and use MyEclipse.

    #248078 Reply

    Riyad Kalla
    Member

    I misused WSAD, I simply meant “your app server”. You need to deploy your app to your app server (I’m assuming it’s websphere?) to debug, so what I was asking is when you create the deployment in MyEclipse:

    Deployment Dialog > Add > Server: <Custom Location>

    and use a Custom Location, aren’t you able to deploy your app simply to the root of your app server’s deployment directory to get around the problem of MyEclipse creating the ROOT subdir when you deploy it specifically to that app server?

    For example, I just setup a custom deployment of my application to C:\tomcat\webapps, so instead of putting my app in ROOT or any other context dir, it just dumped all the files in the \webapps dir. You could do the same for your app server, this is what I’m getting at.

    #248205 Reply

    mcroft
    Member

    I am using Geronimo for local debugging, but we deploy to WebSphere. Not ideal, I know but it is not feasible to have a full edition of WebSphere on each developer machine for local debugging and WASCE proved problematic. We do have remote debugging configured, but still not local. I did what you recommended and changed my Web Context-root back to “/” under Properties –> MyEclipse-Web but when I try to debug from the MyEclipse brower it still throws a 404 unless I enter the full path including the name of the .war file.

    #248306 Reply

    mcroft
    Member

    What is the default runtime folder where MyEclipse would pickup bootstrap files for example? I typically find this out by running a quick statement: FileOutputStream fos = new FileOutputStream(“runtimeLocation.txt”);

    This generated a file in the project workspace folder. I also put my bootstrap .properties file in the runtime-workspace folder but I still get the following error: java.io.FileNotFoundException: AWFConfig.properties (The system cannot find the file specified)

    In WSAD it is in the v5.1 install folder. You put the file there, and the test server looks there by default. Is there a similiar default location that MyEclipse would look for bootstrap files using Geronimo?

    #248310 Reply

    Riyad Kalla
    Member

    I don’t know the working dir by default, can you download and try and use JBoss and see if that works for you better out of the box? Just download the zip, unzip it and deploy your app.

    Is AWFConfig.properties your own properties file for your application or is it an app-server-specific setting for Geronimo?

    #248446 Reply

    mcroft
    Member

    It is our own application properties file. I think we can get by without using relative pathing. I just added an argument to the application configuration to tell it where our properties file lives and it works fine. The key issue still remaining is the context root. I do have the application running locally in our environment, but I had to change the links to contain the app name. This is just for researching MyEclipse, it cannot stay this way. I right-clicked on our project and selected properties, then MyEclipse-Web and made sure the context root was /. But it seems to ignore this. Do I need to build a deployment plan and put the context root as / in there? This should be acting as an alias, where it knows the path is /AppName/file, and all I should need is /file.

    #248462 Reply

    Riyad Kalla
    Member

    I was having a very hard time following what you are asking and I passed this along to another person on the team and they were also confused, so I think there is a mish-mosh of questions buried in here and I am really having a hard time following what you are saying. So let’s just boil this down to one problem at a time:

    1) Please give me an example URL in your browser of how you would WANT to access your index.jsp page (e.g. site.com/index.jsp OR site.com/myApp/index.jsp)
    2) Please tell me what the context root is set to in MyEclipse-Web settings

    Now given the two things above, what is the problem? I thought I originally understood it to be that you wanted to deploy your app as the root application using / as your context root so you could do site.com/index.jsp, but when I suggested using a custom location deployment to accomplish this, you either ignored that, didn’t understand what I was saying, or tried it and it didn’t work… then I replied that I tried to locally and it worked fine, then we got off on a tangent about some properties file and I got lost again about what you are asking. So my confusion stems from the fact that I thought I already solved your original question, which you seem to be asking again, but I don’t think I did.

    This should be acting as an alias, where it knows the path is /AppName/file, and all I should need is /file.

    And no, there is no alias. / means “root application”, if you want /AppName/file, then you have to put /AppName as your context root. This is why the context root defaults to your project name when you add web capabilities or create a new web project.

    #248471 Reply

    mcroft
    Member

    If you see my post for Mar 09, 2006 – 12:19 PM, I stated that I did what you recommended, which was to create a custom deployment location. This did get rid of the root folder. My question is; how (within MyEclipse, since I know how to do this in WSAD and it works there) do I tell my local environment that I want my context root to be / (just slash). In Properties–> MyEclipse-Web I have:

    Web-root folder: /Web Content
    Web Context-root: /

    But, when I try to run this in my local MyEclipse browser: http://ri150ws505:8080/default1.html
    it throws a 404 and forces me to prepend the appname like this: http://ri150ws505:8080/AmicaDotCom/default1.html

    The only way around this is to change my links in my app, which again, I cannot do since these files work in our production environment without prefixing the app name. In WSAD all of our links are like this: /ServletName or /filename, but in MyEclipse I am forced to say /AppName/ServletName or /AppName/filename. It seems to be ignoring my setting that / is my Web Context root.

    #248483 Reply

    Riyad Kalla
    Member

    Ok we are still on the same page:

    Web-root folder: /Web Content
    Web Context-root: /

    This *should* be right. Try my example (I just did this locally) and see what result you get.

    Create a new Web Project, when you name it, be sure to go down to web root context and change it to just / (slash), then hit finish. Now setup a deployment to websphere, is it trying to deploy it to your deploy directory or to a /ROOT subdir?

    I just deployed an example app above to JBoss, Tomcat, OC4J and Sun App Server 8.1 and 8.2 and each server was different, Tomcat being the only one that deploys it’s root application ot a ROOT subdir, all the rest of them were into the root of their “autodeploy” or “deploy” directories.

    But, when I try to run this in my local MyEclipse browser: http://ri150ws505:8080/default1.html
    it throws a 404 and forces me to prepend the appname like this: http://ri150ws505:8080/AmicaDotCom/default1.html

    I have a feeling the only reason /AmicaDotCom is still working after your redeploy is because it’s a stale copy of the web application that wasn’t undeployed. Can you clear out all your installed web apps and deployments and start WebSphere then try and access /default1.html and /AmicaDotCom/default1.html and make sure that both *do not* work to make sure nothing stale is laying around?

    I appologize if my post above seemed trite, it wasn’t meant to be, I want to get you up and running and I felt like I was missing your question over and over again.

    #248768 Reply

    mcroft
    Member

    I cleaned all my old folders and project files and started new. I rebuilt my project but the appserver (Geronimo) throws a class not found exception trying to parse my web.xml file. I have a servlet mapping with a <servlet-class> definition, but it cannot find the class. I had this working before, not sure what is causing this now. I did build the project as you suggested and used / as the context URL. The class is in a .jar file and I have it referenced as a library on my project although it is not showing up in my WEB-INF/lib folder. It is a J2ee project. Any suggestions?

    #248780 Reply

    Riyad Kalla
    Member

    The class is in a .jar file and I have it referenced as a library on my project although it is not showing up in my WEB-INF/lib folder. It is a J2ee project. Any suggestions?

    Yes, open your project properties, go to MyEclipse-Web and the Deployment tab. Make sure your settings for deployment are set so your JAR that is on the build path (depending on what kind it is) will be deployed. That’s probably what happened is that got reset to default and it’s not getting deployed.

Viewing 15 posts - 1 through 15 (of 24 total)
Reply To: Local Debugging and the Application Context Root

You must be logged in to post in the forum log in