struts2,log4j,classloader,slf4j,nosuchmethoderror , Struts startup failed due to logging errors


Struts startup failed due to logging errors

Question:

Tag: struts2,log4j,classloader,slf4j,nosuchmethoderror

Struts application can not start with log4j. What is wrong? Here is log4j.properties

# Direct to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

# Root logger option
log4j.rootLogger=INFO, stdout

# Good for troubleshooting
log4j.logger.org.hibernate=INFO

# Log JDBC parameters
log4j.logger.org.hibernate.type=ALL

Struts startup failed due to logging errors.

INFO: Starting Servlet Engine: Apache Tomcat/7.0.55
апр 28, 2015 3:42:01 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
    at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:120)
    at com.opensymphony.xwork2.util.logging.commons.CommonsLogger.info(CommonsLogger.java:42)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:175)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:234)
    ...

апр 28, 2015 3:42:01 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
апр 28, 2015 3:42:01 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/Struts2HiberQuize_last] startup failed due to previous errors

Answer:

Your application server is failing to start due to problems with SLF4J (Simple Logging Facade for Java), not Log4j. You are probably:

  1. including an old version of SLF4J, or
  2. mixing multiple versions of SLF4J (one of which old), or
  3. there is an old SLF4J version in the application server's shared libraries.

To fix this,


Related:


Complex headers via Display Tag in struts2


struts2
I have to create a table using display:table tag, whose structure is like this <display:table name="ReportList" cellpadding="0" cellspacing="0" > <display:column property="claimType" title="Claim Type" sortable="true" /> <display:column property="claimno" title="Claim Number" sortable="true" /> <display:column property="billStatus" title="Bill Status" sortable="true" /> <display:column property="transNo" title="Transaction Number" sortable="true"/> </display:table> Now It is Display like this...

Struts2 autocompleter of struts jquery tag not taking another value other then of list after setting forceValidOption to false [duplicate]


java,jsp,autocomplete,struts2,struts2-jquery
This question already has an answer here: Struts 2 jquery autocompleter with forceValidOption=“false” 1 answer I have a jsp file in which i have a struts autocompleter box of struts jquery plugin. This box is not taking any other value which is not in the autocomplete list after setting...

How to use log4j in REST Service


java,rest,log4j
I have tried using log4j in REST client and it logs the information. However, I have tried to log the events server side using log4j and it dose not record any logs. Here is my sample where I have used on my server side. @POST @Path("/send") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response...

monitor log4j behaviour under load


logging,concurrency,io,log4j
I want to test my J2EE application under high load of sessions accessing different pages. This web application uses Log4J to log bunch of errors,warnings and infos. I want to test what is the side effect of this load on writing log files, especially concurrent I/O writing actions. I found...

Struts2 jqGrid Refresh Button Text


jquery,struts2,jqgrid
I have a Struts2 jqGrid on a page. I have the nav bar with the standard refresh button in the default location. My users want the mouse-over text of the button to be "Refresh" instead of the default "Reload Grid". I haven't not been able to find an attribute to...

Struts 2 add exception mapping for certain actions


