EM. Lashkar

Greenhorn
+ Follow
since Jan 31, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by EM. Lashkar

Took away crimson.jar from the classpath so that it uses xerces.jar, restarted the server & it works fine now.
Summery:
If one sees this message
"Valid documents must have a <!DOCTYPE declaration.", 2 possibilities :
1. malformed XML file
2. XML file not found ( silly, one should expect a FileNotFound exception)
For the malformed XML make sure:
1. Encoding is correct (if none mentioned , then guesses UTF-8)
2. There is no non Unicode character in the XML doc
Details here:
http://forum.java.sun.com/thread.jsp?forum=34&thread=499493&start=15&range=15&hilite=false&q=
Hi ,
I am at a loss when I read the following message in my system.out log.
log4j:WARN Parsing error on line 1 and column -1
log4j:WARN Valid documents must have a <!DOCTYPE declaration.
log4j:ERROR Parsing error on line 1 and column -1
log4j:ERROR Document root element is missing.
log4j:ERROR Could not parse input source [org.xml.sax.InputSource@6d45d02d].
org.xml.sax.SAXParseException: Document root element is missing.
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3035)
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3023)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:304)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:179)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:665)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:584)

in WEB-INF/lib I have:
crimson.jar jaxp.jar jconfig.jar log4j-1.2.8.jar xerces.jar
in WEB-INF/classes I have:
log4j.dtd
The container is WEBSPHERE 4.06 AE.
I copied the needed xml, dtd & the jar files from an application where log4j is working fine.
Is log4j suppoesed to use the crimson purser or the SAX ?
Any suggestion is appreciated.
Thanks.
_ml
Here is the simple config file :
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>

<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
<param name="File" value="/opt/WebSphere/AppServer/installedApps/GTS_WebSphere_Development_Cell/GnoTelecom.ear/GNOTelecomWEB.war/logs/stdOut.log"/>
<param name="Threshold" value="warn"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ddMMMyy HH:mm:ss} %-5p %c %x - %m%n"/>
</layout>
</appender>



<appender name="WEBAPP_ACTIVITY_LOGFILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/opt/WebSphere/AppServer/installedApps/GTS_WebSphere_Development_Cell/GnoTelecom.ear/GNOTelecomWEB.war/logs/activity.log"/>
<param name="Threshold" value="ALL"/>
<param name="maxFileSize" value="1000KB"/>
<param name="maxBackupIndex" value="3"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ddMMMyy HH:mm:ss} %-5p %c %x - %m%n"/>
</layout>
</appender>

<appender name="WEBAPP_ERROR_LOGFILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/opt/WebSphere/AppServer/installedApps/GTS_WebSphere_Development_Cell/GnoTelecom.ear/GNOTelecomWEB.war/logs/errorWarning.log"/>
<param name="Threshold" value="ALL"/>
<param name="maxFileSize" value="1000KB"/>
<param name="maxBackupIndex" value="3"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ddMMMyy HH:mm:ss} %-5p %c %x - %m%n"/>
</layout>
</appender>


<logger name="WEBAPP">
<appender-ref ref="WEBAPP_ACTIVITY_LOGFILE"/>
</logger>

<logger name="WEBAPP.ERROR">
<appender-ref ref="WEBAPP_ERROR_LOGFILE"/>
</logger>



<root>
<appender-ref ref="STDOUT"/>
</root>


</log4j:configuration>
[ March 29, 2004: Message edited by: EM. Lashkar ]
Hi ,
I have a web application ( DBBeans --Servlet --JSP) .
I need to incorporate a functionality such that:
if the admin needs to send out a message to the app-logged in users , for example : "Application will shutdown in 10 mins. Please save your work and logout of the app: Message8" and can control the number of times this message is shown to a any users, how can I do that in the app without using a full blown messaging service (JMS, MQSeries) .
For now, I have a property file where I can put a string (example:Message8) which the app will pick up when it loads any of the jsp and show it in an alert box, but I have no way to track/control as to how many times a user should see the message !
Possibly I can modify the code in the controller (servlet) and keep track in a session object but thats still possibly an old way of doing things.
I was thinking of some module like log4j that I could plug into the app for the messaging .
Any suggestion ?
Again , many thanks .
20 years ago
Hi there ,
While implementing MVC architecture ,
I made an abstract ParentController.java which is extended by ApplicationController.java. In the ApplicationController I am doing :
// get the application object
ServletContext app = getServletContext();

// select login.jsp as the template
RequestDispatcher disp;
disp = app.getRequestDispatcher("index.jsp");
and at compile time I am getting:
ApplicationController.java:46: cannot resolve symbol
symbol : method getServletContext ()
Any idea? Thanks in advance for your comments .
Here are the code of the 2 classes :
----------------------------------------------

----------------------------------------------
----------------------------------------------

[ December 15, 2003: Message edited by: Mike Curwen ]
20 years ago
Thanks Mark Howard. Seemed to be that these attributes are not availabe for servlet2.2 ( or equivalent version of JSP). In the webSphere that I have access to , the Servlet.jar is missing the javax.servlet.error.* package! So I am stuck.
Again , thanks so much for the direction.
ML
21 years ago
JSP
Hi there ,
I have an error page for the jsp application.
In that error page I need to log the "file name or the URL" of the page that called the error page.
request.getRequestURI()
gives me the file name of the error page .
Any suggestion ?
Thanks.
ML
21 years ago
JSP
Thanks Mark. Your suggestion helped me reEvaluate my code and found that the method signature was wrong.
request.getRequestURL()
is now request.getRequestURI()
Thanks.
21 years ago
JSP
HI,
I am trying to get a reference to the requerst object so that I could get/LOG the page URL.
I tried:
1.
HttpServletRequest req ;
System.out.println("[ Debug Mode Enabled. Request in execution = " +req.getRequestURL().toString() +req.getQueryString() );
2.
System.out.println("[ Debug Mode Enabled. Request in execution = " +request.getRequestURL().toString() +request.getQueryString() );
None worked. Compile error.Cant get a handle to the request obj. Any suggestion ?
Trying to do this the a JSP page.
Thanks.
21 years ago
JSP
I am writing a mehod in a bean which returns a Set of "All" generations of subBusinesses ( Children) for a given business.
/************************************/
public Set getAllChildren3( String p_orgId){

Object l_busParentObj1 = null;


Map l_tempMap1 = new HashMap();
Set l_tempSet1 = new TreeSet();



// Getting all the 1st gen children
l_tempMap1= (Map)getChildBusMap( p_orgId) ;


if ( l_tempMap1.size()>0)
{
tempSet.addAll(l_tempMap1.keySet());
l_tempSet1.addAll(l_tempMap1.keySet());
for (Iterator iTemp1=l_tempSet1.iterator(); iTemp1.hasNext(); )
{
l_busParentObj1= iTemp1.next();
if ( isThereChildBus(l_busParentObj1.toString()))
getAllChildren3( l_busParentObj1.toString());
}
}
return tempSet ;
}
/************************************/
// the method "getChildBusMap(" returns the immediate subBusiness( 1st generation Children) for a given Business
// where "tempSet" is a global reUsable Set Object, currently using only in this method.
The method works just fine , but I hate the fact that I had to use aglobal variable ! Its lot of work to keep track of global variables . Do you have any suggestion as to HOW I COULD USE A LOCAL VARIABLE in this recursion in place of "tempSet".
Any other design suggestion ?
Thx in dvance for reading this.
ML
[ February 22, 2003: Message edited by: EM. Lashkar ]
21 years ago