This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem while creating log file through Servlet: IOException  RSS feed

 
Baseet Ahmed
Ranch Hand
Posts: 225
Java Notepad Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Objects,
We are facing folloiwng problem on Production(Weblogic8.1) on Solaris:

java.io.IOException: Bad file number
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at java.io.BufferedOutputStream.writeBufferedOutputStream.java:106)
at java.io.FilterOutputStream.write(FilterOutputStream.java:80)
.....
at javax.servlet.http.HttpServlet.serviceHttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:1072)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6981)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3892)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2766)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
Abort - core dumped


This problem occurred while invoking following code:
szFileName = dir1/Logfldr;//where dir1 is solaris format path /fldr1/fld2
mOutStream = new BufferedOutputStream(new FileOutputStream(szFileName, true));

--------------------------------------------
--------------------------------------------
Second problem is as follows:

Servlet failed with Exception
java.lang.Throwable
....
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:1072)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6981)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3892)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2766)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)



Please suggest what could be done to overcome the above two problems.

Thank you.
Baseet Ahmed
Information Technologist


***********************************
Tip: Sincerity is mother of all acheivements.
***********************************
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what's causing your problem but why are you writing your own logger when there are really good ones, like log4j,that are available for free?
 
Baseet Ahmed
Ranch Hand
Posts: 225
Java Notepad Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually for debugging purpose,we have made one java class which contains different methods for writing information on file(log file) during program execution. This is helpful for us while some error or exception thrown,to understand the problem easily.

Again I would like to ask all(Java people) that please let me know what could be the problem(cause) for above two issues and what action should I take?

Thank you.


***********************************
Tip: Sincerity is mother of all acheivements.
***********************************
 
Arvind Mahendra
Ranch Hand
Posts: 1162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
recheck all your xml files. They might be corrupted and causing some of the problems?
 
Baseet Ahmed
Ranch Hand
Posts: 225
Java Notepad Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Objects,
Still waiting for reply.
Not able to understandard what problem is causing these two errors(see previous post for details).
1:-
java.io.IOException: Bad file number
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
......
Abort - core dumped

2:-
Servlet failed with Exception
java.lang.Throwable
....
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:1072)

Thank you


***********************************
Tip: Sincerity is mother of all acheivements.
***********************************
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Baseet Ahmed:
Actually for debugging purpose,we have made one java class which contains different methods for writing information on file(log file) during program execution. This is helpful for us while some error or exception thrown,to understand the problem easily.

Again I would like to ask all(Java people) that please let me know what could be the problem(cause) for above two issues and what action should I take?

Thank you.


***********************************
Tip: Sincerity is mother of all acheivements.
***********************************



That doesn't answer my question.
You've just explained why you'd want a logger.
My question was: why would you want to write your own logger and get mired down in file io when there are already good logging packages available for free?
 
Baseet Ahmed
Ranch Hand
Posts: 225
Java Notepad Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Souther,

As said earlier,for debugging purpose.
Now further to this I am unable to explain.
Agreed with other loggers(log4j etc) availability.

Now coming to my problem,please do let us know reason for the error:
Servlet failed with Exception
java.lang.Throwable


In addition to that,another problem not related to IO Exception,the webloigc server's log file shows following error message:
<Error> <Kernel> <servername> <appname> <ExecuteThread: '0' for queue: 'weblogic.kernel.System'> <<WLS Kernel>> <> <BEA-000802> <ExecuteRequest failed
java.lang.OutOfMemory Error.
java.lang.Throwable >


Also can anybody tell us what are the possible causes for this:- java.io.IOException:Bad File number

Any help on this would be greatful.

Thank you.

***********************************
Tip: Modesty is all virtue.
***********************************
 
Baseet Ahmed
Ranch Hand
Posts: 225
Java Notepad Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Objects,

Please help.
Still waiting for reply.



Thank you.


***********************************
Tip: Modesty is all virtue.
***********************************
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66187
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Baseet Ahmed:
As said earlier,for debugging purpose.

Which once again competely skirts the question of "why are you wasting time writing your own logger"? The builtin Java logging or the superior Log4J already exist "for debugging purposes".
 
Emanuel Kadziela
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure the directories exist or that you are creating them when writing out a new log file. "Bad file number" is also a very cryptic message probably because it is coming out of WebLogic. Try to run your stuff in another app server and you might get a more meaningful message.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!