How to setup JNDI resource in tomcat with IntelliJ IDEA - java

I'm new to IntelliJ IDEA and I'm trying to set up JNDI resource in Tomcat but I'm using intelliJ IDEA. I have done this with Eclipse many times, but as you know there is a separate folder Servers in the project structure that allows you to open the server.xml and set up the JNDI resource. I've looked through the options of Tomcat in IDEA but couldn't find anything. Could you please help me?

You can just edit server.xml file in TOMCAT_HOME/conf/ directory, where TOMCAT_HOME is the directory of the Tomcat installation you have configured in Run/Debug configuration.
You can open and edit that file in IntelliJ using File/Open or just edit it outside of the IDE using vim for instance.

Project Structure > Module > Web > Click -> Add Application Server
specific descriptor... > Click Tomcat Server > context.xml will make

Related

How to Remove Project name from eclipse url?

Basically I want to remove project name while I access my project in eclipse.
so currently when I want to access a link of my web-app I have to put it as localhost:8080/project_name/blah_blah_blah
But I want it accessible by just localhost:8080/blah_blah_blah
or say The project itself should be accessible by just localhost:8080
.
Through googling I found this URL issue with tomcat include project name but in my case my context root is as / by default.
Project Context root Options
FYI: This is the only project I have in my Eclipse
For people who come across this problem too.
To explain deeply: First remember that eclipse uses server under eclipse project explorer within its all configuration.
In order for you change your project path to something different, what you can do is to open server.xml under Project Explorer -> Servers -> Tomcat vX.X ... -> server.xml.
At the bottom of this file You should see this line Before End of </host Tag:
<Context docBase="Duck" path="/Duck" reloadable="true" source="org.eclipse.jst.jee.server:Duck"/>
Notice: My project Name is Duck.
Now in order for you to access your web-app without project name replace path="/Duck" to just path="/" or You can set it to any name you want.

Tomcat server could not start

I am developing a dynamic web application on JBoss developer, but I am getting an error message:
Could not load the Tomcat server configuration at
\Servers\Tomcat v6.0 Server at localhost-config. The Servers project
is closed.
Even when I try to start the server on the servers tab, it doesn't start.
Any suggestions?
Sounds to me as if you're doing this inside Eclipse with WTP?
If so then you need to make sure that the Eclipse project called Servers which is created and maintained by WTP is open.
Open the Navigator view
Locate the Servers project
right-mouse click
Open Project
You have been closed server project in eclipse which will come by default after adding tomcat into eclipse. So try to open server project and start Tomcat it will Work..
Steps:
Go to project explorer.
Double click on server project.
You installed Tomcat v6 within eclipse using the “Add server” wizard and the “download and install” button.
You tried to start Tomcat and got the following error:
****“Could not load the Tomcat server configuration at /Servers/Tomcat v6.0 Server at localhost-config. The configuration may be corrupt or incomplete”****
How to solve:
1) . Close Eclipse
2) . Copy all files from TOMCAT_6_HOME/conf to WORKSPACE_FOLDER/Servers/Tomcat v6.0 Server at localhost-config
3) . Start Eclipse
4) . Expand the Servers project, click on the Tomcat 6 project and hit F5
5) . Start Tomcat from Eclipse
6) . Enjoy!!!
Just after many trying I got the solution for this problem. The problem is when your server is created using your IDE(Eclipse, JBoss or any) that time the server is not getting the configuration file. To resolve this problem you need to copy all the configuration files from the tomcat conf directory to your IDE server directory. If I will step out the solution than I can list the steps as-
Locate your Tomcat installation directory
Find the conf directory, sometime you will get it into skel directory
Copy all the files from conf and now change the directory to your IDE workspace
In Server directory paste all the files in your Tomcat configuration directory.
If you are using a Linux-based Eclipse:
Check user and group ownership and permissions to your server directory and subdirectories inside Eclipse. It MUST allow read-write config files by the current Eclipse user. Test it copying config files directly to it and, after that, accessing it through Eclipse text/xml editor.
It's usefull too to check the same for tomcat directory, because Eclipse may be bloked if its owner doesn't have permissions to access that files.
the solution to this problem is :
cd /usr/local/tomcat//conf
chmod 777 *
and it's done
I got the same issue. This is because it's missing "Servers" folder that contains Tomcat in Project Explorer. I already downloaded and configured my Tomcat, but after I created another new java web project, Server stopped working.
To solve this problem right click on "Tomcat v6.0 Server at localhost
[Strated,Synchronized]"
at bottom of your Eclipse.
click "General"
click "Switch Location"
click "Apply"
enter image description here
This usually happens when the "Close unrelated projects" button is clicked. A simple and straightforward solution to this issue:
Go to the bottom of the Project Explorer tab and there will be a project named "Servers". If it's closed, the icon will have a different color than the projects that are open.
Double-click on "Servers". Now the project will be open and this issue will get resolved.

build-impl.xml:1031: The module has not been deployed

