I'm running STS on a mac (10.11.5 El Capitan).
I created a basic Spring Boot application which needs to read an external log4j.properties file on my file system.
I created a folder on my machine, set a system variable (LOG_CONFIG_HOME) in ~/.bash_profile and when i 'echo $LOG_CONFI_HOME', i see the correct path.
In the Boot application.yml file, i have this:
...
logging:
config: ${LOG_CONFIG_HOME}/log4j.properties
...
When I run this as a Spring Boot application, i get
'Could not resolve placeholder 'LOG_CONFIG_HOME' in string value "${LOG_CONFIG_HOME}/log4j.properties".
I searched stack & googled trying to solve this.
One suggestion was to restart eclipse. I did that but still the error persists.
Another was to run 'eclipse' from the command line b/c otherwise, it doesn't have access to system variables (???). Doesn't seem legit - i tried to do this but in the STS folder, all i have is STS.app so no clue how to run this from the command line.
I even restarted my machine.
What do i have to do to fix this? This application (with the externalized log config) has to also run on windows as well, so any mac-specific tricks won't work.
Related
I had a working project, but suddenly it stopped running
I'm launching the TomCat 9.0.60 via cargo plugin version 1.10.1.
After "mvn clean package cargo:run" an exception occurs when restarting:
"org.codehaus.cargo.container.ContainerException: Failed to create a Tomcat 9.x standalone configuration: Invalid configuration dir [/target/cargo/configurations/tomcat9x]. When using standalone configurations, the configuration dir must point to an empty directory - Except if the configuration was created by Cargo."
I not understand what happends.
Why it occurred and what needs to be done to fix it.
In our project, we used another plugin (sass-maven-plugin) to create a file in the target/load/configuration/tomcat9x
As a result
, sass-maven-plugin created a file inside "target/cargo/configuration/tomcat9x". cargo-maven3-plugin thought that the "target/cargo/configuration/tomcat9x" directory was already configured by him and did not add the necessary files. Appeared "org.codehouse.cargo.container.ContainerException: Failed to create a Tomcat 9.x standalone configuration".
variants to fix:
create a file in ".cargo" in "target/cargo/configuration/tomcat9x"
do not create files in target/cargo/configuration before the container starts. After the container starts, you can create files
i have installed Jenkins on Windows 10 and each time i try to execute a maven project or just try to execute mvn clean test (command line), Jenkins decides that my new workspace should be: C:\Windows\system32\config\systemprofile\eclipse-workspace\ while my project is in C:\Users\username\eclipse-workspace.
Jenkins starts in the directory C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins.jenkins\workspace\projectName and even if i run a cd command i will have this problem:
The driver executable must exist:
C:\Windows\system32\config\systemprofile\eclipse-workspace\projectname\drivers\chromedriver\chromedriver.exe
My chrome driver is not there obviously but it's in C:\Users\userName\eclipse-workspace\projectName\drivers\chromedriver.
It looks like than Jenkins changes my user.home.
I went to config file and set:
<workspaceDir>C:\Users\userName\eclipse-workspace</workspaceDir>
but it's still looking for the driver in C:\Windows\system32\config\systemprofile\eclipse-workspace\projectname\drivers\chromedriver\chromedriver.exe
This part: C:\Windows\system32\config\systemprofile\ is obtained using in Java System.getProperty("user.home"). Running it with Jenkins seems to modify it.
Why is it looking for my driver there?
Why can't it just stick to my workspace folder?
How can i solve this?
Thank you
I think i solved it. I was running under Local System Account
https://jenkins-le-guide-complet.github.io/html/sect-windows-service.html#fig-hudson-windows-service-config
I had edit the service as shown in the link.
Before I explain the problem, I just want to point out that I am completely new to NetBeans and Tomcat and I am doing a school project. That being said, the problem is exactly what the title says. Here is the output when I try to run a simple Hello World jsp:
In-place deployment at
C:\Users\lostl\OneDrive\Documents\NetBeansProjects\Project3\build\web
Deployment is in progress...
deploy?config=file%3A%2FC%3A%2FUsers%2Flostl%2FAppData%2FLocal%2FTemp%2Fcontext7180600714574256491.xml&path=/Project3
FAIL - Failed to deploy application at context path [/Project3]
C:\Users\lostl\OneDrive\Documents\NetBeansProjects\Project3\nbproject\build-impl.xml:1058: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 0 seconds)
I am using Apache NetBeans 11.2 and Tomcat 9 if it is relevant.
Here is what I tried:
I checked the server log and it displays absolutely nothing.
I tried setting the context path directly to Project3 (i.e. including the -C:/... before Project3) in the context.xml file under META-INF folder.
I tried restarting NetBeans and cleaning and building the project.
I tried running NetBeans under admin privileges.
I might seem like such an idiot for not knowing how to fix this since no one else seems to have this problem, but please help me out.
If you have installed the Apache Tomcat appart from Netbeans, maybe your apache service is already running and it conflicts with Netbeans. You may stop the apache service and then run the application in Netbeans.
Because Netbeans start the apache service in a diffent way, so you don´t need to install the aplication on apache´s folder.
Check out the Windows Services (Services App) and stop the Apache Tomcat if running, then from Netbeans menu select Run->Run Project. Netbean will start Tomcat and deploy your web app onto the Tomcat server.
I fixed it. All I had to do was restart my computer. I feel so dumb.
clean your project if clean project failed to delete some file then,
Just check there must be a java process running at background.
If you are using windows 10 then follow these steps
open command prompt and type below commands
tasklist | findstr java (hit enter now you can see a task list with pid number )
taskkill /F /PID "PID_OF_JAVA_PROCESS" (where PID_OF_JAVA_PROCESS--> task pid hit enter)
now run the project again
I faced this problem and found a solution. It is very simple. All you need to do is stop the Tomcat services or restart your computer and run your program.
i don't know where is the problem i installed eclipse oxygéne in a new machine and while trying to run any application (spring boot application) it shows me this error : error:invalid or corrupted jarfile .m2\repository\org\aspectj\aspectjweaver\1.8.9
and i am new with ECLIPSE IDE i want to know how to fix this please if anyone knows a solution
[1]: https://i.stack.imgur.com/DjYnB.png
Clear local cache and then run again is one of many ways to get rid of your problem
or run with mvn -U clean install
-U forces to load from server.
I want to install my tomcat v7.0.12 as a service on my Windows 2008 Server.
On the tomcat page I found this tutorial. But there isn't a service.bat file in my installation dir.
In the service overview of WS2008 it isn't possible easily create a new service like new->service ...
To Start Tomcat7 Service :
Open cmd, go to bin directory within "Apache Tomcat 7" folder. You will see some this like C:\..\bin>
Enter above command to start the service: C:\..\bin>service.bat install. The service will get started now.
Enter above command to start tomcat7w monitory service. If you have issue with starting the tomcat7 service then remove the service with command : C:\..\bin>tomcat7 //DS//Tomcat7
Now the service will no longer exist. Try the install command again, now the service will get installed and started: C:\..\bin>tomcat7w \\MS\tomcat7w
You will see the tomcat 7 icon in the system tray. Now, the tomcat7 service and tomcat7w will start automatically when the windows get start.
You can find the solution here!
Install the service named 'Tomcat7'
C:\>Tomcat\bin\service.bat install
There is a 2nd optional parameter that lets you specify the name of the service, as displayed in Windows services.
Install the service named 'MyTomcatService'
C:\>Tomcat\bin\service.bat install MyTomcatService
Looks like now they have the bat in the zip as well
note that you can use windows sc command to do more
e.g.
sc config tomcat7 start= auto
yes the space before auto is NEEDED
I just had the same issue and could only install tomcat7 as a serivce using the "32-bit/64-bit Windows Service Installer" version of tomcat:
http://tomcat.apache.org/download-70.cgi
I have spent a couple of hours looking for the magic configuration to get Tomcat 7 running as a service on Windows Server 2008... no luck.
I do have a solution though.
My install of Tomcat 7 works just fine if I just jump into a console window and run...
C:\apache-tomcat-7.0.26\bin\start.bat
At this point another console window pops up and tails the logs
(tail meaning show the server logs as they happen).
SOLUTION
Run the start.bat file as a Scheduled Task.
Start Menu > Accessories > System Tools > Task Scheduler
In the Actions Window: Create Basic Task...
Name the task something like "Start Tomcat 7" or something that makes sense a year from now.
Click Next >
Trigger should be set to "When the computer starts"
Click Next >
Action should be set to "Start a program"
Click Next >
Program/script: should be set to the location of the startup.bat file.
Click Next >
Click Finish
IF YOUR SERVER IS NOT BEING USED: Reboot your server to test this functionality
There are a lot of answers here, but many overlook a few points. I ran into the same issue and it was likely due to a combination of being a complete neophyte when it comes to tomcat. Even more I am rather new to web servers in general. I consider myself somewhat proficient user of windows, but I guess not proficient enough. In particular I don't work with services too much.
I did not have a startup.bat or any bat files. I only downloaded the 32-bit/64-bit Windows Service Installer. The bin that is created for that download is small - only 4 files. My colleagues were surprised that I did not have a catalina.bat etc... and I was too. Only the below four files in the bin. And no %CATALINA_HOME% or %TOMCAT_HOME% etc...
bootstrap.jar
tomcat-juli.jar
Tomcat7.exe
Tomcat7w.exe
With this setup I had some frustrations as setting parameters is done via the gui widget - very helpful I might add.
So nearly all the answers I have perused were not immediately applicable as many said, "go to bin and issue the startup.bat file" I am a neophyte but not so much to not be able to look into the bin and start such a file it is existed!
For my simple purposes (again remember that I am a neophyte at tomcat and even web servers) all I wanted to do was to be able to startup and shutdown the tomcat server from a cmd prompt window. Nothing too heavy duty. I am embarrassed to say how simple it is. It is probably evident to anyone with a shred of experience with services and such.
To Start server: <Tomcat Root>/bin>Tomcat7.exe start
To Stop server: <Tomcat Root>/bin>Tomcat7.exe stop
Found here - http://crunchify.com/how-to-start-stop-apache-tomcat-server-via-command-line-setup-as-windows-service/
I did not realize there was a separate download the 64-bit Windows zip file that has a tomcat server and all the standard array of cmd line tomcat management tools. This zip file has all the common startup/shutdown scripts, batch files for windows, including catalina.bat/.sh etc... Then all the above answers make sense and are rather trivial.
Remember I am a neophyte when it comes to tomcat and web servers. It appears these two downloads are somewhat mutually exclusive in the sense that if I download and install the 32-bit/64-bit Windows Service Installer version and the 64-bit Windows zip file the startup.bat file in the 64-bit Windows zip file version will not run or interact with the 32-bit/64-bit Windows Service Installer tomcat instance. But I am not sure about this point.
Edit service.bat – Swap two lines so that they appear in following order:
if not “%JAVA_HOME%“ == ““ goto got JdkHome
if not “%JRE_HOME%“ == ““ goto got JreHome
Open cmd and run command service.bat install
Open Services and find Apache Tomcat 7.0 Tomcat7. Right click and Properties. Change its startup type to Automatic (with delay).
Reboot machine to verify if the service started automatically
its done through service.bat file in apache tomcat7
visit this blog ..
install tomcat7 on windows
I had a similar problem, there isn't a service.bat in the zip version of tomcat that I downloaded ages ago.
I simply downloaded a new 64-bit Windows zip version of tomcat from http://tomcat.apache.org/download-70.cgi and replaced my existing tomcat\bin folder with the one I just downloaded (Remember to keep a backup first!).
Start command prompt > navigate to the tomcat\bin directory > issue the command:
service.bat install
Hope that helps!