Enable Tomcat localhost/Catalina Log in IntelliJ IDEA - java

I'm attempting to run a Java/Spring/Hibernate/ application using IntelliJ 13 and its built in Tomcat deployment plugin. When debugging a buddy of mine has the following logs.
I was wondering how to enable the logs that are in red, currently in my IDEA. I have tried the following solution.
Heading over to the Run/Debug Configurations Tomcat server and clicking on the log tab and enabling the logs
I appreciate any help or tips in advance. Thanks guys

If I am understanding your question correctly, you are not sure what to set in the "Log File Location" field of the "Edit Log File Aliases" dialog.
When you create a Tomcat Run/Debug configuration, IntelliJ IDEA creates a TOMCAT_BASE directory as {intellij_system_directory}\tomcat\{run_configuration_name}_{project_name}. (TOMCAT_HOME identifies where the binary files are and TOMCAT_BASE defines where an instance of tomcat is. Sometimes they are the same. In this case, they are not.) The {intellij_system_directory} directory is usually in ~/.IntelliJIdea13/system where ~ is your home directory (C:\Users\{username} on windows). See the document Directories used by the IDE to store settings, caches, plugins and logs. You can also go to Help > Show Log File which will pen the directory {intellij_system_directory}\logs. Just go up one directory and then into tomcat.
Just set the path to the appropriate logs directory. You can use ant file patterns to deal with dates. For example, for my Tomcat Run\Debug configuration named "My Web App" in "My Project", to view the catalina.log file, I would set the path to C:\Users\Mark\.IntelliJIdea13\system\tomcat\My_Web_App_My_Project\logs\catalina.*.log. The * wild characters the date stamp in the log name and IDEA will always open the latest/newest one.
Also take a look at this post -- https://devnet.jetbrains.com/message/5529312#5529315 -- of mine for information on a minor bug with naming of the tomcat base directories.

Related

Rest service in Java runs from Tomcat server but not inside Eclipse