java,exception,struts2,struts-config
Consider a project with lots of annotated actions. public class TransferMoney(){ @Action("transfer-money-show-form") public String showForm(); @Action("transfer-money-confirm") public String confirmForm(); @Action("transfer-money-result") public String result(); } I want to add exception-mapping to confirmForm so I can do it as: @Action(value = "transfer-money-confirm", exceptionMappings = {@ExceptionMapping( exception = "java.lang.Exception", result = "exception") }...

Log4j Implicit String Formatting


java,logging,log4j,string-formatting
I am using log4j v1.2.14 for logging in my project and I am also using Java 7 String.format() to put variables in my output. Currently I am writing LOGGER.info(String.format("Your var is [%s] and you are [%s]", myVar, myVar1)); Is this really the best way to output strings? I feel that...

Setting log4j.rootLogger=OFF in one class configuration, will cause log crash in another class


java,logging,log4j
Setting log4j.rootLogger=OFF in one class configuration, will cause another class to not log. I have two sample classes: LogCrasher and MainLogger. This two classes are configured to log some test logs. Each class have it's own configuration file. LogCrasher was called from MainLogger. When log4j.rootLogger in LogCrashers log4j configuration file...

For loop issue in Struts 2


java,jsp,struts2,ognl
I found below code in JSP at somewhere. <% int cnt =1; for(int i=1;i<=iTotalweeks;i++) { %> <tr> <% for(int j=1;j<=7;j++) { if(cnt<weekStartDay || (cnt-weekStartDay+1)>days) { %> <td align="center" height="35">&nbsp;</td> <% } else { %> <td align="center" height="35" id="day_<%=(cnt-weekStartDay+1)%>"><span><%=(cnt-weekStartDay+1)%></span></td> <% } cnt++; } %> </tr> <% } %> Now I'm doing...

log4j creates log file but does not write the messages that I am creating


java,logging,log4j,filewriter
Log file is getting created and logs are getting written into it.But , it doesn't write the things that i specify in LOG.trace("") and LOG.error("") etc. log4j.rootLogger=INFO,R # Direct log messages to stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss}%-5p %c{1}:%L - %m%n log4j.appender.R=org.apache.log4j.RollingFileAppender...

Struts2 Form submission with asynchronous jQuery ajax not working


jquery,ajax,struts2
I am trying to make a simple asynchronous Struts2 form submission using jQuery ajax feature. However, whatever i try, the jquery is not getting triggered. Normal form submission is working smoothly but i need an asynchronous call which can fetch result from server without reloading page. I have already tried...

How to ignore Liferay user removed from LDAP errors?


ldap,log4j,liferay,liferay-6,openldap
I have a Liferay 6.1 instance that is connected to LDAP. New users get imported nicely, but when I remove a user from the LDAP directory, Liferay starts throwing exceptions when it tries to sync users from LDAP. These seem to be safe to ignore, but they produce several megabytes...

Struts namespaces and WEB-INF folder


java,jsp,tomcat,struts2
I want to put view.jsp file in WEB-INF folder. it lies in WEB-INF\user\view.jsp <package name="user" extends="struts-default" namespace="user"> <action name="view" class="com.example.user.ViewUserAction"> <result>/WEB-INF/user/view.jsp</result> </action> </package> but Struts changes this url to application/user/WEB-INF/user/view.jsp so as I understand if my namespace is not "/ " I will never visit the jsp in WEB-INF ?...

Restriction on number of opened tabs


javascript,jsp,web,struts2,browser-tab
There are some links on web-page. On right click there is option of 'open link in new tab'(browser option). I want to restrict user for not opening more that two tabs? How can i do this? <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">...

Log4j - log ALL levels except ERROR


logging,log4j
Is there any way to achieve it? I mean what I want in my application is that it should log messages from all levels including debug and trace logs. The obvious way to achieve this is to set level to ALL. But I don't want to see any log of...

iOS send a string like “2015-01-01” to server and get ParseException


java,ios,ajax,json,struts2
My question is not same as that question about get date from JSP. Now I have a server using Struts 2.2.1 And the action is like this public class AddMeetingAction extends ActionSupport{ private A a; @Override public String execute() throws Exception { .... } //getter and setter.. } And the...

How to perform XML Validation when using ModelDriven?


java,xml,validation,struts2,model-driven
I've created a Struts2 project in which I used XML based validation. Model class RegistrationForm is shown below package com.projects; import com.opensymphony.xwork2.ActionSupport; public class RegistrationForm implements Serializable{ private static final long serialVersionUID = 1L; private String fname; private String lname; private int numbr; public int getNumbr() { return numbr; }...

Struts exclude pattern with spring


java,spring,spring-mvc,servlets,struts2
I did a lot of homework before coming here to the experts , appreciate any pointers on my question I need to run a merged (not integrated) app that was basically combined version of struts2 and Spring and some base servlets. Was able to get the combined war file up...

What is equivalent Struts 1.3 tags for


java,html,struts2,struts,struts-1
I want equivalent Struts 1.3 tag for <s:property value="Content" escapeHtml="false" /> Currently I am trying something like <bean:write name="MyForm" property="Content" filter="false" ></bean:write> I want to hide/remove HTML tags from My Content - I am having data from CKEditor which is combination of HTML tags....

any additional advantages to user SLF4J library instead of apache log4j


java,apache,logging,log4j,slf4j
I came across this library for logging slf4j in my assignment. I have used apache log4j library before but from the documentation I could not understand the use case for the slf4j library. (face palm) Can any one tell me the advantages of using SLF4j or possible real world cases....

Struts2 + Log4j2


java,struts2,log4j2
I'm developing a Struts2 webapp and i was setting up the logger. In the official documentation there is only the configuration for log4j, but nothing about log4j2. I started looking around and seems that Struts2 does not support log4j2. But the last question i've found is this one: Log4j2.0 is...

Scope attribute migration from Struts1 to Struts2


java,struts2,migration,struts-1
I am migrating an application from Struts1 to Struts2. I could migrate everything except the scope attribute from the below action tag of the Struts1 configuration file (struts-config.xml). Struts1 configuration: <action path="/DomainAndIPBlocking" type="com.tarangtech.da.struts.action.DomainBlockedListAction" name="DomainBlockForm" scope="session" input="/DomainAndIPBlocking.do" validate="false"> <forward name="success" path="/jsp/SystemAdminConsol/DomainBlocking.jsp"/> </action> Migrated Struts2 configuration:...

Using to dynamically build element's name


jsp,struts2,iterator,ognl,struts-tags
I want to reuse a set of HTML field elements and have struts build 'name' attributes from a variable. I saw this How To Generate unique HTML id attributes within Struts 2 iterator tag and figured I could use something similar but can't get it to work. It seems I...

Struts2 / jQuery: resume link href redirect after e.preventDefault();


jquery,jsp,struts2,preventdefault
On my Struts2 application, I have some buttons that will delete items from a table. So far, so good. Now, I'm trying to use jQuery to present the users with an alert to confirm if they really want to delete the chosen item. To do this, what I have in...

Struts 2 get Json from DAO into the action class


java,jquery,sql,json,struts2
I have some unique probably understanding issue. I have jQuery Ajax call which call Struts2 action class which in turn calls DAO to get some data. However for some reason I do not get any data or any error, just a blank response when I add DAO operation in action...

Write multiple log4j files with different info


java,log4j
The API I am working on cannot be connected to a database, but need to log events that are happening in the API. To do this I was thinking on using log4j to create log file with API event information. The problem is that all log entries end up in...

slf4j trace vs debug used with log4j


java,logging,log4j,slf4j
From the log4j documentation I know that these are the levels in the h http://logging.apache.org/log4j/1.2/manual.html TRACE, DEBUG, INFO, WARN, ERROR and FATAL Fatal being the top level. But could not understand the difference between Trace and debug. I have tried with setting the log level to debug and I can...

Struts2 jqGrid DatePicker in Column Filter


jquery,jsp,struts2,jqgrid,datepicker
I have a jsp running Struts2 jqGrid plugin. I have enabled the filter row at the top of the grid, one of the columns is a date column and I want to be able to change the textbox at the top of the column into a DatePicker. The id of...

Hiding param of struts.xml values in Struts 2


java,url,struts2,passwords,url-parameters
Is there any way to hide the param values in struts.xml as they are visible on the URL when I pass them from one action to another? <action name="BackToManagerIndex" class="Action.LoginAction" method="ManagerList"> <result type="redirectAction"> <param name="actionName">login</param> <param name="namespace">../Manager</param> <param name="User_Id">%{User_Id} </param> <param name="Password">%{Password}</param> </result> Here when ever the BackToManagerIndex action is...

Unable to load bean using Struts convention plugin


java,maven,tomcat,struts2,struts2-convention-plugin
I want to use annotation based config instead of xml based. Struts has convention plugin to do this kind of thing. So I removed struts.xml file in main/resources, added this plugin as dependency, put some annotations on actions and tried to run my project on a server (Tomcat 7). When...

Struts 2 autocompleter not working as dropdown


java,jsp,struts2,struts,struts2-jquery
I have a JSP page in which I have use sx:autocompleter. It is working but at the time of typing in textbox, suggestions are not coming in dropdown, they are coming as completing the word. Like this What is the problem here ? ...

Can Struts 2.3 be used with Struts 1.3?


struts2,struts,struts-1
we have 2 applications (Say AppA and AppB) that use Struts 1.3. I want to upgrade AppB to use struts 2.3, however I cannot make changes to AppA so it will have to remain in Struts 1.3. The problem is that AppB has some dependencies on AppA such as extending...

How to pass parameters to an action by a post or ajax call in jQuery?


javascript,jquery,struts2
My intent is to pass a couple of parameters to an action in struts2, but I want that these parameters have to be hidden, so the GET call is not recommended. I thought that a post or ajax call in jQuery could be a good idea to do so, but...

Onchange in Struts2 textfield


java,javascript,jquery,jsp,struts2
I want to get all records from DB to JSP based on a string what I enters in S2 textfiled. While typing in textfiled only I want to get those all records as a table in JSP. Ex: In textfiled, while I typing 'a' then I want to display all...

org.hibernate.exception.ConstraintViolationException: could not execute statement


java,hibernate,struts2
So this is the case.. I am creating a web application using struts2 and hibernate. I am creating a change password page by which a user can change his password. But I am getting error as "org.hibernate.exception.ConstraintViolationException: could not execute statement".. Below is my code and stack trace. //JSP <%@page...

How to hide the “action” extension


struts2,struts-config
When user makes login then on success browser redirect to http://appname.com/main.action How can I make so that adress line will looks like http://appname.com/main <action name="login" class="user.action.LoginAction" method="execute"> <result name="success" type="redirectAction"> main </result> <result name="error">/login.jsp</result> </action> ...

Change default location of struts.xml in Struts2


java,xml,struts2,web.xml,servlet-filters
I've created a Struts2 project which is working fine when I place my struts.xml file inside src directory. Below is my web.xml configuration. <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>struts2project</display-name> <filter>...

struts dialog box not taking jsp scriplet


java,jquery,jsp,struts2,ognl
I am using struts dialog box in a jsp page. I want that id of each dialog box should be dynamic. For that I am doing this code - <% int counter = 0; %> <s:iterator var="RP" value="campaignList" status="currRow"> <% counter++; %> <sj:dialog id="DivQuestionAnswer<%=counter%>" autoOpen="false" modal="true" width="750" cssStyle="font-size: 15px;" title="Question...

How to not-abbreviate the source class name in spriing-boot's loggger name?


log4j,spring-boot
When I run a spring-boot application, it shows the following log: 2014-03-05 10:57:51.702 INFO 45469 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] The logger name is abbreviated for the following: org.springframework.boot.context.embedded.FilterRegistrationBean How can I show the full source class name for it? Thanks!...

HtmlUnitDriver writes logs in my personal Log4J files


java,log4j,htmlunit,htmlunit-driver
I wrote crawlers for 3 different sites and run the crawlers in 3 threads. For each crawler I use single logger. My 'log4j.properties' file looks like: log4j.rootLogger=TRACE, ZDNET, CNET, GOOGLEPLAY log4j.appender.ZDNET=org.apache.log4j.RollingFileAppender log4j.appender.ZDNET.File=logs/zdnet.log log4j.appender.ZDNET.MaxFileSize=20MB log4j.appender.ZDNET.MaxBackupIndex=100 log4j.appender.ZDNET.layout=org.apache.log4j.PatternLayout log4j.appender.ZDNET.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p - %m%n...

Create a hyperlink to a project file in console output


java,intellij-idea,hyperlink,console,log4j
Is there a way for me to write out a link to the console output that when clicked on directs to a project file in Intellij? For example, this happens when a run-time exception occurs. I see the stack trace and I can click on a link in the console...

Two logs for one class


java,log4j
I'm working on jdk 1.6 and I have a class that needs to log to 2 different log files using log4j. I have read many other answers, but I can't get mine to work the way I want it. This is my log4j properties. log4j.debug=false log4j.rootLogger=ERROR, appLog log4j.logger.com.my.apps.idm.transactionalemail=DEBUG, appLog, infoLog...

How to configure Log4j (1 or 2) to use custom log file name while code against Slf4j


java,multithreading,log4j,slf4j
I know there has been a lot of question related to this, but i couldn't find one that matches on the scenario that i'm looking at, so here's the question. Current logging setup: logger coded using Slf4j with Log4j 1.2 bindings. DailyRollingAppender used. The program: A multi-threading backend Java program...

Set default value for struts 2 autocompleter


jquery,jsp,struts2,struts2-jquery,struts2-jquery-plugin
I have implemented a struts 2 autocompleter in which i have used a list of String like this - <sj:autocompleter id="cityId" cssClass="txtfield8" name="outlet.cityName" list="cityList" autoComplete="true" forceValidOption="false" /> How can I set a default value for this, so that every time it loads, a default value will be shown ?...

Node.js with struts Possible? [closed]


java,javascript,node.js,struts2
Now i know i might come out to be very silly at asking this. But I am a complete newbie to node.js and i have done some reading about node.js, and so much unstructured info on the internet has only confused me further. I have a small web application with...

Java Struts2 (Action class not found)


java,xml,jsp,struts2
The error which I am getting. It was running all fine a day before but when open it today I get the following errors. Action class [com.tutorialspoint.struts2.HelloWorldAction] not found - action - file:/C:/Users/sai/Struts2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HelloWorldStruts2/WEB-INF/classes/struts.xml:10:30 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:374) at...

