I'm new to spring MVC 4 and I have a problem- Each time I start a new project there is something wrong with the configuration which results in a 404 when I try to work with my controllers.
I there a way to see some logs which will make things more clear as to what I did wrong? I work with tomcat and I looked into his "logs" folder and there was nothing there...
I suggest you to use remote debugging from your Eclipse IDE, or debug the application from within the IDE. then you can debug the code line by line and see what is going wrong.
For Spring application development Spring Tool Suit has more support for developing Spring Applications.
EDIT:
You can also configure your Log level in Tomcat Environment. See this article for more information to change your configuration of logging accordingly (Run on DEBUG mode)
Related
I have a filter used for authorization. It's the first step entering application. Without it is not possible to do anything in the application.
I set a systemout on the very first line of doFilter method to monitor the behaviour, so comparing websphere server log files I'm sure that filter (same Ear deployed) on Test environment works and on Production environment not.
Maybe it's server configuration issue...?
I have access to read and modify WAS Console of test environment.
I have access only to read WAS Console of production environment.
So I can compare them, and maybe test some change on test environment to replicate the behavior and say to production administrator what exactly setup....
Any suggestion on which setting I can check (Was console, maybe in relation with Web.xml, etc...)?
Thx a lot for any suggestion.
EDIT
I was able to retrieve via FTP the EAR in InstalledApps of Production environment. I noted a file named "web_merged.xml" in which is missing the entry of the filter.
Maybe the problem is here? When is created and why? Why could be missing the entry there? How let WAS to create the right file (if the problem is there)?
The problem was the one on the EDIT in the question, webmerged.xml was wrong. We weren't able to understand why WAS generated this file in wrong way.
What I understand is generated during deploy and is a mix of web.xml of the applicatin with application server configuration.
That's a WebSphere issue, we guessed it has to do with application server cache. We asked to System Administrator to:
Uninstall the application
Stop the server in which the application was installed
Clear the cache
Restart the server
Reinstall application
From this point the file was generated in the right manner, as the application bahaviour.
Websphere version is 8.5
I know that this is a very trivial question but please suggest me to find the way. Sometimes when I start Spring Boot server, it stops but it does not display the complete error/exception stack trace. Think of situation that spring boot server has been started in 8080 port and if somebody starts in 8080 port, it should clearly display that java.net.BindException. But in my case server simply aborts.
I normally find the issue from the IDE like eclipse/Idea when I start the server in debug mode. But how to find the error when somebody starts spring boot server using command prompt ? There may be many errors for which spring boot is unable to start. My question is what configurations should be added in application.properties to know more details about the error/s for which spring boot is not getting started. Currently I am using Spring Boot 2.1.1.RELEASE version. Please help me fix this.
To see more details of the actions being carried out for a spring boot application, change the log level to debug. You can do it just by simply adding below lines in application.property/yaml file.
logging.level.=DEBUG
Or for web applications you can try
logging.level.org.springframework.web: DEBUG
Add the below property in application.xml - worked in Spring boot 2.2.4
logging.level.root:ERROR
The application is developed on Spring Boot 2.0.1.
I include the next dependency to be able to use JavaMelody -
dependency("net.bull.javamelody:javamelody-spring-boot-starter:1.72.0")
JavaMelody configuration:
javamelody:
advisor-auto-proxy-creator-enabled: false
init-parameters:
url-exclude-pattern: (/webjars/.*|/css/.*|/images/.*|/fonts/.*|/js/.*)
As a result I have a performance monitoring system and completely broken integration tests (JUnit version is 5).
The exception message is
the configured DataSource [com.sun.proxy.$Proxy128] (named '') is not the one associated with transaction manager [org.springframework.orm.jpa.JpaTransactionManager] (named '').
It can be fixed by removing javamelody dependency or by disabling javamelody in config file of the application.
Does somebody know the cause of the issue? Doesn't it create some unobvious bugs out of tests' scope?
I faced the same issue. I found a solution. I checked the Java melody jar file and they have a spring.factories in there. I think this might be messing around with the configurations.
In the application-test.properties I added this:
spring.autoconfigure.exclude=net.bull.javamelody.JavaMelodyAutoConfiguration
and it seems to work.
add
spring.autoconfigure.exclude=net.bull.javamelody.JavaMelodyAutoConfiguration
in application.properties can help.
I wanted to implement logging for my web services.I have been playing around with Log4j. It's a really cool logging framework when it works.But when it doesn't , it's a pain to debug.
My problem is that i am trying to log to the database , but for some reason I don't see anything being logged to the table. I have no clue whats causing this.
In my log4j.xml i have the following line
<log4j:configuration debug="true"
xmlns:log4j='http://jakarta.apache.org/log4j/'>
But when i deploy and run my web service in the debug mode in Eclipse , I don't see logging related debug statements on the console.
I want to be able to see
log4j initializing and configuring the loggers. So if anything is wrong with my xml configuration i would know immediately.
log4j logging to the destination , in this case to the database. If there is a some kind of a sql/database exception I would know.
I am logging at the application level (the application is using its own log4j jar and configuration files as opposed to using the application servers logging mechanism)
My project uses log4j-1.2.17 , Eclipse Luna 4.4.0, JBoss EAP 6.4.0.
Can our log4j experts suggest ways to effectively debug log4j itself. Are there Eclipse plugins that can help alleviate the pain.
Platform I am using:
Fedora 20;
mariadb-5.5.34-2.fc20.x86_64;
Eclipse Kepler Service Release from www.eclipse.org
I am implementing example
See here
and I am trying to manage to work the login interface.
Actually I am configuring TomEE to use JAAS auth technology.
Since I am having some troubles, I would like to solve them with the help of Eclipse debugging mode. To do that, I:
setted breakpoint at line number 79 of LoginController.java;
started TomEE in debug mode;
executed login.xhtml in debug mode too;
My problem is that I see nothing in debug mode: no variables, etc.
How is it possible? I have been using debugging mode for a long time, but it is my first time in web development.
Project archive
Click here for a larger Screenshot
The webpage bean has not been istantiated for an unknown reason. I opened a new question to fix it.
Bean not instantiated