JBoss Log4J problem

Hi all,
Although Log4J is not exactly about Java, but it is kind of related, so please don't mind me posting this message.
I am having problems stoping JBoss from reloading the log4j.properties file. Is there anyway to stop it from polling the log4j.properties file every now and then..
Thx for your help
Kevin

Look at ${JBOSS_HOME}/server/default/jboss-service.xml. It has a section with the following code:
   <mbean code="org.jboss.logging.Log4jService"
      name="jboss.system:type=Log4jService,service=Logging">
      <attribute name="ConfigurationURL">resource:log4j.xml</attribute>
      <attribute name="Log4jQuietMode">true</attribute>
      <!-- How frequently in seconds the ConfigurationURL is checked for changes -->
      <attribute name="RefreshPeriod">60</attribute>
   </mbean>You could try setting the refresh periode to 0, but I don't know to what kind of behaviour that will result in.

Similar Messages

  • JBoss, Log4J and OnlyOnceErrorHandler message

    Just posting this message in case other people run into the same problem I did.
    I am deploying an application that includes Log4J jar file. When I run in JSC, everything works fine. However, when I create a WAR and deploy to JBoss I get problems with Log4J at startup of the JBoss server. The error is:
    log4j:ERROR A "org.jboss.logging.util.OnlyOnceErrorHandler?" object is not assignable to a "org.apache.log4j.spi.ErrorHandler?" variable.
    To fix this problem, I exclude the Log4J files from my WAR file. This can be done in JSC by right clicking on the project and selecting properties. Select Libraries and uncheck your Log4J jar file(s). JSC will use the JARS to compile the application but will not use the in the exported WAR file. Since the current release of JBoss includes Log4J jar, it creates an error at startup.

    You can tell it you don't want to inherit, by adding
    this to your "standard" category tag:
    <category name="standard" additivity="false">
    thanks. it works perfect.
    ok i got it working kind of. Jboss already comeswith
    a log4j.xml so i put my log4j stuff in this file :You should be able to deploy your own log4j.xml with
    your app's resource files and make it use yours when
    it is running your app.Ok I took out my stuff from Jboss log4j.xml, create a new xml progtest.log4j.xml like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
      <appender name="DEVLOG" class="org.apache.log4j.RollingFileAppender">
        <param name="File" value="${jboss.server.home.dir}/log/developer.log" />
        <param name="Append" value="true" />
        <layout class="org.apache.log4j.PatternLayout">
          <param name="ConversionPattern" value="%d{ABSOLUTE} %5p %c{1}:%L - %m%n" />
        </layout>
      </appender>
      <category name="standard" additivity="false">
        <priority value="INFO"/>
        <appender-ref ref="DEVLOG" />
      </category>
    </log4j:configuration>My web application is in a ProgTest.WAR folder. I put the above file "progtest.log4j.xml" under WEB-INF/classes in ProgTest.WAR folder. When i run the app the very first problem again arises that no developer.log file was created; instead the concerned messages were put into server.log and console.
    All my classes are in one jar file. I include progtest.log4j.xml in that jar file, redeploy it and test it but still the same problem.
    What i am doing wrong here?
    Thanks

  • Jboss starting problem

    E:\jboss\jboss-4.0.5.GA\bin>run -c spend
    ===============================================================================
    JBoss Bootstrap Environment
    JBOSS_HOME: E:\jboss\jboss-4.0.5.GA\bin\\..
    JAVA: C:\Program Files\java\jsdk1.4\bin\java
    JAVA_OPTS: -Dprogram.name=run.bat -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.g
    cInterval=3600000
    CLASSPATH: C:\Program Files\java\jsdk1.4\lib\tools.jar;E:\jboss\jboss-4.0.5.GA\bin\\run.jar;E:\jboss\jboss-4.0.5.GA\server\
    spend\deploy;E:\jboss\jboss-4.0.5.GA\server\spend\conf;E:\jboss\jboss-4.0.5.GA\server\spend\conf\config;
    ===============================================================================
    log4j:ERROR Could not instantiate class [org.apache.log4j.xml.DOMConfigurator].
    java.lang.ClassNotFoundException: org.apache.log4j.xml.DOMConfigurator
    at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:140)
    at org.apache.log4j.helpers.Loader.loadClass(Loader.java:160)
    at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:309)
    at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:449)
    at org.apache.log4j.LogManager.<clinit>(LogManager.java:113)
    at org.jboss.logging.Log4jLoggerPlugin.init(Log4jLoggerPlugin.java:77)
    at org.jboss.logging.Logger.getDelegatePlugin(Logger.java:338)
    at org.jboss.logging.Logger.<init>(Logger.java:96)
    at org.jboss.logging.Logger.getLogger(Logger.java:309)
    at org.jboss.system.server.ServerImpl.doInit(ServerImpl.java:166)
    at org.jboss.system.server.ServerImpl.init(ServerImpl.java:147)
    at org.jboss.Main.boot(Main.java:197)
    at org.jboss.Main$1.run(Main.java:490)
    at java.lang.Thread.run(Thread.java:536)
    log4j:ERROR Could not instantiate configurator [org.apache.log4j.xml.DOMConfigurator].
    log4j:WARN No appenders could be found for logger (org.jboss.system.server.Server).
    log4j:WARN Please initialize the log4j system properly.
    please can any body tell me how to solve this problem

    Problems like this don't cease to amaze me.
    We are in the year of 2009 and this problem is most probably caused because jboss is started from a path which contains one or more space.
    Try move your jboss installation or eclipse installation (i am not familiar how jboss in installed inside eclipse) to a folder with no spaces and the problem should go away.
    It is sad that nice software like jboss has stupid bugs like this. Oh and it migh not be jboss but the JVM. It is silly in any case...

  • Log4j problem with JRockit

    When I use JRockit 8.1 SP2 with Log4j 1.2.8, it appears that JRockit handles reflection differently than the Sun JVM, because the log4j messages come back wrong under JRockit and work fine with Hotspot.
    I think if you do the following you will reproduce the issue:
    Set your ConversionPattern layout in Log4j to include Method lookup (%M) - for example:
    log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss.SSS}] %5p %x %c.%M() line %L - %m%nGet some code to log a log4j message. Run it under the different JVMs and the log4j messages will give you different results.
    For example, under Sun's JVM, the method name is properly returned in the log message:
    [15:39:21.549] DEBUG  COMMON.com.mycompany.common.security.ldap.LdapManager.findGroupsSelectedAttributes() line 696 - <exit
    [15:39:21.948]  WARN  COMMON.com.mycompany.common.dao.DAOFactory.reset() line 244 - Resetting DAO cacheUnder JRockit, you get what appears to be the return type of the method. Sometimes it's instead of the method name, sometimes it's in addition to it:
    [16:12:45.014] DEBUG  COMMON.com.mycompany.common.security.ldap.LdapManager.List;() line 696 - <exit
    [16:12:45.034]  WARN  COMMON.com.mycompany.common.dao.DAOFactory.reset()V() line 244 - Resetting DAO cache

    We have seen this problem with JRockit before and it seems to be a compatability issue with log4j.
    Quoting Jim Brown of BEA:
    "The underlying problem appears to be that log4j is ignorant of the extended method argument and type data returned by JRockit."
    At this point, we have not changed anything in JRockit to avoid this.
    Kind regards, Cecilia Borg
    BEA WebLogic JRockit

  • Mysql, Jboss connecting problem

    Hello,
    I am having problem with mysql database. I am trying to run AccountEJB application from SUN with mysql as my backend.
    PLEASE DO NOT FORGET I AM NOT EXPERT IN JBOSS OR EJB BUT I AM TRYING TO LEAN WITH A EXAMPLE.
    HERE IS MY SETUP UP TO THIS POINT.
    I am running jboss-3.03.0_tomcat-4.0.3
    I am including
    1. AccountBean
    2. ejb-jar.xml
    3. web.xml
    4. jboss.xml
    6. mysql-service.xml ( I add my database name, username, password and i copy it to ..server/default/deploy dir.)
    I only modified mysql-service.xml. Do i have to modify any other jboss files. Some people are saying i have to modify "standardjaws.xml, standardjbosscmp.xml"
    My AccountBean code is
    Please take a look at "setEntityContext" and "makeConnection" that is where problem comes.
    Here is the error
    10:43:19,950 INFO [Engine] AccountServlet: init
    10:43:19,950 INFO [STDOUT] AccountServlet: init()
    10:43:20,101 INFO [STDOUT] Got context
    10:43:20,311 INFO [STDOUT] Got referance
    10:43:20,371 INFO [STDOUT] Got referance to home object
    10:43:20,501 INFO [STDOUT] setEntityContext call....
    10:43:20,501 INFO [STDOUT] makeConnection call...
    10:43:20,501 INFO [STDOUT] Something went wrong within makeConnction call ....
    javax.naming.NameNotFoundException: MySqlDS not bound
    10:43:20,501 INFO [STDOUT] Came back from makeConnction call ...
    10:43:20,501 INFO [STDOUT] ejbCreate call
    10:43:20,501 INFO [STDOUT] insertRow call...
    10:43:20,511 ERROR [STDERR] Caught an exception.
    10:43:20,511 ERROR [STDERR] java.rmi.ServerException: ejbCreate: null; nested ex
    ception is:
    javax.ejb.EJBException: ejbCreate: null
    package com.ps.impl;
    import javax.ejb.EntityBean;
    import javax.ejb.EntityContext;
    import java.sql.*;
    import javax.sql.*;
    import javax.ejb.*;
    import javax.naming.*;
    import java.util.*;
    import java.rmi.*;
    public class AccountBean implements EntityBean
    private EntityContext context;
    private String id;
    private String firstName;
    private String lastName;
    private double balance;
    private Connection con;
    //private String dbName = "java:/MySqlDS";
    public void debit (double amount)
    if (balance - amount < 0)
    else
    balance = balance - amount;
    public void credit (double amount)
    balance = balance + amount;
    public String getFirstName()
    return firstName;
    public String getLastName()
    return lastName;
    public double getBalance()
    return balance;
    public String ejbCreate(String id, String firstName, String lastName, double balance)
    throws CreateException
    System.out.println("ejbCreate call");
    if (balance < 0.00) {
    throw new CreateException
    ("A negative initial balance is not allowed.");
    try {
    insertRow(id, firstName, lastName, balance);
    } catch (Exception ex) {
    throw new EJBException("ejbCreate: " +
    ex.getMessage());
    this.id = id;
    this.firstName = firstName;
    this.lastName = lastName;
    this.balance = balance;
    return id;
    public void ejbPostCreate(String id, String firstname, String lastname, double blance)
    public String ejbFindByPrimaryKey(String primaryKey)
    throws FinderException
    System.out.println("ejbFindPrimaryKey call...");
    boolean result;
    try {
    result = selectByPrimaryKey(primaryKey);
    } catch (Exception ex) {
    throw new EJBException("ejbFindByPrimaryKey: " +
    ex.getMessage());
    if (result) {
    return primaryKey;
    else {
    throw new ObjectNotFoundException
    ("Row for id " + primaryKey + " not found.");
    public Collection ejbFindByLastName(String lastName)
    throws FinderException
    System.out.println("ejbFindByLastName call...");
    Collection result;
    try {
    result = selectByLastName(lastName);
    } catch (Exception ex) {
    throw new EJBException("ejbFindByLastName " +
    ex.getMessage());
    if (result.isEmpty()) {
    throw new ObjectNotFoundException("No rows found.");
    else {
    return result;
    public Collection ejbFindInRange(double low, double high)
    throws FinderException
    System.out.println("ejbFindRange call ....");
    Collection result;
    try {
    result = selectInRange(low, high);
    } catch (Exception ex) {
    throw new EJBException("ejbFindInRange: " +
    ex.getMessage());
    if (result.isEmpty()) {
    throw new ObjectNotFoundException("No rows found.");
    else {
    return result;
    public void ejbActivate()
    System.out.println("ejbActivate call ...");
    id = (String)context.getPrimaryKey();
    public void ejbLoad()
    System.out.println("ejbLoad call ...");
    try {
    loadRow();
    } catch (Exception ex) {
    throw new EJBException("ejbLoad: " +
    ex.getMessage());
    public void ejbPassivate()
    id = null;
    public void ejbRemove()
    System.out.println("ebjRemove call ...");
    try {
    deleteRow(id);
    } catch (Exception ex) {
    throw new EJBException("ejbRemove: " +
    ex.getMessage());
    public void ejbStore()
    System.out.println("ejbStore call ...");
    try {
    storeRow();
    } catch (Exception ex) {
    throw new EJBException("ejbLoad: " +
    ex.getMessage());
    public void setEntityContext(EntityContext context)
    this.context = context;
    System.out.println("setEntityContext call....");
    try {
    makeConnection();
    System.out.println("Came back from makeConnction call ...");
    } catch (Exception ex) {
    throw new EJBException("Unable to connect to database " +
    ex.getMessage());
    public void unsetEntityContext()
    System.out.println("unsetEntityContext call ...");
    try {
    con.close();
    } catch (SQLException ex) {
    throw new EJBException("unsetEntityContext: " + ex.getMessage());
    /*********************** Database Routines *************************/
    private void makeConnection() throws NamingException, SQLException
    System.out.println("makeConnection call...");
    try
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup("java:/MySqlDS");
    con = ds.getConnection();
    catch (Exception ex)
    System.out.println("Something went wrong within makeConnction call .... " + ex);
    private void insertRow (String id, String firstName, String lastName,
    double balance) throws SQLException {
    System.out.println("insertRow call...");
    String insertStatement =
    "insert into account values ( ? , ? , ? , ? )";
    PreparedStatement prepStmt =
    con.prepareStatement(insertStatement);
    prepStmt.setString(1, id);
    prepStmt.setString(2, firstName);
    prepStmt.setString(3, lastName);
    prepStmt.setDouble(4, balance);
    prepStmt.executeUpdate();
    prepStmt.close();
    private void deleteRow(String id) throws SQLException {
    System.out.println("deleteRow call ...");
    String deleteStatement =
    "delete from account where id = ? ";
    PreparedStatement prepStmt =
    con.prepareStatement(deleteStatement);
    prepStmt.setString(1, id);
    prepStmt.executeUpdate();
    prepStmt.close();
    private boolean selectByPrimaryKey(String primaryKey)
    throws SQLException {
    System.out.println("selectByPrimaryKey call...");
    String selectStatement =
    "select id " +
    "from account where id = ? ";
    PreparedStatement prepStmt =
    con.prepareStatement(selectStatement);
    prepStmt.setString(1, primaryKey);
    ResultSet rs = prepStmt.executeQuery();
    boolean result = rs.next();
    prepStmt.close();
    return result;
    private Collection selectByLastName(String lastName)
    throws SQLException {
    System.out.println("selectByLastName call...");
    String selectStatement =
    "select id " +
    "from account where lastname = ? ";
    PreparedStatement prepStmt =
    con.prepareStatement(selectStatement);
    prepStmt.setString(1, lastName);
    ResultSet rs = prepStmt.executeQuery();
    ArrayList a = new ArrayList();
    while (rs.next()) {
    String id = rs.getString(1);
    a.add(id);
    prepStmt.close();
    return a;
    private Collection selectInRange(double low, double high)
    throws SQLException {
    System.out.println("selectInRange call ....");
    String selectStatement =
    "select id from account " +
    "where balance between ? and ?";
    PreparedStatement prepStmt =
    con.prepareStatement(selectStatement);
    prepStmt.setDouble(1, low);
    prepStmt.setDouble(2, high);
    ResultSet rs = prepStmt.executeQuery();
    ArrayList a = new ArrayList();
    while (rs.next()) {
    String id = rs.getString(1);
    a.add(id);
    prepStmt.close();
    return a;
    private void loadRow() throws SQLException {
    System.out.println("loadRow call ....");
    String selectStatement =
    "select firstname, lastname, balance " +
    "from account where id = ? ";
    PreparedStatement prepStmt =
    con.prepareStatement(selectStatement);
    prepStmt.setString(1, this.id);
    ResultSet rs = prepStmt.executeQuery();
    if (rs.next()) {
    this.firstName = rs.getString(1);
    this.lastName = rs.getString(2);
    this.balance = rs.getDouble(3);
    prepStmt.close();
    else {
    prepStmt.close();
    throw new NoSuchEntityException("Row for id " + id +
    " not found in database.");
    private void storeRow() throws SQLException {
    System.out.println("storeRow call ...");
    String updateStatement =
    "update account set firstname = ? ," +
    "lastname = ? , balance = ? " +
    "where id = ?";
    PreparedStatement prepStmt =
    con.prepareStatement(updateStatement);
    prepStmt.setString(1, firstName);
    prepStmt.setString(2, lastName);
    prepStmt.setDouble(3, balance);
    prepStmt.setString(4, id);
    int rowCount = prepStmt.executeUpdate();
    prepStmt.close();
    if (rowCount == 0) {
    throw new EJBException("Storing row for id " + id + " failed.");
    2. ejb-jar.xml
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <enterprise-beans>
    <entity>
    <description>Entity Bean ( BMP )</description>
    <display-name>Account</display-name>
    <ejb-name>Account</ejb-name>
    <home>com.ps.AccountHome</home>
    <remote>com.ps.Account</remote>
    <ejb-class>com.ps.impl.AccountBean</ejb-class>
    <persistence-type>Bean</persistence-type>
    <prim-key-class>java.lang.String</prim-key-class>
    <reentrant>False</reentrant>
    </entity>
    </enterprise-beans>
    </ejb-jar>
    3. web.xml
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <description>Empty web.xml file for Web Application</description>
    <servlet>
    <servlet-name>AccountServlet</servlet-name>
    <servlet-class>com.ps.AccountServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>AccountServlet</servlet-name>
    <url-pattern>/accountservlet</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    </web-app>
    4. jboss.xml (i am not sure this is righ maybe this is the problem)
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">
    <jboss>
    <resource-managers>
    <resource-manager res-class="">
    <res-name>MySqlDS</res-name>
    <res-jndi-name>java:/MySqlDS</res-jndi-name>
    </resource-manager>
    </resource-managers>
    </jboss>
    5. mysql-service.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- ===================================================================== -->
    <!-- -->
    <!-- JBoss Server Configuration -->
    <!-- -->
    <!-- ===================================================================== -->
    <server>
    <!-- ==================================================================== -->
    <!-- New ConnectionManager setup for mysql using 2.0.11 driver -->
    <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
    <!-- ==================================================================== -->
    <mbean code="org.jboss.resource.connectionmanager.LocalTxConnectionManager" name="jboss.jca:service=LocalTxCM,name=MySqlDS">
    <!-- Include a login module configuration named MySqlDbRealm.
    Update your login-conf.xml, here is an example for a
    ConfiguredIdentityLoginModule:
    <application-policy name = "MySqlDbRealm">
    <authentication>
    <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
    <module-option name = "principal">yourprincipal</module-option>
    <module-option name = "userName">yourusername</module-option>
    <module-option name = "password">yourpassword</module-option>
    <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MySqlDS</module-option>
    </login-module>
    </authentication>
    </application-policy>
    NOTE: the application-policy name attribute must match SecurityDomainJndiName, and the
    module-option name = "managedConnectionFactoryName"
    must match the object name of the ConnectionManager you are configuring here.
    -->
    <!--uncomment out this line if you are using the MySqlDbRealm above
    <attribute name="SecurityDomainJndiName">MySqlDbRealm</attribute>
    -->
    <depends optional-attribute-name="ManagedConnectionFactoryName">
    <!--embedded mbean-->
    <mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=LocalTxDS,name=MySqlDS">
    <attribute name="JndiName">MySqlDS</attribute>
    <attribute name="ManagedConnectionFactoryProperties">
    <properties>
    <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://localhost:3306/pac</config-property>
    <config-property name="DriverClass" type="java.lang.String">org.gjt.mm.mysql.Driver</config-property>
    <!--set these only if you want only default logins, not through JAAS -->
    <config-property name="UserName" type="java.lang.String">t100</config-property>
    <config-property name="Password" type="java.lang.String">t200</config-property>
    </properties>
    </attribute>
    <!--Below here are advanced properties -->
    <!--hack-->
    <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper</depends>
    </mbean>
    </depends>
    <depends optional-attribute-name="ManagedConnectionPool">
    <!--embedded mbean-->
    <mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool" name="jboss.jca:service=LocalTxPool,name=MySqlDS">
    <attribute name="MinSize">0</attribute>
    <attribute name="MaxSize">50</attribute>
    <attribute name="BlockingTimeoutMillis">5000</attribute>
    <attribute name="IdleTimeoutMinutes">15</attribute>
    <!--criteria indicates if Subject (from security domain) or app supplied
    parameters (such as from getConnection(user, pw)) are used to distinguish
    connections in the pool. Choices are
    ByContainerAndApplication (use both),
    ByContainer (use Subject),
    ByApplication (use app supplied params only),
    ByNothing (all connections are equivalent, usually if adapter supports
    reauthentication)-->
    <attribute name="Criteria">ByContainer</attribute>
    </mbean>
    </depends>
    <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>
    <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:name=JaasSecurityManager</depends>
    <attribute name="TransactionManager">java:/TransactionManager</attribute>
    <!--make the rar deploy! hack till better deployment-->
    <depends>jboss.jca:service=RARDeployer</depends>
    </mbean>
    </server>

    In /JBoss/server/default/conf/standardjaws.xml.
    Set
    <datasource>java:/mySqlDS</datasource>
    <type-mapping>mySql</type-mapping>
    In /JBoss/server/default/conf/standardjbosscmp-jdbc.xml.
    Set
    <defaults>
    <datasource>java:/mySqlDS</datasource>
    <datasource-mapping>mySql</datasource-mapping></defaults>

  • Log4j problem occuring through use of MDC.

    Hey folks,
    I've encountered a bit of a problem with using log4j's MDC class within applications in weblogic. It's not a bug at all it's just giving me grief.
    Basically I've setup ApplicationLifecycleListener on my ear app and on all web apps within weblogic. They're there to catch startup events so that I can slot the application name into the MDC in order to be able to retrieve it when an exception occurs.
    Web :-
    MDC.put("APPLICATION_NAME", ce.getServletContext().getServletContextName());
    EJB :-
    MDC.put("APPLICATION_NAME", evt.getApplicationContext().getApplicationName();
    Alas as the lifecycle listener events are handled on a seperate thread where exceptions occur the MDC, being effectively a threadlocal hashmap, returns null when I attempt to retrieve the name of the app.
    I was wondering if anyone could think of a cleaner way of doing this? Perhaps using JMX or even by binding the contextClassLoader (which seems to remain the same across the threads into the JNDI tree with the application name)? Or else if anyone can think of any neater way of doing this that would be great.
    Thanks,
    Mark.

    Please perform the following steps..
    In the Web Dynpro Explorer of the Web Dynpro perspective expand your Web Dynpro project
      •&#61472;Expand the nodes DC Meta Data – DC Definition and right click on “Used DCs”
      •&#61472;Choose “Add used DC”
    Find the Web Dynpro project of the CAF DC
      •&#61472;Locate and select the public part with the model in the Web Dynpro project at DC metadata- Public Parts – package_tree – Entities
      •&#61472;Choose Dependency Type “Build Time”
      •&#61472;Press “Finish”
    •&#61472;Then add the following public parts:
    o public part
    types_compilation of DC caf/core/dict (CAF compartment)
    o public part
    com.sap.caf.ui.utils of DC caf/UI/ptn/common (CAF compartment)
    o public part default of DC tc/col/runtime (compartment SAP_JTECHS)
    Please also refer to this link for overalll help on this link.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8b7059da-0c01-0010-e09c-9ecabaf58864">Using a Composite Application via a Web Dynpro UI</a>

  • Log4j problem -creating directory

    My Log4j.properties is as follows:
    log4j.rootLogger=info,stdout, R
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%c %d{ISO8601} -- %p -- %m%n
    log4j.logger.org.apache.commons=INFO
    log4j.logger.org.apache.struts=INFO
    log4j.logger.org.hibernate=INFO
    log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.R.File=../CustomeLog/myLog
    log4j.appender.R.datePattern='_'MM-dd-yyyy'.txt'
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
    CustomLog folder does not exist in tomcat home directory.. i want it to be created automatically. i have written servlet for that. but problem is that servlet is read after log4.properties.. so tomcat gives me error fileNotFound as it cannot get CustomLog folder..
    can anybody help me on this issue?? My aim is that whenever tomcat starts, customLogs folder shud be created if it doesnot exists.. log4j takes the care of the rest..

    See if this forum thread helps:
    http://forums.sun.com/thread.jspa?threadID=5193205

  • Dummy://log4j.dtd (log4j problem in Oracle 10gAS)

    Hi,
    Wonder who has log4j.xml experience in EJB environment?
    I tried on Oracle 10gAS on Windows (the iAS version actually is still 9.0.4.2), my log4j initilization code looks like:
    InputStream inStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(sLogFileName);
    new DOMConfigurator().doConfigure(inStream, LogManager.getLoggerRepository());
    There is no problem to find the log4j.xml however the application server complains the log4j.dtd:
    04/10/08 18:48:18 Start process
    04/10/08 18:48:33 Oracle Application Server Containers for J2EE 10g (9.0.4.0.0) initialized
    04/10/08 18:49:09 log4j:ERROR Parsing error on line 0 and column 0
    04/10/08 18:49:09 log4j:ERROR File "dummy://log4j.dtd" not found.
    04/10/08 18:49:09 log4j:ERROR Could not parse input source [org.xml.sax.InputSource@177fa9a].
    04/10/08 18:49:09 org.xml.sax.SAXException: Stopping after fatal error: File "dummy://log4j.dtd" not found.
    04/10/08 18:49:09 at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1245)
    04/10/08 18:49:09 at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocument(DefaultEntityHandler.java:501)
    04/10/08 18:49:09 at org.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:314)
    04/10/08 18:49:09 at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1097)
    04/10/08 18:49:09 at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:195)
    04/10/08 18:49:09 at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:665)
    04/10/08 18:49:09 at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
    I check DOMConfiguration.java, it contains:
    docBuilder.setErrorHandler(new SAXErrorHandler());
    docBuilder.setEntityResolver(new Log4jEntityResolver());
    // we change the system ID to a valid URI so that Crimson won't
    // complain. Indeed, "log4j.dtd" alone is not a valid URI which
    // causes Crimson to barf. The Log4jEntityResolver only cares
    // about the "log4j.dtd" ending.
    inputSource.setSystemId("dummy://log4j.dtd");
    Document doc = docBuilder.parse(inputSource);
    parse(doc.getDocumentElement());
    Anybody has an idea and help me? Thanks in advance.

    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

  • JBoss install problem - nothing is installed

    Hello,
    I have installed aur/jboss package
    aur/jboss 5.1.0.GA-1 [installed] (53)
    JBoss Application Server
    But there is no /opt/jboss directory, no service added, nothing. When I try to uninstall it, it says:
    Packages (1): jboss-5.1.0.GA-1
    Total Removed Size: 0,00 MiB
    zip file with jboss is installed correctly, all additional files (build, service..) are too.
    What is the problem with this process ?

    Moving to AUR Issues...

  • 9.0.3 and Log4J problem

    Hi - running 9.0.3 with WebCache and HttpServer on Windows2000.
    If I add the Log4J-1.2.8.jar file to my /lib directory to use log4j, I cannot get the Enterprise Manager Console running. This is the error:
    500 Internal Server Error
    java.lang.NoClassDefFoundError
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:190)
         at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpApplication.loadServlet(HttpApplication.java:1890)
         at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpApplication.findServlet(HttpApplication.java:4355)
         at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2484)
         at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:617)
         at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:479)
    The NT processes in the Control panel/services are all running, WebCache administrator on port 4000 is running fine, the container accepts requests and the app seems to be fine.
    Anyody experience problems with Log4J so far?
    Tks
    Andre

    Found bug on Metalink with a resolution...
    Tks
    Put the new log4j.jar file in completely new location and modify application.xml for your OC4J instance to include the new log4j.jar using: <library path="/private/ias/ora9ias/mylog4j/lib" /> ---Use this if the same log4j.jar is being used by more than one application

  • JBoss authentication problem

    Hi all
    i am using jboss - UsernamepasswordLoginModule for username and password authentication. I want to know the way to restrict users after 3 bad logins.
    if user uses wrong password for three times successively then something should happen like he should not be able to login for next 30 minutes.
    It can be done in weblogic, but how to do it in jboss?
    thanx in advance.

    thanx but its not specified thereDid you read this part?:
    How do I configure security with JBoss ?
    JBoss uses JAAS for security. JBoss includes several JAAS login modules allowing applications to get their user info from LDAP servers, databases or property files (the last to simplify testing). There are also login modules for clients, so that they can send security information to the JBoss server. Note that an application that logs into JBoss must use JAAS to give user name and password. It is not possible to use the JNDI lookup information for that in JBoss. How to configure this is shown in chapter 8 of the free getting started guide.
    Did you check the "getting started guide"?
    Did you familiarize yourself with JAAS?
    Did you implement/configure a login module?
    Did you have a specific problem with the login module (errors, etc.)?
    Did you post this question at the JBoss Forum?
    Did you get an answer?
    Did you try anything at all about which you can post the details?
    Are you getting my point?

  • Jboss - Applet problem

    I am connecting to JBoss application server from a signed applet,
    my code is like this
    Hashtable env = new Hashtable();
                   env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" ) ;               
                   env.put("java.naming.provider.url", "SERVER_NAME") ;
                   env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces" ) ;
                   env.put("java.naming.security.principal", CBGlobals.USER_NAME);
                   env.put("java.naming.security.credentials", CBGlobals.PASSWORD);
                   Context ic = new InitialContext (env);
    now it gives me an error message
    java.lang.ExceptionInInitializerError
         at org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingContextFactory.java:42)
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
         at ChrBrowser.ChrBrowser.connectToServer(ChrBrowser.java:609)
         at ChrBrowser.ChrBrowser.<init>(ChrBrowser.java:127)
         at ChrBrowser.CBMain.init(CBMain.java:111)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Any hits or help will be cordially appreciated
    Renjith.

    thanks,
    I used the same link
    the problem occured becase i didnt sign jbossclient.jar with the same key with which other required jar files are signed

  • Jboss deploiment problem

    I have try to deploy my ADF application project to Jboss application server 4.2.2 and 5.0.1 and I have the same problem, when i add jboss in jdevelopper and i want to deploy my
    project to jboss this message will appear :
    Presentation not available: JSR-88, Interface: javax.enterprise.deploy.spi.DeploymentManager
    someone can help me!!!!.

    Hi!
    I have the same problem, when I try to deploy to Tomcat. Does any one have a solution to this problem, or a work around for deploying an application to a tomcat server.
    Br
    Casper

  • Log4j problem

    I am not able to store the log data into database after using JDBCAppender of log4j. I am getting the output in file but not in database. Following errors occurred while the execution of java code : -
    log4j:ERROR JDBCAppender::setSqlhandler(), sqlhandler must be derived of JDBCSql
    Handler !
    log4j:ERROR JDBCAppender::setSqlhandler(), sqlhandler must be derived of JDBCSql
    Handler !
    2007-03-27 18:50:18,642 [main] ERROR Log4jDemo - This is my error message.
    log4j:ERROR JDBCAppender::configure()
    java.lang.Exception: JDBCAppender::connect(), java.lang.InstantiationException:
    org.apache.log4j.jdbcplus.JDBCConnectionHandler
    at org.apache.log4j.jdbcplus.JDBCAppender.connect(JDBCAppender.java:981)
    at org.apache.log4j.jdbcplus.JDBCAppender.configure(JDBCAppender.java:99
    9)
    at org.apache.log4j.jdbcplus.JDBCAppender.ready(JDBCAppender.java:921)
    at org.apache.log4j.jdbcplus.JDBCAppender.append(JDBCAppender.java:843)
    at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
    at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders
    (AppenderAttachableImpl.java:65)
    at org.apache.log4j.Category.callAppenders(Category.java:203)
    at org.apache.log4j.Category.forcedLog(Category.java:388)
    at org.apache.log4j.Category.error(Category.java:302)
    at Log4jDemo.main(Log4jDemo.java:13)
    log4j:ERROR JDBCAppender::append(), Not ready to append !
    2007-03-27 18:50:18,672 [main] FATAL Log4jDemo - This is my fatal message.
    log4j:ERROR JDBCAppender::configure()
    java.lang.Exception: JDBCAppender::connect(), java.lang.InstantiationException:
    org.apache.log4j.jdbcplus.JDBCConnectionHandler
    at org.apache.log4j.jdbcplus.JDBCAppender.connect(JDBCAppender.java:981)
    at org.apache.log4j.jdbcplus.JDBCAppender.configure(JDBCAppender.java:99
    9)
    at org.apache.log4j.jdbcplus.JDBCAppender.ready(JDBCAppender.java:921)
    at org.apache.log4j.jdbcplus.JDBCAppender.append(JDBCAppender.java:843)
    at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
    at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders
    (AppenderAttachableImpl.java:65)
    at org.apache.log4j.Category.callAppenders(Category.java:203)
    at org.apache.log4j.Category.forcedLog(Category.java:388)
    at org.apache.log4j.Category.fatal(Category.java:362)
    at Log4jDemo.main(Log4jDemo.java:14)
    log4j:ERROR JDBCAppender::append(), Not ready to append !

    Check out how our WLS 8.1 sample application MedRec (which implements
    Struts) configures Log4j.
    "anand raman" <[email protected]> wrote in message
    news:[email protected]..
    the answer lies in log4j configuration
    http://jakarta.apache.org/log4j/docs/FAQ.html#configureandwatch
    Hope this helps
    anand
    "Eje Thorarinsson" <[email protected]> wrote in message
    news:<[email protected]>...
    Eh.....a clarification:
    - The Log4 version is of course 1.2.8 (DOH!)
    /Eje :)
    "Eje Thorarinsson" <[email protected]> wrote:
    Hi!
    Wonder if anyone can help me out with a problem with Log4J and WebLogic
    7.
    We've written an application that uses WLS and a whole bunch of open
    source stuff,
    such as Struts 1.1RC1. We use Log4J 1.5.3 for logging. The
    log4j.properties
    file
    is located in a config-directory, so we should be able to changelogging
    parameters
    on the fly. However, the application always loggs as INFO even if Ichange
    to
    DEBUG mode, so it doesn't seem that the properties file is beingacknowledged
    at all.
    I've tried using the set the JAVA_OPTIONS to:JAVA_OPTIONS=-Dlog4j.properties=file:/%REFAPP_HOME%/conf/app/log4j.propertie
    s
    >>>
    and using the PRE_CLASSPATH with the same path (excluding the file:/
    of course).
    I've also tried copying the properties file to my domain, but no go.
    What could
    be wrong? Any help would be greatly appreciated!
    Regards,
    /Eje

  • JMS - MDB, jboss deployment problem

    Hi everybody,
    I'm new to JMS/MDB and have following problem while deploying MDB under JBOSS:
    22:58:47,735 INFO [EjbModule] Deploying MyPublisher
    22:58:47,745 INFO [EjbModule] Deploying topicMessageBean
    22:58:47,795 WARN [StatelessSessionContainer] message-destination 'PhysicalTopic' has no jndi-name in jboss.xml
    22:58:47,845 INFO [ProxyFactory] Bound EJB Home 'MyPublisher' to jndi 'ejb/MyEj
    bReference'
    22:58:47,865 INFO [EJBDeployer] Deployed: file:/D:/DownLoads/ejb/JBoss/jboss-4.
    0.3/jboss-4.0.3/server/default/deploy/simplemessage.jar
    jboss.xml
    <jboss>
    <enterprise-beans>
    <message-driven>
    <ejb-name>topicMessageBean</ejb-name>
    <destination-jndi-name>topic/MyMDBTopic</destination-jndi-name>
    <mdb-connection-factory>
    <jndi-name>jms/MyTopicConnectionFactory</jndi-name>
    </mdb-connection-factory>
    </message-driven>
    <message-destination>
    <message-destination-name>PhysicalTopic</message-destination-name>
    <jndi-name>topic/MyMDBTopic</jndi-name>
    </message-destination>
    <session>
    <ejb-name>MyPublisher</ejb-name>
    <jndi-name>ejb/MyEjbReference</jndi-name>
    <resource-ref>
    <res-ref-name>jms/MyTopicConnectionFactory</res-ref-name>
    <jndi-name>jms/TopicConnectionFactory</jndi-name>
    <default-resource-principal>
    <name>guest</name>
    <password>guest</password>
    </default-resource-principal>
    </resource-ref>
    </session>
    </enterprise-beans>
    </jboss>
    ejb-jar.xml
    <ejb-jar>
    <display-name>MessageJAR</display-name>
    <enterprise-beans>
    <message-driven>
    <display-name>Topic Message Bean</display-name>
    <ejb-name>topicMessageBean</ejb-name>
    <ejb-class>MessageBean</ejb-class>
    <messaging-type>javax.jms.MessageListener</messaging-type>
    <message-selector></message-selector>
    <transaction-type>Container</transaction-type>
    <message-driven-destination>
    <destination-type>javax.jms.Topic</destination-type>
    <message-destination-link>PhysicalTopic</message-destination-link>
    </message-driven-destination>
    <activation-config>
    <activation-config-property>
    <activation-config-property-name>messageSelector</activation-config-property-name>
    <activation-config-property-value>NewsType = 'Sports' OR NewsType = 'Opinion'</activation-config-property-value>
    </activation-config-property>
    <activation-config-property>
    <activation-config-property-name>subscriptionDurability</activation-config-property-name>
    <activation-config-property-value>NonDurable</activation-config-property-value>
    </activation-config-property>
    </activation-config>
    </message-driven>
    <session>
    <display-name>MyPublisher</display-name>
    <ejb-name>MyPublisher</ejb-name>
    <home>PublisherHome</home>
    <remote>Publisher</remote>
    <ejb-class>PublisherBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <resource-ref>
    <res-ref-name>jms/MyTopicConnectionFactory</res-ref-name>
    <res-type>javax.jms.TopicConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <message-destination-ref>
    <!--message-destination-ref-name>topic/TopicName</message-destination-ref-name-->
    <message-destination-ref-name>topic/MyMDBTopic</message-destination-ref-name>
    <message-destination-type>javax.jms.Topic</message-destination-type>
    <message-destination-usage>Produces</message-destination-usage>
    <message-destination-link>PhysicalTopic</message-destination-link>
    </message-destination-ref>
    <security-identity>
    <use-caller-identity/>
    </security-identity>
    </session>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>topicMessageBean</ejb-name>
    <method-name>onMessage</method-name>
    <method-params>
    <method-param>javax.jms.Message</method-param>
    </method-params>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>MyPublisher</ejb-name>
    <method-intf>Remote</method-intf>
    <method-name>publishNews</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <message-destination>
    <message-destination-name>PhysicalTopic</message-destination-name>
    </message-destination>
    </assembly-descriptor>
    </ejb-jar>
    can somebody help???
    Zahid

    Hi,
    if possible, try with "max-bean-in-free-pool=1".
    note: it would be performance impact, as there would be single bean instance.
    Thanks,
    Qumar Hussain

Maybe you are looking for