Set log4j.properties for GWT


eclipse,gwt,log4j
GWT compiles and creates thereby log4j.properties in WEB-INF/classes. The problem is that I can't change the settings as it gets generated and overwritten all the time. How can I set log4j settings in Eclipse using a GWT project?...

Struts2 - passing data from jsp form fields with same name to action class


jsp,struts2,struts-action
In my struts form I have couple of fields (textfields) with the same name. They all carry the same information (through js change event). However, in the action class, they are imported as comma separated values instead of the value once. Here is a snippet from item.jsp: <s:select label="Part of...

Struts 2 could not find a result for success returned from an action


java,osx,jsp,netbeans,struts2
I'm not a native English speaker, so my apologizes if I made some idiomatic mistake. I'm completely new on Struts2. I developed a web project that contains 3 JSP pages, a deployment descriptor (web.xml), a struts configuration file (struts.xml) with 2 actions configured inside (an action named index and an...

How to call MySQL view in Struts2 or Hibernate


java,mysql,hibernate,java-ee,struts2
I have a view in MySQL database CREATE VIEW CustInfo AS SELECT a.custName, a.custMobile, b.profession, b.companyName, b.annualIncome FROM customer a INNER JOIN cust_proffessional_info b ON a.cust_id=b.cust_id Is there any way that i can call this view using Struts2 or in Hibernate. I have tried to search it but could not...