I have been working on a Java web application and i am using SmartGwt on Netbeans 7.3 and out of a sudden I encountered this problem. I tried cleaning the build-impl.xml then restarting the IDE and I should say I have fairly low knowledge on this. Can someone please tell me why it is giving an error and how I can fix that?
The error message says :
nbproject/build-impl.xml:1031: The module has not been deployed. See the server log for details.
BUILD FAILED (total time: 4 seconds)
Note: i am using Tomcat 7.0.34
may its so late but the response useful for others so :
Sometimes, when you don't specify a server or servlet container at the
creation of the project, NetBeans fails to create a context.xml file.
In your project under Web Pages, create a folder called META-INF.
Do this by right mouse button clicking on Web pages, and select:
New->Other->Other->File Folder
Name the folder META-INF. Case is important, even on Windows.
Create a file called context.xml in the META-INF folder.
Do this by right mouse button clicking on the new META-INF folder, and
select:
New->Other->XML->XML Document
Name it context (NetBeans adds the .xml)
Select Well-formed Document
Press Finish
Edit the new document (context.xml), and add the following:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/app-name"/>
Replace app-name with the name of your application.
Now your in-place deployment should work. If not, make sure that the
file can be read by everyone.
The context.xml file is specific to Tomcat. For more information about
that file, see the Tomcat documentation at tomcat.apache.org.
Start your IDE with administrative privilege( Windows: right click and run as admin), so that it has read write access to tomact folder for deployment. It worked for me.
Take a look at the server logs!
I had been with this for hours. The awful Tomcat servlet is not very helpful neither but if you can see the stacktrace that should be enough.
For instance, I read the following error message there:
As you can see, the message was pretty clear and easy to fix :-)
Check if there any other instance of the server is running already
Check if the port that will be used by the server is free.
If you add jars in tomcat's lib folder you can see this error
Close Netbeans.
Delete all libraries in the folder "yourprojectfolder"\build\web\WEB-INF\lib
Open Netbeans.
Clean and Build project.
Deploy project.
One of the main reason for this error is due to permission not granted to all users. so remove this error, follow the following steps :
1) Go to the C:/Programme Files/Apache Software Foundation/Tomcat 7.0
2) Right click on the Tomcat 7.0 folder and click on properties.
3) go to Security Tab.
4) Select the User and click on Edit... button
5) Grant all the permission to the user and click on apply and ok.
Refresh the system and now try. I hope it will work
if you still getting this error try this.
Go to Netbeans services
Remove Apache Tomcat.
Add Apache Tomcat again.
Build Project.
Deploy Project
in my case , it said that the 8080 port is in use , so I change the server port of Tomcat to 8081 and it works
Check whether you placed the within the .. or outside the ...
If you placed it outside the server tag , and if you try to access the init-parameter then it will give error.

Eclipse, Tomcat project context root is eclipse folder

I'm having a little problem configuring my Tomcat Project. In short, I'm working on a Dynamic Web Page project but there seems to be some confusion as to from where I am running the application.
Running the following code
File f = new File("");
System.err.println(f.getAbsolutePath());
yields the output C:/Eclipse which happens to be where I run Eclipse.
Normally I'd expect this to be the output catalog, but it is not the case this time.
My eclipse project is configured to have myProject/WebContent/WEB-INF/classes as output folder
How can I configure to the desired directory? Right now I need to use absolute paths which won't work for all members of the project.
Alright, I found a solution.
It seems my default working directory was set to my eclipse folder for the project so i solved it by specifying the project root folder instead which normally is the case.
I configured this here:
Run configurations > Apache Tomcat Run configuration > Arguments tab, under "working directory" choose "other" and specify directory.
Thanks for your comments!

How to make the application context run as root in Spring 3 MVC and eclipse

I’m trying to develop a Spring 3 MVC application using the Springsource Tool Suite/Eclipse IDE.
My current application context in STS/Eclipse is /localhost:8080/realtyguide/
What I want is to access the application as root using just /localhost:8080/
I tried in eclipse.. Project > Properties > Web Project Settings > entered “/” for Context Root . But this just returned a “404 error - requested resource (/) is not available” after executing the app. And it also broke the app. So I just put context root back to 'realtyguide'.
I deployed the app to my webhost on a Tomcat server. I edited the server.xml’s and elements and so I was able to bring up the index page with the url www.mydomain.com.
However, the links to the other pages are broken. It is also not picking up the static resources for the index page like css and jquery files.
I believe this is caused by my app’s application context of /localhost:8080/realtyguide/ in eclipse (in my development pc). The rest of the pages returned by my controller has a url of /localhost:8080/realtyguide/page_name
How do I change my app’s application context to run as root in eclipse, as in simply /localhost:8080/. So that my pages would be called as simply /localhost:8080/page_name
Is the solution a setting I should make in my web or Spring configuration files or in eclipse?
I’ve tried googling this but have not found a clear, definitve answer. I am very new to this and a detailed answer from you will be of great help.
Thanks to the other answers provided. However, it doesn't address my main objective - to run the app as root inside eclipse.
This is how I was able to do it. I changed Tomcat's conyext path in eclipse.
Do the following:
Right click on the server name from the Server Console > Open
Click on the Modules tab
Click on a module then click the Edit button
Edit the entry for Path to the desired context path then click
OK
You need to make your web-app the "default" application, ROOT. There are step-by-step instructions on the Tomcat Wiki, at http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F.
One way is to name the war simply ROOT.war (uppercase).
This works only if you deploy not from eclipse
If you have done your links/urls with <c:url> or <spring:url> then it should work without problems.
Simply change server.xml in Tomcat Server.
Package Explorer > Servers
expend path Tomcat vX.X Server
open server.xml
go to Server > Service > Engine
find your Context and change path to value "/"
restart the server!

Categories

Resources