URL issue with tomcat include project name - eclipse

I am using Eclipse for J2EE project...
one device send request to my side and url like
http://myIP:myPort/corporationweb/Controller
/corporationweb/Controller is fixed we can't change it because it made on device
my project name in eclipse is "VirtualTest" but here tomcat include project name if i mapping any servlet, /corporationweb/Controller URL like
http://localhost:8080/VirtualTest/corporationweb/Controller
I need page open without change project name
any i can mapping servlet directly so URL like http://localhost:8080/corporationweb/Controller
any URL rewriting technique..
make as default application for my project

Rightclick project in Eclipse, choose Properties, go to Web Project Settings and set Context root to /.
This will let Eclipse deploy the project on context root instead of project name (which is the default).
Unrelated to the concrete problem, you really need to ensure that your application is written the way so that it does not care on which context path the application is been deployed. This is namely a server specific setting which is not controllable from inside your project. Make use of HttpServletRequest#getContextPath() the smart way.

If you want to make "VirtualTest" as default application for your project, and not showing this name in URL, you can simply change project name to "root", which is a special name for the default application.
Your URL will be like:
http://localhost:8080/corporationweb/Controller

If you are using Eclipse. Go to server and remove the unwanted project which are Synchronized, then restart your server. Worked for me

Related

eclipse tomcat server add/remove alias?

I'm trying to use the Eclipse server view to deploy an app to tomcat. This works, but its deploying to a different directory than I'd prefer.
For example, my project is named abc.application.finance so eclipse is deploying to webapps/abc.application.finance, but I really want it deployed to webapps/FINANCE.
I need something like an alias for the project name, but I don't see any where in the server view add/remove feature to specify this.
Where do I need to to make a change so I can do this?
tomcat->module->edit
then edit path of your application

Rename JEE project

I'm working on a JavaEE project, I already have the skeleton of an old project. All i have done is rename the project, packages and change the name in the project file (.project). But now when i'm trying to run, it returns error in the browser "The requested resource is not available". I've checked the web.xml and added a new jsp in vain it doesn't work. In the browser's address, it gives me the old name of the project(http://localhost:8061/smsgate/). I've tried a lot to fix the problem. what can i do? Is there any other file that i have to update and write in the new name? Please give me your ideas (knowing that i have to use that old project)
Do Project -> Clean in your workspace by selecting your current project. Also if using maven then right click your project and do maven -> clean.
Manually go to your target directory of your ear module and shift-delete everything inside your target and then rebuild your project to form new ear.
if you have configured the web.xml properly then strike your app url. Also ctrl+shift+delete your browser history and then check.
Why not create a new project using a maven archetype, just type in the console:
mvn archetype:generate
It will show you a list of available archetypes from the web, just choose one of them, for JEE6/JEE7 you could choose among:
1019: remote -> org.codehaus.mojo.archetypes:webapp-javaee6 (Archetype for a web application using Java EE 6.)
1020: remote -> org.codehaus.mojo.archetypes:webapp-javaee7 (Archetype for a web application using Java EE 7.)
If you agree with me, just type:
1019 or 1020 according to your needs and answer the questions like:
projectId:your-project-name
groupdId:com.yourdomain.reverse
version:1.0

Zend Framework issue in run command in netbeans

I am trying my hands on using Zend framework with netbeans.
I have setup everything correctly as i can create project using ZF command line and can create other controller and actions.
But when i setup project in netbeans and use run command it does not seems to understand Zend framework MVC url structure and shows complete path in browser.
instead of running http://testing.com/about
it is taking http://testing.com/application/controllers/AboutController.php
but when i type is manually everything seems to be working fine.
you need adjust a few settings in your project properties. Open your project properties menu and select Sources make sure your Web Root is set to public, while you're there make sure your sources and project folder are correct.
Next select Run Configuration and make sure your Project URL is correct. When using ZF there is no need to specify an index file, netbeans may complain some but it will work.
Now when want to run your project you have to run the whole project. When using ZF you can't run just one file because all request are routed through the index.php in the public folder. So Always select run at the project level and not at the file level.

URL mapping of servlets and JSP files with Tomcat and Eclipse

I have a web application project in Eclipse that is configured to deploy to a local Tomcat server. Let's call the web application Blah. Here are two questions -- I must be missing something very simple, but I can't find an easy way to change these settings within Eclipse without fiddling with the Tomcat configuration files.
1.
When the application is deployed, the URL I can use to browse to some servlet/JSP is localhost:port/Blah/servlet. I would like to get rid of the Blah prefix.
2.
I would like to set up redirects for some JSP files to "hide" the .jsp extension. For example, I'd like localhost:port/login to be served by localhost:port/login.jsp, preferably without the browser seeing a 30x redirect status code.
3.
I would like to set the default URL, i.e. localhost:port/, to redirect to a particular JSP or servlet (again, preferably without issuing a redirect status code).
Any help, including links to relevant resources, would be greatly appreciated. Please note that I am looking for a way to configure these things from within Eclipse, if possible. (If not possible, I would like to do the minimal amount of changes to the scary Tomcat XML files.)
This means that you need to deploy your application as the root application. It's easily done by naming your war file ROOT.WAR (or your exploded war directory ROOT), or by defining a context for your web app with an empty string as the path attribute.
Then you don't want a redirect, but a forward. Or you simply want to map the JSP (which IS a servlet) to a given path. Define a servlet and a servlet mapping in the web.xml file, as you would for a servlet class, but use <jsp-file> instead of <servlet-class>.
This is done using the <welcome-file-list> element in the web.xml.

Java Dynamic Web Project with Eclipse

Currently to access my dynamic web project (running in a tomcat servlet container) I access the following url:
http://localhost:8080/[Eclipse_Project_Name]
I have a couple questions about this:
Where is the configuration that
is forcing the url to require the
Eclipse project name? I don't see
this in the web.xml.
Say I'd like
to change the url used to access my
project. Maybe I want it to by at
the root: localhost:8080/, or maybe
a different directory structure
altogether. How do I do this?
Thanks
Where is the configuration that is forcing the URL to require the Eclipse project name? I don't see this in the web.xml.
When you create a New Dynamic Web Project, the first page of the wizard asks you for a Project name and in the third page, you can change the web module settings such as the Context root which defaults to the project name (the context root is the part of the URL you're talking about).
This information is not stored in the web.xml, it is stored in the .settings directory of the project (to be precise, in org.eclipse.wst.common.component) and will be added later to /Servers/Tomcat v6.0 Server at localhost-config/server.xml in a <Context> element when you will Add the project to the Tomcat server.
Say I'd like to change the url used to access my project. Maybe I want it to by at the root: localhost:8080/, or maybe a different directory structure altogether. How do I do this?
Right-click on your project then Properties > Web Project Settings. There you can change the context root. Then go to the Server View, right-click on the Tomcat server and select Clean... and you should get prompted to accept the modification of the server configuration.
to change the context root in eclipse please follow the below procedure
Right click on Project-->Properties-->WebProject