LOG4j   problem in Java application

Hi,
I am using a standalone java program in my application.
This program consists of 5/6 classes.
These Class es are communicating Via method call.
Now I have to implemented log4j logging mechanisim.
in the main class , if I write
/*  STATIC BLOCK TO LOAD  LOG PROPERTIES  FILE */
    static{
        PropertyConfigurator.configure("conf//commLog.properties");
    }// end static blockand in the other calling classes if I use
private Logger log = Logger.getLogger(Communicator.class);
log.info(......);Is it working as a File appender Logging ???
What is the best approach to use log4j in this type off Application?
How can I load log4j during the start up of any desktop application and use it in File appender mode through out the application?

You have to config your log4j.properties file in your case commLog.properties
here is an example:
log4j.Logger=rooLog
log4j.appender.rootLog=org.apache.log4j.FileAppender
log4j.appender.rootLog.File=yourLogOutputFile
log4j.appender.rootLog.MaxFileSize=3MB
log4j.appender.rootLog.MaxBackupIndex=3
log4j.appender.rootLog.layout=org.apache.log4j.PatternLayout
log4j.appender.rootLog.layout.ConversionPattern=%d{ISO8601} %5p [%t] (%F:%L) - %m%n

Similar Messages

  • Problem installing Java Applications

    Hi there, i have problems installing Java Applications (from Ovi and from another source). The Apps from stores quit with just "there was a error", the other App is more detailed:
    Interner Fehler: Jsr plugin com.nokia.mj.impl.chapi.core.utils.
    ServiceProviderInstaller cancelled installation
    Is it possible that the Java-Handler is missing or faulty? Can this handler be manually installed? Thanks Gerd (E7-00 Anna, clean installation after hardreset)
    Solved!
    Go to Solution.

    Sorry about my previous answer, as it's not really an efficient solution.
    Skyee put the solution for this issue in another thread
    FA136376 I am unable to install any Java apps after the Symbian Anna upgrade, how to fix this?
    After upgrading Symbian Anna and starting the Java installation file on the Nokia Symbian^3 device, the following error message may be displayed: Installation failed – internal error: Jsr plugin com.nokia.mj.jmpl.chapi.core.utils.ServiceProviderInstaller cancelled installation. To fix this, install the following java_symbian_anna_fix.sis file: http://dl.nokia.com/ns/java_symbian_anna_fix.sis .
    Note: During the installation the file will give the warning message: Application not compatible with phone. Continue anyway. Select yes to proceed.

  • Problem running java applications on Mac Mini.

    Hi all.
    I have a Mac Mini. Days ago, I started having problems running java applications. Right now, I can not run any java application or even a plugin into a web page.
    I downloaded and reinstalled java from Oracle website, but the problem remains unsolve.
    Anyone can help me?
    Thanks in advance.
    Carlos.

    azofra1 wrote:
    Hi all.
    I have a Mac Mini. Days ago, I started having problems running java applications. Right now, I can not run any java application or even a plugin into a web page.
    What error indications do you get? You have to enable error logging in the Java Control Panel to see the details.

  • Problems running Java Application. Prease Help Me!!

    I've just finished a java application to my University, I used Forte for Java and the Timer that comes with it, it works fine, but, when I try to run it from outside Forte, it's just impossible, I even create a .jar file(with Forte 4), but when I try to run it from Forte, it tells me this:
    java.lang.NoClassDefFoundError: org/netbeans/examples/lib/timerbean/TimerListener
    Exception in thread "main"
    it seems that it's a problem with the Timer, why??
    And when I try to run it from the explorer (Windows), by double clicking the file, it tells me:
    Java Virtual Machine Launcher
    Could not find the main class. Program will exit!
    But how is that possible??, it works fine with Forte. That's my problem, I need to take it to the teacher, but I can only run it from Forte now. What can I do??? Any suggestions?. I Hope that somebody can help me, please.

    This sounds like a problem with the classpath. I was facing similar error with another application. Finally I ended up unzipping the class files and putting them in a directory that was in my class path.
    Or you could explicitly specily your classpath.
    Say your application (called app) is in c:\java\app and your classes are located in c:\java\classes\ where classes is directory run it like:
    c:\java>java -cp c:\java\classes[;second path] app
    hopefully it works.
    -Chirag

  • Problem in Java Application Server 7 2004 Q2 + MS SQL 2000 + MS JDBC Driver

    I have two applications runing on window 2000 server + Sun Java System Applilcation Server and connect to SQL Server 2000 + window 2000 server.
    The JDBC driver is Microsoft JDBC type 4.
    Both of them are with Local, Remote Ejb and session beans.
    All of the ejbs have a unique jndi name. Each app has its only ejbs.
    The problem I am facing is that If I deploy one of them, only one, every thing is fine.
    However, If I deploy both of them , only one of them works.
    I started the app server serval times. However, every time I got a different fail app.
    For example, I got the following error message:
    [24/Jan/2005:15:38:41] SEVERE ( 2440):      Validation error in class gwumc.edu.ejb.smhs.visitingstudent.StudentBean129315485_JDOState: com.sun.jdo.api.persistence.model.util.ModelValidationException: Warning: Cannot find the table Student for the class gwumc.edu.ejb.smhs.visitingstudent.StudentBean129315485_JDOState.
         Verify that the schema file exists and that its contents are correct.
    [24/Jan/2005:15:38:42] INFO ( 2440):      Bean Student method ejbFindActiveByPassword: problems running JDOQL query with params [21]
         com.sun.jdo.api.persistence.support.JDOFatalInternalException: Failed to load the configuration for class gwumc.edu.ejb.smhs.visitingstudent.StudentBean129315485_JDOState.
         NestedException: com.sun.jdo.api.persistence.support.JDOUserException: The mapping for class gwumc.edu.ejb.smhs.visitingstudent.StudentBean129315485_JDOState is invalid. Compile the class in the IDE, correct any errors, and verify that all required files are packaged for execution.
         at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.getPersistenceConfig(SQLStoreManager.java:145)
         at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl.loadPersistenceConfig(PersistenceManagerImpl.java:2085)
         at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl.getRetrieveDesc(PersistenceManagerImpl.java:1009)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.jqlc.CodeGeneration.createRetrieveDesc(CodeGeneration.java:707)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.jqlc.CodeGeneration.checkRetrieveDesc(CodeGeneration.java:4665)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.jqlc.CodeGeneration.prepareRetrieveDescs(CodeGeneration.java:4360)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.jqlc.CodeGeneration.query(CodeGeneration.java:850)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.jqlc.JQLC.codeGen(JQLC.java:332)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.QueryImpl.doExecute(QueryImpl.java:626)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.QueryImpl.executeWithArray(QueryImpl.java:552)
         at gwumc.edu.ejb.smhs.visitingstudent.StudentBean129315485_ConcreteImpl.ejbFindActiveByPassword(StudentBean129315485_ConcreteImpl.java:3491)
         at gwumc.edu.ejb.smhs.visitingstudent.StudentBean129315485_ConcreteImpl_LocalHomeImpl.findActiveByPassword(StudentBean129315485_ConcreteImpl_LocalHomeImpl.java:137)
         at gwumc.edu.ejb.smhs.visitingstudent.StudentDeanSessionBean.ejbCreate(StudentDeanSessionBean.java:24)
         at gwumc.edu.ejb.smhs.visitingstudent.StudentDeanSessionBean_LocalHomeImpl.create(StudentDeanSessionBean_LocalHomeImpl.java:27)
         at gwumc.edu.smhs.servlet.VisitingStudentDeanModel.<init>(VisitingStudentDeanModel.java:18)
         at gwumc.edu.smhs.servlet.VisitingStudentDean.doPost(VisitingStudentDean.java:27)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
         at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
         at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
         at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:158)
         at com.iplanet.ias.we
    [24/Jan/2005:15:38:42] INFO ( 2440):      b.WebContainer.service(WebContainer.java:850)
         NestedStackTrace:
         com.sun.jdo.api.persistence.support.JDOUserException: The mapping for class gwumc.edu.ejb.smhs.visitingstudent.StudentBean129315485_JDOState is invalid. Compile the class in the IDE, correct any errors, and verify that all required files are packaged for execution.
         at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.getPersistenceConfig(SQLStoreManager.java:128)
         at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl.loadPersistenceConfig(PersistenceManagerImpl.java:2085)
         at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl.getRetrieveDesc(PersistenceManagerImpl.java:1009)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.jqlc.CodeGeneration.createRetrieveDesc(CodeGeneration.java:707)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.jqlc.CodeGeneration.checkRetrieveDesc(CodeGeneration.java:4665)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.jqlc.CodeGeneration.prepareRetrieveDescs(CodeGeneration.java:4360)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.jqlc.CodeGeneration.query(CodeGeneration.java:850)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.jqlc.JQLC.codeGen(JQLC.java:332)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.QueryImpl.doExecute(QueryImpl.java:626)
         at com.sun.jdo.spi.persistence.support.sqlstore.query.QueryImpl.executeWithArray(QueryImpl.java:552)
         at gwumc.edu.ejb.smhs.visitingstudent.StudentBean129315485_ConcreteImpl.ejbFindActiveByPassword(StudentBean129315485_ConcreteImpl.java:3491)
         at gwumc.edu.ejb.smhs.visitingstudent.StudentBean129315485_ConcreteImpl_LocalHomeImpl.findActiveByPassword(StudentBean129315485_ConcreteImpl_LocalHomeImpl.java:137)
         at gwumc.edu.ejb.smhs.visitingstudent.StudentDeanSessionBean.ejbCreate(StudentDeanSessionBean.java:24)
         at gwumc.edu.ejb.smhs.visitingstudent.StudentDeanSessionBean_LocalHomeImpl.create(StudentDeanSessionBean_LocalHomeImpl.java:27)
         at gwumc.edu.smhs.servlet.VisitingStudentDeanModel.<init>(VisitingStudentDeanModel.java:18)
         at gwumc.edu.smhs.servlet.VisitingStudentDean.doPost(VisitingStudentDean.java:27)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
         at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
         at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
         at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:158)
         at com.iplanet.ias.web.WebContainer.service(WebContainer.java:850)
    [24/Jan/2005:15:38:42] SEVERE ( 2440):      StandardWrapperValve[visitingstudentdean]: Servlet.service() for servlet visitingstudentdean threw exception
         javax.servlet.ServletException: nested exception is: com.sun.jdo.api.persistence.support.JDOFatalInternalException: Failed to load the configuration for class gwumc.edu.ejb.smhs.visitingstudent.StudentBean129315485_JDOState.
         NestedException: com.sun.jdo.api.persistence.support.JDOUserException: The mapping for class gwumc.edu.ejb.smhs.visitingstudent.StudentBean129315485_JDOState is invalid. Compile the class in the IDE, correct any errors, and verify that all required files are packaged for execution.
         at gwumc.edu.smhs.servlet.VisitingStudentDean.doPost(VisitingStudentDean.java:41)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
         at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
         at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
         at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:158)
         at com.iplanet.ias.web.WebContainer.service(WebContainer.java:850)
    Any suggestion is great.
    Thanks,

    Hi again, Thanks for the reply!,
    I understand the part that you mentionned about specifying the database name. That is not what is causing me a problem : I was reffering to an instance. A new feature of MS SQL server 2000 -> you can have multiple SQL server instances, which means that each will have its own set of databases. Kinda like having multiple virtual servers but on the same machine. With ODBC, you can connect to the DEFAULT instance by just specifying the server name only. When you try to connect to a non default instance in ODBC you must specify it like this : '\\server_name\instance_name.'. I have found no way to do this with the type 4 MS driver (writting it like this : '//server/instance' or any other way was unsuccessful). Does anyone know how to do this or if it can be done with the MS driver???
    THX, Bye
    Andre Carrier

  • Problem with java applications - java.exe in loop

    Hi
    I just install j2sdk1.4.1_01
    I got a problem:
    when I run any code without graphics (clasic hello world with println) everything run fine
    when I try to run anythig else (with some swing) the java.exe process start to use 100% of the CPU and never end (probably a loop)
    The same think happen when I launch Java web Start so I suppose that the problem is not the code (I just use some dialog with one or two buttons and the application run fine on other pc).
    My system:
    OS: w2k server - SP3
    CPU: P4 1.8GHz
    RAM: 512 MB
    several services running: IIS with dhcp server, DNS server.
    The system was scanned and no viruses are found.
    I unistall everything (j2sdk, jre, web start) and I got the same after reinstalling them.
    I launch the application from the comand line and the results doesn't change.
    I install a different version of SDK (02 instead of 01) but nothing change.
    The same happens if I try to use jbuilder8.
    Any idea

    Try updating DirectX.

  • Problem with Java Application after upgrade to 10g

    after upgrading to 10g if I enable coloumn of varchar255 to load into memory of my middleware orm following error is thrown,
    javax.servlet.jsp.JspException     at jsp.viewsinglerecord.throwError(_viewsinglerecord.java:31)     [SRC:/jsp/standardinclude.jsp:84]     at jsp.viewsinglerecord._jspService(_viewsinglerecord.java:1185)     [SRC:/jsp/displaymultiplerecords.jsp:461]     at com.orionserver[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:356)     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:498)     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:402)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:835)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:341)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:230)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.GetParametersRequestDispatcher.forward(GetParametersRequestDispatcher.java:257)     at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)     at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)     at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:835)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:341)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:816)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:231)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:136)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)     at java.lang.Thread.run(Thread.java:534)
    Any lights on this issue ?

    after upgrading to 10g if I enable coloumn of varchar255 to load into memory of my middleware orm following error is thrown,
    javax.servlet.jsp.JspException     at jsp.viewsinglerecord.throwError(_viewsinglerecord.java:31)     [SRC:/jsp/standardinclude.jsp:84]     at jsp.viewsinglerecord._jspService(_viewsinglerecord.java:1185)     [SRC:/jsp/displaymultiplerecords.jsp:461]     at com.orionserver[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:356)     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:498)     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:402)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:835)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:341)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:230)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.GetParametersRequestDispatcher.forward(GetParametersRequestDispatcher.java:257)     at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)     at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)     at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:835)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:341)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:816)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:231)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:136)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)     at java.lang.Thread.run(Thread.java:534)
    Any lights on this issue ?

  • Is there a problem running Java applications on my mac?

    I am trying to set up a new website, and am therefore trying to upload photos.  I get a warning message saying:
    "this application will run with unrestricted access which may put your computer and personal information at risk.  Run this application only if you trust the location and publisher above." and  
    "This application will be blocked in a future Java security update because the JAR file manifest does not contain the Permissions attribute.  Please contact the Publisher for more information"
    Does anyone have any advice for me?

    There is no official iBook app for the Mac, but there are plenty of applications for reading a variety of ebook formats as above.  Another is Calibre, which can read the ePub format that is used for iBooks.  The software is free, take a look here:
    http://www.macworld.com/article/160425/2011/06/calibre.html

  • Oracle JDBC problem in Java/log4j

    HI,
    I am using log4j in my java application to log error messages using JDBCAppender to record the messages in DB tables.
    I am getting this error in JDeveloper.
    log4j:ERROR Failed to excute sql
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    Here is my log4j.properties file.
    log4j.appender.JDBC2=org.apache.log4j.jdbc.JDBCAppender
    log4j.appender.JDBC2.driver=oracle.jdbc.driver.OracleDriver
    log4j.appender.JDBC2.url=jdbc:oracle:thin:@Server:port:instance
    log4j.appender.JDBC2.user=user
    log4j.appender.JDBC2.password=password
    Note: I am able to log messages using FileAppender.
    Please let me know if anybody have any solutions for this problem.
    Siva.

    Abirami,
    This problem got solved as the static variables used for the JDBCAppender class are case sensitive.
    I modifed the variables Driver and URL. Now it is working for me.
    Here is the corrected code:
    log4j.appender.db=org.apache.log4j.jdbc.JDBCAppender
    log4j.appender.db.Driver=oracle.jdbc.driver.OracleDriver
    log4j.appender.db.URL=jdbc racle:thin:server:1523 bname
    log4j.appender.db.user=username
    log4j.appender.db.password=password
    log4j.appender.db.sql=INSERT INTO LOG VALUES ('%d %-5p -%F %m')
    log4j.appender.db.layout=org.apache.log4j.PatternLayout
    log4j.appender.db.layout.ConversionPattern=%d %-5p - %m
    log4j.appender.db.Threshold=debug

  • I'm having problems with JavaFX applications run on raspberry pi!

    I'm having problems with JavaFX applications run on raspberry pi. I did all the steps of the videos of the course: overclocking, uncommented what I had to uncomment about the framebuffer but Exceptions are still happening. The Fireworks demo example does not work. Someone went through this problem? Java applications are ok. As the versions of java in netbeans project and also on "properties" and they are all JDK 8. So if someone can give a hint, I'm very grateful!

    Can you provide the exceptions you got so I can help you better?
    Would you like to do a coaching session for this?
    -Vinicius

  • Java application problem

    I am using JDK1.4 and working on Windows Xp.
    I have written a code for application in java as follows:
    import javax.swing.*;
    public class sample
    JPanel panel;
    static JFrame frame;
    JButton but;
    public sample()
    frame=new JFrame("frame");
    panel=new JPanel();
    frame.getContentPane().add(panel);
    but=new JButton("click");
    panel.add(but);
    public static void main(String args[])
    sample s=new sample();
    frame.setSize(300,300);
    frame.setVisible(true);
    on executing program application window has appeared and it ran properly.
    Then I closed that application window.But after that in command prompt window curser was just blinking and it was not allow to enter also.
    I have tried pressing CTRL+C also.But situation in command prompt was same i.e curser in command prompt was just blinking.
    Then I closed cmd window ;but one error has occured saying that cmd window can not close .
    My friend has told me that she is also having windows xp and JDK1.4 ; ctrl+c is working properly in her command prompt.She has written the above same code in her computer and it executes properly.
    Even though she has not written following statement:
    "frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);"
    when she exits from application window ,her cmd window gave same problem of only blinking curser.But when she press CTRL+C ; her command prompt starts responding by giving root.But my command prompt is not giving
    positive responce to "ctrl+c" when I am exiting java application.
    Is it possible to solve this problem without giving statement
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ?
    Why my command prompt is not responding to CTRL+c?
    How can I tackle this problem ?
    Is there any other key which can be used in command prompt of Windows Xp?

    Is it possible to solve this problem without giving
    statement
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    ?this is because Swing have started some non-daemon helper threads for its internal purposes and the default close operation for frame is just HIDE_ON_CLOSE. So, the system will not exit because those non-daemon thread still not terminated.
    What is the problems setting the default close operation to JFrame.EXIT_ON_CLOSE ?

  • Java application crashes due to some problem in native  code

    Hi All
    I have a Java application that calls APIs in a 3rd party DLL(I don't have access to its source code or logs) through my VC++ DLL(Win32) that acts as the wrapper DLL.
    The Application has many functionalities and is based on multithreading (both on Java layer as well as C++ layer). Most of the functionalities are working , but when I try to close the application, it crashes.
    Moreover the crashing occurs inconstently, sometimes it does not crash. Instead of showing any debug information , it simply creates a error file with disassembly code that I am not able to understand.
    Though the error seems like an java error, but actually it seems to be due to native code. I have try catch blocks in my code and also implemented settranslator functionality to get hold of structured/C exceptions. But still I am not able to catch any exceptions.
    I am pasting the the contents of the file here:
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c9111de, pid=488, tid=1848
    # Java VM: Java HotSpot(TM) Client VM (1.4.2_14-b05 mixed mode)
    # Problematic frame:
    # C [ntdll.dll+0x111de]
    --------------- T H R E A D ---------------
    Current thread (0x009d1790): JavaThread "CompilerThread0" daemon [_thread_in_native, id=1848]
    siginfo: ExceptionCode=0xc0000005, reading address 0x00000001
    Registers:
    EAX=0x00000001, EBX=0x00030000, ECX=0x02d17a18, EDX=0x00030278
    ESP=0x02c2f8e8, EBP=0x02c2fb08, ESI=0x02d17a10, EDI=0x00000001
    EIP=0x7c9111de, EFLAGS=0x00010202
    Top of Stack: (sp=0x02c2f8e8)
    0x02c2f8e8: 009fa9a0 000000c0 00000008 0811d3d8
    0x02c2f8f8: 0000000c 00a2c0e0 00000003 00000004
    0x02c2f908: 08018216 00000001 02c2fcc4 08018385
    0x02c2f918: 00000002 00000001 02c2f93c 02d06d0c
    0x02c2f928: 0802a50a 00000000 00000001 02c2f93c
    0x02c2f938: 04a3cb4c 02d01008 02c2f964 0802a850
    0x02c2f948: 02c2f96e 00000000 00000007 00000000
    0x02c2f958: 04a3cb38 00000004 08018216 00000001
    Instructions: (pc=0x7c9111de)
    0x7c9111ce: 39 89 bd 0c ff ff ff 8b 46 0c 89 85 68 ff ff ff
    0x7c9111de: 8b 10 3b 57 04 0f 85 8c 31 02 00 3b d1 0f 85 84
    Stack: [0x02bf0000,0x02c30000), sp=0x02c2f8e8, free space=254k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C [ntdll.dll+0x111de]
    C [MSVCRT.dll+0x1c3c9]
    C [MSVCRT.dll+0x1c3e7]
    C [MSVCRT.dll+0x1c42e]
    V [jvm.dll+0xacda9]
    V [jvm.dll+0x17102]
    V [jvm.dll+0x16c8d]
    V [jvm.dll+0x16dca]
    V [jvm.dll+0x170a7]
    V [jvm.dll+0x172e8]
    V [jvm.dll+0x4dc65]
    V [jvm.dll+0x4d894]
    V [jvm.dll+0xd3a36]
    V [jvm.dll+0xd3a04]
    C [MSVCRT.dll+0x2a3b0]
    C [kernel32.dll+0xb683]
    Current CompileTask:
    HotSpot Client Compiler:423 b sun.awt.AWTAutoShutdown.isReadyToShutdown()Z (33 bytes)
    --------------- P R O C E S S ---------------
    Java Threads: ( => current thread )
    0x049d6328 JavaThread "Thread-19" [_thread_blocked, id=1440]
    0x049d24d0 JavaThread "Thread-18" [_thread_blocked, id=3620]
    0x049d40c8 JavaThread "Thread-17" [_thread_blocked, id=2476]
    0x02df0538 JavaThread "TimerQueue" daemon [_thread_blocked, id=3876]
    0x00036a78 JavaThread "DestroyJavaVM" [_thread_blocked, id=2448]
    0x02e43768 JavaThread "Thread-6" [_thread_blocked, id=3664]
    0x02e23130 JavaThread "Thread-4" [_thread_blocked, id=2816]
    0x02e21d08 JavaThread "Thread-2" [_thread_blocked, id=3344]
    0x02da3f78 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2528]
    0x02da3268 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=4008]
    0x02d91f90 JavaThread "AWT-Windows" daemon [_thread_blocked, id=648]
    0x02d3a478 JavaThread "AWT-Shutdown" [_thread_blocked, id=2988]
    =>0x009d1790 JavaThread "CompilerThread0" daemon [_thread_in_native, id=1848]
    0x009d0a90 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3568]
    0x009ce128 JavaThread "Finalizer" daemon [_thread_blocked, id=1824]
    0x009ccda0 JavaThread "Reference Handler" daemon [_thread_blocked, id=3280]
    Other Threads:
    0x00a0b6e8 VMThread [id=608]
    0x00a0d620 WatcherThread [id=3012]
    VM state:not at safepoint (normal execution)
    VM Mutex/Monitor currently owned by a thread: None
    Heap
    def new generation total 640K, used 583K [0x10010000, 0x100c0000, 0x104f0000)
    eden space 576K, 90% used [0x10010000, 0x10091e40, 0x100a0000)
    from space 64K, 99% used [0x100b0000, 0x100bfff8, 0x100c0000)
    to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000)
    tenured generation total 7772K, used 5451K [0x104f0000, 0x10c87000, 0x14010000)
    the space 7772K, 70% used [0x104f0000, 0x10a42d80, 0x10a42e00, 0x10c87000)
    compacting perm gen total 8192K, used 8137K [0x14010000, 0x14810000, 0x18010000)
    the space 8192K, 99% used [0x14010000, 0x148024e8, 0x14802600, 0x14810000)
    Dynamic libraries:
    0x00400000 - 0x0040b000 c:\dcsthick\jre\bin\java.exe
    0x7c900000 - 0x7c9b0000 C:\WINDOWS\system32\ntdll.dll
    0x7c800000 - 0x7c8f5000 C:\WINDOWS\system32\kernel32.dll
    0x77dd0000 - 0x77e6b000 C:\WINDOWS\system32\ADVAPI32.dll
    0x77e70000 - 0x77f01000 C:\WINDOWS\system32\RPCRT4.dll
    0x77c10000 - 0x77c68000 C:\WINDOWS\system32\MSVCRT.dll
    0x08000000 - 0x08143000 c:\dcsthick\jre\bin\client\jvm.dll
    0x7e410000 - 0x7e4a1000 C:\WINDOWS\system32\USER32.dll
    0x77f10000 - 0x77f57000 C:\WINDOWS\system32\GDI32.dll
    0x76b40000 - 0x76b6d000 C:\WINDOWS\system32\WINMM.dll
    0x76390000 - 0x763ad000 C:\WINDOWS\system32\IMM32.DLL
    0x10000000 - 0x10007000 c:\dcsthick\jre\bin\hpi.dll
    0x76bf0000 - 0x76bfb000 C:\WINDOWS\system32\PSAPI.DLL
    0x00390000 - 0x0039e000 c:\dcsthick\jre\bin\verify.dll
    0x003b0000 - 0x003c9000 c:\dcsthick\jre\bin\java.dll
    0x003d0000 - 0x003de000 c:\dcsthick\jre\bin\zip.dll
    0x02e70000 - 0x02f84000 C:\dcsthick\jre\bin\awt.dll
    0x73000000 - 0x73026000 C:\WINDOWS\system32\WINSPOOL.DRV
    0x774e0000 - 0x7761d000 C:\WINDOWS\system32\ole32.dll
    0x5ad70000 - 0x5ada8000 C:\WINDOWS\SYSTEM32\uxtheme.dll
    0x02fe0000 - 0x03031000 C:\dcsthick\jre\bin\fontmanager.dll
    0x73760000 - 0x737a9000 C:\WINDOWS\system32\ddraw.dll
    0x73bc0000 - 0x73bc6000 C:\WINDOWS\system32\DCIMAN32.dll
    0x73940000 - 0x73a10000 C:\WINDOWS\system32\D3DIM700.DLL
    0x74720000 - 0x7476b000 C:\WINDOWS\system32\MSCTF.dll
    0x755c0000 - 0x755ee000 C:\WINDOWS\system32\msctfime.ime
    0x03320000 - 0x0333c000 C:\dcsthick\lib\CrewsDmApiJniNt.dll
    0x031b0000 - 0x031bb000 c:\dcsthick\lib\CRWNT_DM.dll
    0x03240000 - 0x03249000 c:\dcsthick\lib\BAT_API.dll
    0x03340000 - 0x03352000 c:\dcsthick\lib\DC_DSM32.dll
    0x03360000 - 0x03369000 c:\dcsthick\lib\CRWTOOLS.dll
    0x77c00000 - 0x77c08000 C:\WINDOWS\system32\VERSION.dll
    0x03370000 - 0x0337a000 c:\dcsthick\lib\PMAPI.dll
    0x5d090000 - 0x5d12a000 C:\WINDOWS\system32\COMCTL32.dll
    0x03790000 - 0x037b2000 c:\dcsthick\ResaDLL\DC_DSMNB.dll
    0x5b860000 - 0x5b8b4000 C:\WINDOWS\system32\NETAPI32.dll
    0x038d0000 - 0x038f2000 c:\dcsthick\ResaDLL\DC_DSMIP.dll
    0x71ad0000 - 0x71ad9000 C:\WINDOWS\system32\WSOCK32.dll
    0x71ab0000 - 0x71ac7000 C:\WINDOWS\system32\WS2_32.dll
    0x71aa0000 - 0x71aa8000 C:\WINDOWS\system32\WS2HELP.dll
    0x71a50000 - 0x71a8f000 C:\WINDOWS\system32\mswsock.dll
    0x662b0000 - 0x66308000 C:\WINDOWS\system32\hnetcfg.dll
    0x71a90000 - 0x71a98000 C:\WINDOWS\System32\wshtcpip.dll
    0x76f20000 - 0x76f47000 C:\WINDOWS\system32\DNSAPI.dll
    0x76fb0000 - 0x76fb8000 C:\WINDOWS\System32\winrnr.dll
    0x76f60000 - 0x76f8c000 C:\WINDOWS\system32\WLDAP32.dll
    0x66580000 - 0x6658f000 C:\WINDOWS\system32\pnrpnsp.dll
    0x76fc0000 - 0x76fc6000 C:\WINDOWS\system32\rasadhlp.dll
    0x032e0000 - 0x0330a000 C:\dcsthick\lib\ResaHostConnection.dll
    0x03250000 - 0x03257000 c:\dcsthick\lib\CRWNT_GWALC.dll
    0x03310000 - 0x03319000 c:\dcsthick\lib\ALCAPI.dll
    0x763b0000 - 0x763f9000 C:\WINDOWS\system32\comdlg32.dll
    0x77f60000 - 0x77fd6000 C:\WINDOWS\system32\SHLWAPI.dll
    0x7c9c0000 - 0x7d1d7000 C:\WINDOWS\system32\SHELL32.dll
    0x773d0000 - 0x774d3000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll
    VM Arguments:
    jvm_args: -Dcfdynaproppath=c:\dcsthick/config/ -Dcfdynapropxml=RESA_KCOdynamicproperties.xml -DConfigPath=c:\dcsthick/config/RESA_KCOConfig.xml -DResolution=High -DWorkstationID=GWGTE -DMode=GateBoarding -DlogPath=c:\temp\kcologs -DlogInformation=0 -DGateway=ALCSQ1 -DNetBiosPort=A
    java_command: com.singaporeair.dcs.standalone.application.model.ApplicationModel SQ/IGATEADXX
    Launcher Type: SUN_STANDARD
    Environment Variables:
    JAVA_HOME=c:\dcsthick\jre\bin
    PATH=c:\dcsthick\jre\bin;c:\dcsthick/lib;c:\dcsthick/ResaDLL
    USERNAME=USER
    OS=Windows_NT
    PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 13, GenuineIntel
    --------------- S Y S T E M ---------------
    OS: Windows XP Build 2600 Service Pack 2
    CPU:total 2 family 6, cmov, cx8, fxsr, mmx, sse, sse2
    Memory: 4k page, physical 1039600k(565656k free), swap 2501208k(2091128k free)
    vm_info: Java HotSpot(TM) Client VM (1.4.2_14-b05) for windows-x86, built on Mar 14 2007 16:46:11 by "java_re" with MS VC++ 6.0
    The JAVA Application during initialisation establishes a connection with the host server for various devices. For each of the device it establishes a separate connection and keeps listening on these connections using multithreading.
    During App close, we need to close each of these connections one by one for each device.
    The opening /closing of connection is done by 3rd party DLL and call to there APIs is done through a C++ Wrapper DLL that I have built between the Java layer and their DLL.
    When we close the Application, I am always able to close the connections on the first 2 devices. Then all of a sudden it crashes either for the 3rd device conn. close or for the 4th one. The code is the same for all the devices . That too sometimes it just goes fine without crashing. If its a null pointer exception, why is it that it crashes on some occassions and not in other times. More importantly, why is it that it does not fail for the first 2 devices , but fails for the 3rd or 4th device connection close?
    Can please anyone help me. Please suggest me as to how I can determine the cause of the error.
    And is this error really coming in ntdll.dll or is it getting caused of my dll?

    The opening /closing of connection is done by 3rd party DLL and call to there APIs is done through a C++ Wrapper DLL that I have built between the Java layer and their DLL.The specific error indicates a pointer/memory problem.
    The first place that is likely is in your code.
    The second most likely place for the cause is because you are using the third party library incorrectly. For example before exiting you are supposed to clean up resources and you are not doing so.
    As a remote possibility, much less likely that either of the above, there is a bug in jnative or in the 3rd party library.

  • How can i built a java application using java debug class on Log4J

    Hi,
    As java API support the MethodEntryEvent, using which I can get the automatic logging statements when the method is entered or exited as HelloExample.main(with argument type).
    Where HelloExample is the class name.
    Main is the method entered with its argument types.
    In some cases I have the o/p as
    -- VM Started --
    ====== main ======
    main -- HelloExample
    callerMethod -- HelloExample
    ====== main end ======
    -- The application exited --
    By using Log4J is there any possibility of getting these sort of o/p along with the loggers supported by Log4J. i mean to say can i built an java application which supports the MethodEntryEvent and MethodExitEvent from java API and also uses the Log4J debugging. I took an e.g. trace example, which (in J2SE 1.4.x or 5.x) will be found in $JAVA_HOME/demo/jpda/examples.jar and unpacking it by
    jar -xvf $JAVA_HOME/demo/jpda/examples.jar i found the com/sun/tools/example/trace/Trace.java and passed the class constructed with logger taken from Log4J. In this case the logging message is displayed on the console. As per the requirement i need to transfer the whole o/p to an output file along with Log4J logger statements. in this case i should not give any command in the cosule except compiling and executing the programme. the programm also should able to run without the main() as i need to integrate Log4J with an application and the code must me application server independent. i need the output as i got using MethodEnteryEvent (shown as above) in case of java application built using Log4J.
    Can any one help me in this regard. can any one give me some suggestion or any programme of this sort. All suggestions are welcomed.
    Thanks & Regards,

    hi,
    can someone help me how to implement logging for method entry parameters and
    method exit return value.
    can someone help me how to use log4j and integrate it to the method entry
    logging and method exit logging.
    Here what i need is without writing the log statements for the method entry and
    method exit i need to log it to the file
    along with other log4j debug statements i provide in the file.I should be able
    to configure whether to enable/disable the logging
    for method entry and method exit. In method entry i should be able to log the
    parameters the method take and in method exit
    i should be able to log te return value to the log file, before the method is
    returned to the callee.
    i hope i am clear
    Thanks in advance.

  • Deploying problem of web dynpro java application

    Hi,
    I have a web dynpro java application with no problem about deploying.
    I copied this application with another name.
    I tryed new application to deploy but sdm aborted with error.
    Error
    19.Tem.2011 10:22:25 /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
    [001]Deployment aborted
    Settings
    SDM host : vserver0202
    SDM port : 52018
    URL to deploy : file:/C:/Users/CEMIL~1.BOZ/AppData/Local/Temp/temp27456HF_PERS_RAPOR_BUTCE.ear
    Result
    => deployment aborted : file:/C:/Users/CEMIL~1.BOZ/AppData/Local/Temp/temp27456HF_PERS_RAPOR_BUTCE.ear
    Aborted: development component 'HF_PERS_RAPOR_BUTCE'/'local'/'LOKAL'/'0.2011.07.19.10.22.15'/'0':
    Caught exception during application deployment from SAP J2EE Engine's deploy service:
    java.rmi.RemoteException: Cannot deploy application local/HF_PERS_RAPOR_BUTCE.. Reason: Clusterwide exception: Failed to deploy application local/HF_PERS_RAPOR_BUTCE. Check causing exception for details (trace file). Hint: Are all referenced components deployed and available on the engine?; nested exception is:      com.sap.engine.services.deploy.container.DeploymentException: Clusterwide exception: Failed to deploy application local/HF_PERS_RAPOR_BUTCE. Check causing exception for details (trace file). Hint: Are all referenced components deployed and available on the engine?
    (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)
    Deployment exception : The deployment of at least one item aborted

    Hi,
    Since the exception says "Are all referenced components deployed and available on the engine?"
    Check wether any DC is used as a used DC in the webdynpro component which you are deploying.
    If any used DC is available try to deploy that DC in the server and then deploy ur webdynpro application.
    If all reference DC's are avialable in server, still if you get this error try to rename the component and reload+rebuild the project and deploy it.
    Hope this helps you...
    Regards,
    Saleem Mohammad.

  • *Connection problems Sap A Java Application*

    Hi Gurus,
    I have a problem. I'm riding the part of the JCO SERVER for SAP from sending information to a Java application.
    I created the RFC destination of the type TCP / IP and I have registered my JAVA application in the visual administrator. This application java is already deployed listening to SAP and I can think of the following error when I run a BAPI created in the ABAP fate that I created.
    It's not that I can think of that might be.
    Or if someone was going another way of doing it from using sap we can send things to JAVA without having to java call the BAPI please help.
    Errores tiempo ejecucióCALL_FUNCTION_REMOTE_ERROR
    "JCO.Server could not find server function 'Z_BAPI_RFC'"
    ¿Qué ha sucedido?
    Error in ABAP application program.
    The current ABAP program "Z_BAPI_RFC====================FT" had to be terminated because one of the statements could not be
    executed.
    This is probably due to an error in the ABAP program.
    The error occurred in an RFC call to another system.
    The target system has also written a short dump.
    Consult this short dump for more precise information about
    the cause of the error.

    Please note that this forum is dedicated to all other development-related questions which are not directly addressed by other forums. This includes Business Objects SDKs, products, or technologies which do not fall under BusinessObjects Enterprise, BusinessObjects Edge, Crystal Reports Server, or Crystal Reports (for example Desktop Intelligence SDK, Universe Designer SDK, Portal Integration Kits, Java User Function Libraries, and other third party technologies or development languages).
    As your query relates to an SAP product, please post to an SAP forum.
    Ludek

Maybe you are looking for