I am unable to find another article that solves my problem but am happy to hear about one if you know the answer.
I have a RESTful service built in Java with Eclipse. It uses Spring and all of its bells and whistles.
After much work with configuration files, I am able to build the service into a war file, deploy it to my Tomcat webapps folder, and run it from standalone Tomcat. However, it still throws several errors on start when I try to start it from a service defined within Eclipse. The errors are the same errors that I was seeing before I got the config files correct for standalone Tomcat. The errors are about the inability to create the required beans because of references to properties that can't be found.
How did I get it running in Tomcat? I added a couple of .properties files to define properties needed by the beans that get launched at startup and then added a 'set CLASSPATH=...' line to the setenv.bat file in the Tomcat bin folder. This new line adds the properties files into the CLASSPATH. That seems to have fixed everything from standalone Tomcat.
So, my question is, "How do I make these same changes inside my Eclipse server?" I have added the properties folder with the property files under the config folder in Eclipse, just like it is in my native Tomcat folders, but I do not know how to modify the CLASSPATH string to specifically point to my .properties files (as I have done in the setenv.bat file for standalone Tomcat).
I think I understand the problem, but have no idea about the solution.
Thanks for listening.
Dave
Eclipse does not use any *.sh/*.bat files to startup Tomcat. In order to modify the way the server is started you have to open the configuration UI of the server by double-clicking on the server in the Servers view.
From there you will be able to modify the classpath of the system classloader through "Open launch configuration".
Another important setting is "Server path" which tells Eclipse, the value of $CATALINA_BASE. You can modify it only after removing all modules and cleaning the server. It is useful to set it to an easily accessible directory: this way you can verify directly that Eclipse didn't mess up your application deployment (sometimes it "forgets" to copy some libraries).
The "Configuration path" setting tells Eclipse where to find the files (but not subdirectories) that will be copied into $CATALINA_BASE/conf.
Remark: if your application requires you to add libraries to the top classloader, there is probably a problem in your project. The "missing" libraries should be added to WEB-INF/lib of your application instead: look into the "Deployment assembly" of your Eclipse project configuration.

Error renaming to MANIFEST.MF

I am curious about following error :
Publishing to JBoss 7.1 runtime server - MyEAP has encountered problem
Error renaming C:\(some path) to (MyEAR proj path)\(my war file)\META-INF\MANIFEST.MF
you can change these settings in server etc...
I have created a simple EAR project along with a dynamic web project with stuts2. I am deploying EAR file and everything is working fine but whenever I make changes to any file and save I get this error message. What is the exact meaning of this message?
Thanks
Maybe the problem to be that it is necessary to configure a scanner for external deployments.
See: 'Publishing to JBoss 7.1 Runtime Server...' has encountered a problem
In previous versions of JBossAS, there was an exposed JMX server with
an option to mark a folder as one that the deployment scanner should
look at. This option still exists in AS7, but, we haven't integrated
with the management ability yet. THis means we can't do it on the fly,
currently, in the current toolset is a bit hurt by this missing
feature.
It is still possible in the raw configuration of the server, howerver.
This means you can mark your server directly to scan some external folder by modifying
your configuration and adding a deployment scanner. The instructions for it are over here:
https://community.jboss.org/wiki/DeployingAnApplicationFromAnExternalDeploymentLocation
To make use of this, double-click your jboss-7 server inside eclipse
to open the server editor. You can then switch over to the second
page, "Deployments", where you can change the deployment method to
"custom" and set any folder that's on the same filesystem as your
eclipse installation. Once this is done, you can add that folder to
your server's deployment scanner lists as per the wiki above.

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.

Does exist Eclipse deployment assembly log?

I have project that contains many dependencies - several hundreds jars.
For debug run on Tomcat (Debug as > Debug on Server). The problem that sometimes some jars not deployed in tomcat work directory. May be exists log of deployment or something else that can helps to understand the reason?
Thanks.
Can you view the standard Tomcat catalina log file within the Eclipse window?
This is also visible by writing it into a file.
In the Servers tab, double-click on the Tomcat Server. You will get a screen called Overview.
Click on "Open launch configuration" in the middle of the screen. Click on the "Common" tab.
Towards the middle of the screen under "Standard Input and Output" you can check the "File" checkbox and then specify a file location that can be used to log your console output.
Restart the server and see if you have your logs.

Where can I view Tomcat log files in Eclipse?

Where can I view Tomcat log files in Eclipse?
For some reason my Tomcat installation/log folder is always empty.
BTW, does Tomcat dump to the log file after a while or is it immediate?
I'm not sure if you were after catalina.out or one of the other logs produced by Tomcat.
But, if you're after the catalina.out log file then follow the directions below:
In the servers tab, double-click on the Tomcat Server. You will get a screen called Overview.
Click on "Open launch configuration". Click on the "Common" tab.
Towards the bottom of the screen you can check the "File" checkbox and then specify a file that can be used to log your console (catalina.out) output.
Finally, restart the Tomcat server.
Go to the "Server" view, then double-click the Tomcat server you're running. The access log files are stored relative to the path in the "Server path" field, which itself is relative to the workspace path.
Another forum provided this answer:
Ahh, figured this out. The following system properties need to be set, so that the "logging.properties" file can be picked up.
Assuming that the tomcat is located under an Eclipse project, add the following under the "Arguments" tab of its launch configuration:
-Dcatalina.base="${project_loc}\<apache-tomcat-5.5.23_loc>"
-Dcatalina.home="${project_loc}\<apache-tomcat-5.5.23_loc>"
-Djava.util.logging.config.file="${project_loc}\<apache-tomcat-5.5.23_loc>\conf\logging.properties"
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
http://www.coderanch.com/t/442412/Tomcat/Tweaking-tomcat-logging-properties-file
Looks like the logs are scattered? I found access logs under
<ProjectLocation>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\logs
if you're after the catalina.out log and you are using eclispe with tomcat, this works for me:
create catelina.out some where in your computer. In my case, I put it in logs directory of my tomcat install directory
e.g: /opt/apache-tomcat-7.0.83/logs/catena.out
go to your eclipse, in the servers tab, double-click on the Tomcat Server. You will get a screen called Overview.
Click on "Open launch configuration". Then click on the "Common" tab.
At standard input and output section, check "output file", click on file system and then selected the folder where your create your catelina.out.
Finally, restart the Tomcat server.
#royalsampler said:
Go to the Servers view in Eclipse then right click on the server and click Open. The log files are stored in a folder realative to the path in the "Server path" field.
Since the path field is uneditable, you can also "Open Launch Configuration", click Arguments tab, copy the VM argument for catalina.base (within quotes). This is the full path of your WTP webapp directory. Copying the value to the clipboard can save you the laborious task of browsing the file system to the path.
Also note you should be seeing the output to the log file in your Console view as you run or debug.
Double click and open the server.
Go to 'Arguments'.
-Dcatalina.base= .. something.
Go to that something.
Your logs are there.
If you want logs in a separate file other than the console:
Double click on the server--> Open Launch Configuration--> Arguments --> add
-Dlog.dir = "Path where you want to store this file" and restart the server.
Tip: Make sure that the server is not running when you are trying to add the argument.
You should have log4j or similar logging framework in place.

Categories

Resources