Log4j level inheritance concept doubt

log.properties file
log4j.debug=true
log4j.rootLogger=ERROR, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%m%n
log4j.logger.logging.basics=WARN, cs3
log4j.appender.cs3=org.apache.log4j.RollingFileAppender
log4j.appender.cs3.layout=org.apache.log4j.PatternLayout
log4j.appender.cs3.File=c:\\logas.txt
log4j.appender.cs3.layout.ConversionPattern=%m%n
log4j.appender.cs3.MaxFileSize=100KB
log4j.appender.cs3.MaxBackupIndex=1
log4j.additivity.com.durasoft.logging=false
log4j.logger.RAM=INHERITED, B1
log4j.appender.B1=org.apache.log4j.RollingFileAppender
log4j.appender.B1.layout=org.apache.log4j.PatternLayout
log4j.appender.B1.File=c:\\trylog.txt
log4j.appender.B1.layout.ConversionPattern=%m%n
log4j.appender.B1.MaxFileSize=100KB
log4j.appender.B1.MaxBackupIndex=1
package logging.basics;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.spi.RootLogger;
public class LogBasics
     public static void main(String[] args) throws IOException
          Properties prop = new Properties();
          FileInputStream stream = new  FileInputStream("logging\\Resources\\log.properties");
          prop.load(stream);
          PropertyConfigurator.configure(prop);
          Logger temp = Logger.getLogger("RAM");
          RootLogger root = (RootLogger)                     Logger.getRootLogger();
          temp.error("h1i"); 
          temp.warn("hel1lo");
}Refering to above code and properties file(in bold font), the logger named "RAM" didnt inherit from logging.basics package(which it lies), but inherits only from root, even though level and appenders for logging.basics package is specified in properties file.
I doubt, because according to level inheritance concept, the logger must inherit from parent level(assuming parent is not null).
Here parent ,is logging.basics for LogBasics class,so RAM logger must inherit from logging.basics as logging.basics is defined in properties file.
But,its not happening?Why it is so?
2) also please explain me what getLogger does when configured using property file
Thank you.

phanikrishnait wrote:
Hai
I have 3 class class A,B,C in multi level as below the method present in class A should only be accessed in A and B .Should not be visible in C and notaccessible for C class object.Java does not support that in general. In this specific case, if A and B are in the same package, and C is in a different package, and the method in question has package-private access level (not public, private, or protected).
However, if you're doing this, you almost certainly have a design flaw. My guess is you're trying to use inheritance for code sharing, which is not what it's for.

Similar Messages

  • Import org.apache.log4j.Level;

    Cannot Resolve Symbol
    symbol : class Level
    location: package log4j
    import org.apache.log4j.Level;
    Can anyone suggest something.
    Thanks Tiboy.

    Hi there,
    I have another doubt. Im trying to deploy a web application/J2EE. I use JBOSS. Now, after compiling and placing my jar files in the required directory and as i start the JBOSS server I get the following error in the console............
    10:11:06,551 WARN [jbossweb] java.lang.IllegalStateException: Servlet class
    com
    .ncit.user.server.servlet.MainPageRequestHandler is not a
    javax.servlet.Servlet
    java.lang.IllegalStateException: Servlet class
    com.ncit.user.server.servlet.Main
    PageRequestHandler is not a javax.servlet.Servlet
    at
    org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:203)
    I just can't seem to figure out whats the problem.
    My RequestHandler extends an Abstract Req.Handler which imports javax.* etc etc.
    Please suggest a solution.
    Thanks,
    Tiboy.

  • Serializing org.apache.log4j.Level

    Hi,
    I'm working with Log4j and I have to serialize an org.apache.log4j.Level that has not an empty constructor but only more static instaces.
    Is there a workaround to do this ?
    Or How can I use the static instance ?
    Thanks,
    Bye Luigia

    this is my XML file
    <java version="1.5.0_08" class="java.beans.XMLDecoder">
    <object class="org.apache.log4j.net.SyslogAppender">
    <void property="name">
    <string>my.syslog</string>
    </void>
    <void property="SyslogHost">
    <string>localhost</string>
    </void>
    <void property="Facility">
    <string>local0</string>
    </void>
    How can I specify the "Threshold" Property of the SyslogAppender at "INFO" or int value?
    The threshold is a org.apache.log4j.Level.

  • Log4j levels

    Hi,
    I am in need of one requirements. That is changing log levels dynamically through web application.
    I can do that by setting logger.setLevel(Level.DEBUG) or other levels. But If I set as DEBUG i am able to get error/info/fatal errors which we don't want. Is there any way to break the priority levels?

    They are our paying customers....I question this. Sorry, obviously you know your project and your customer better than me, but...
    If the customer explicitly forbids custom appenders, then it also explicitly mentions using log4j. So it is his responsibility to have choosen log4j, and it his his responsibility if there are conflicting requirements (such as, log only DEBUG but no higher log levels).
    If the customer hasn't mandated log4j, I don't see how it can forbid custom appenders ( a log4j notion).
    If the customer has mandated log4j, forbidden custom appenders, and required logging at DEBUG level but not higher, then it is you who made a wrong decision (you shouldn't implement the DEBUG-only log using lo4j).
    Nothing that a good requirements clarification meeting shouldn't solve.

  • 3 level inheritance

    A question that wouldn't come up if I had designed an
    existing system correctly, but too late now:
    I have 2 cfcs today, one is a subset of the other but I
    didn't design it w/ inheritance as I should have. Now we're
    essentially adding a layer of complexity ontop of the whole system,
    so I want to extend several cfc's to cover this. To simplify the
    new app, I'd like to just extend the 'bigger' of the 2 cfcs that
    exist today. In doing that, I would create the new subset cfc off
    the old full set, and then extend the new full set off that new
    subset. BUT, to really lock everything down I would want to
    override some data members and functions at the subset (L2) level.
    That's fine and dandy, but at L3, is there anyway to access the
    definitions for the functions at L1?
    It would look like this:
    L1 base class exists today with 100% content
    L2 proposed extension of L1 with 80% L1 content, rest
    overrode, plus it's own new content
    L3 proposed extension of L2 BUT need L1's 100% content plus
    100% L2's content plus it's own new content
    If there is no way to access the L1 definition in L3 if I
    overrode it in L2, then I'll have to extend both existing classes
    or live with extra data members and functions in L2.
    Any thoughts?

    A question that wouldn't come up if I had designed an
    existing system correctly, but too late now:
    I have 2 cfcs today, one is a subset of the other but I
    didn't design it w/ inheritance as I should have. Now we're
    essentially adding a layer of complexity ontop of the whole system,
    so I want to extend several cfc's to cover this. To simplify the
    new app, I'd like to just extend the 'bigger' of the 2 cfcs that
    exist today. In doing that, I would create the new subset cfc off
    the old full set, and then extend the new full set off that new
    subset. BUT, to really lock everything down I would want to
    override some data members and functions at the subset (L2) level.
    That's fine and dandy, but at L3, is there anyway to access the
    definitions for the functions at L1?
    It would look like this:
    L1 base class exists today with 100% content
    L2 proposed extension of L1 with 80% L1 content, rest
    overrode, plus it's own new content
    L3 proposed extension of L2 BUT need L1's 100% content plus
    100% L2's content plus it's own new content
    If there is no way to access the L1 definition in L3 if I
    overrode it in L2, then I'll have to extend both existing classes
    or live with extra data members and functions in L2.
    Any thoughts?

  • Inheritance Concept Explanation

    Hi,
    Java does not support multiple inheritence (atleast extending multiple classes).
    I wanted to know why java has come up with such idea which violates OOPS concept?
    I know that there can be confliction with overriding methods with same name and signature from different classes. But this might occur once in centuries cases, and not even that. Then why java has ommited such a beautiful concept?
    Definitely there has to be some other reason.
    Please discuss on it.
    Thanks and regards
    Gopal Krishan Sharma
    [email protected]
    [email protected]

    > i have been taught that think of java as the
    implementers of OOPS...
    Not by a long shot. OOP predates Java by roughly thirty years.
    > Tell me what could be the possible harm in this case...
    -- BEGIN QUOTE
    Interfaces and the 'diamond problem'
    One justification of interfaces that I had heard early on was that they solved the "diamond problem" of traditional multiple inheritance. The diamond problem is an ambiguity that can occur when a class multiply inherits from two classes that both descend from a common superclass. For example, in Michael Crichton's novel Jurassic Park, scientists combine dinosaur DNA with DNA from modern frogs to get an animal that resembled a dinosaur but in some ways acted like a frog. At the end of the novel, the heros of the story stumble on dinosaur eggs. The dinosaurs, which were all created female to prevent fraternization in the wild, were reproducing. Chrichton attributed this miracle of love to the snippets of frog DNA the scientists had used to fill in missing pieces of the dinosaur DNA. In frog populations dominated by one sex, Chrichton says, some frogs of the dominant sex may spontaneously change their sex. (Although this seems like a good thing for the survival of the frog species, it must be terribly confusing for the individual frogs involved.) The dinosaurs in Jurassic Park had inadvertently inherited this spontaneous sex-change behavior from their frog ancestry, with tragic consequences.
    This Jurassic Park scenario potentially could be represented by the following inheritance hierarchy:
              Animal
           Frog   Dinosaur
             FrogasaurThe diamond problem can arise in inheritance hierarchies like the one shown in Figure 1. In fact, the diamond problem gets its name from the diamond shape of such an inheritance hierarchy. One way the diamond problem can arise in the Jurassic Park hierarchy is if both Dinosaur and Frog, but not Frogosaur, override a method declared in Animal. Here's what the code might look like if Java supported traditional multiple inheritance:
    abstract class Animal {
        abstract void talk();
    class Frog extends Animal {
        void talk() {
            System.out.println("Ribit, ribit.");
    class Dinosaur extends Animal {
        void talk() {
            System.out.println("Oh I'm a dinosaur and I'm OK...");
    // (This won't compile, of course, because Java
    // only supports single inheritance.)
    class Frogosaur extends Frog, Dinosaur {
    }The diamond problem rears its ugly head when someone tries to invoke talk() on a Frogosaur object from an Animal reference, as in:
    Animal animal = new Frogosaur();
    animal.talk();Because of the ambiguity caused by the diamond problem, it isn't clear whether the runtime system should invoke Frog's or Dinosaur's implementation of talk(). Will a Frogosaur croak "Ribbit, Ribbit." or sing "Oh, I'm a dinosaur and I'm okay..."?
    The diamond problem would also arise if Animal had declared a public instance variable, which Frogosaur would then have inherited from both Dinosaur and Frog. When referring to this variable in a Frogosaur object, which copy of the variable -- Frog's or Dinosaur's -- would be selected? Or, perhaps, would there be only one copy of the variable in a Frogosaur object?
    In Java, interfaces solve all these ambiguities caused by the diamond problem. Through interfaces, Java allows multiple inheritance of interface but not of implementation. Implementation, which includes instance variables and method implementations, is always singly inherited. As a result, confusion will never arise in Java over which inherited instance variable or method implementation to use.
    -- END QUOTE
    http://www.javaworld.com/javaworld/jw-12-1998/jw-12-techniques.html

  • No Calrity on Multiple Inheritance Concept Of Java..!

    In SCJP Book by "karty serie " .
    In Java
    a subclass of class Object, (except of course class Object itself). In other words, every
    class you'll ever use or ever write will inherit from class Object. You'll always have
    an equals method, a clone method, notify, wait, and others, available to use.
    Whenever you create a class, you automatically inherit all of class Object's methods.
    A class cannot extend more than one class. That means one parent per class. A
    class can have multiple ancestors, however, since class B could extend class A, and
    class C could extend class B, and so on. So any given class might have multiple
    classes up its inheritance tree, but that's not the same as saying a class directly
    extends two classes.
    class PlayerPiece extends GameShape, Animatable { // NO!
    // more code
    If the above code is invalid, is it legal to write the code like ...
    class PlayerPiece extends GameShape, Object { // NO!
    // more code
    Thanks In Advance
    Kiran

    I think I can help straighten out what is confusing you.
    Let's say you have a class B that extends class A, and a class C that extends class B.
    Then class C implicitly extends class A, but java does not allow you to make that explicit.
    So, yes, in a way, class C does subtype both class A and B, but it only directly subclasses class B. The subtyping of class A is implicit.
    The following should demonstrate some patterns that should help clear things up:
    class A { } 
    // This automatically is a subclass of Object,
    // you don't need to specify that.
    // or
    class A extends Object { } 
    // This is legal, but not necessary, since a class
    // that doesn't extend anything else implicitly extends Object
    class B extends A { } 
    // This directly subclasses class A,
    // and implicitly subtypes Object
    // but
    class B extends A, Object { } 
    // This is NOT legal in java, and will not compile,
    // even though the previous code would
    // make class B a subtype of Object
    class C extends A { } 
    // Again, a direct subclass of A,
    // and indirect subclass of Object
    class D extends B, C { } 
    // This is NOT legal in java, and is what people
    // usually mean when they say that multiple
    // inheritance is prohibited.  In this case, you
    // are attempting to subclass two different
    // classes, where one is *not* a subtype of
    // another.  There is no work around to make
    // this happen in java, but you can use interfaces
    // and composition to get a similar effect with a
    // bit of glue code to hook things together.
    // For example:
    interface X {
      public void doX();
    class XImpl implements X {
      public void doX() {
        // do something
    interface Y {
      public void doY();
    class YImpl implements Y {
      public void doY() {
        // do something else
    class Z implements X, Y {
      private X x = new XImpl();
      private Y y = new YImpl();
      public void doX() {
        x.doX();
      public void doY() {
        y.doY();
    // This is basically what goes on behind the scenes
    // in languages like C++ that do support MI

  • Mandatory level check validation doubt

    Experts,
    In the fusion middle ware pdf it says
    Select the Mandatory checkbox if the field is required. The mandatory property is
    enforced during entity-level validation at runtime (and not when the attribute
    validators are run).
    Can some one please explain this to me.
    thnks

    it will add a database constraint that the value cannot be null
    Select if this attribute is mandatory. This option is selected by default if the corresponding database column has a NOT NULL constraint.

  • Question regd Inheritance Concept in 00 design

    In Inheritance,when a subclass extends a Superclass,
    the subclass is a specialized version of the superclass.Right?
    class B extends A{
    So,B is a specialized version of A.
    Supposing that class B also implements an Interface:
    class B extends A implements iFace{
    So now:
    Is B a specialized version of class A or a specialized version of an interface?
    Please can anyone answer?

    Both. You can treat it as class B, class A or
    interface iFace.
    This is how you get multiple interface inheritancein
    Java.Agree on the implmentation, disagree on the theory.
    B is a specialized version of A, but the interface is
    more a facet of B.No. In "class B extends A implements C" B is-a C just as it is-a A.
    For instance, a suburu imprezza is a specialized form
    of a car - but when my wife's brother add a load of
    rubbish to it, these are interfaces that it is
    implementing. It might be implementing the
    'SillyExpensiveAlloyWheels' interfaceThat's a poor design. You wouldn't have a care implement an interface for it's accessories as it doesn't make sense to say a particular type of care is-a SillyExpensiveAlloyWheels (ignoring the singular/plural mismatch).
    Look at the Collections framework.
    LinkedList is a list. It is a Collection. It is a Serializable. It is a Cloneable. It is an Object.
    An interface that a class implements is not just a "facet" of that class.

  • How does role inheritance work in GRC

    Hi All,
    We are implementing GRC PC 10.0 where we have activated Role inheritance for organization in Maintain Authorization Customization Node in SPRO.
    What i understood is by activating the role inheritance for organizations, you can specify that authorizations are to be passed on to lower levels of the organization. However I need to know if inheritance also helps in picking up the recipients while doing planning activity, I have two queries in this regard:
    For eg :
    1) if we have a Control Tester role maintained at subprocess and control level both and if a User is assigned to subprocess for Control tester role then in that case User will be also be mapped to all the control beneath the subprocess for Control tester role due to inheritance concept ..correct? and while planning for that particular control, does user maintained at subprocess level will be picked as a recipient ?
    2) A Control tester gets mapped at the subprocess level. This means that all controls under that subprocess would show this tester as inherited from the subprocess. However, if we do not want the inherited tester to perform the test, and instead map a tester at the control level, the inherited tester still appears. IN this case, will only the tester mapped at the control level receive the work inbox item for the control test (as this overrides the inherited tester), or will the inherited tester also receive it?
    Regards,
    Shikha

    The interface only needs loaded if one of its members
    is accessed (although this is probably implemented
    differently on different JVMs).No.
    The interface is loaded.
    It is not initialized. There is a difference. See section 12 of the JLS.
    Assuming the above is true, it appears the following
    is happening
    1. C is loaded because w is accessed from DD�s main .
    This loading causes �w� to be echoed and then �x� to
    be echoed since loading the interface initializes the
    members which in turn call the echo method (I am
    assuming that this only happends when the members are
    not �constants�).
    2. The main method then echoes the w variable (which
    is �w�).
    Having said this, I would think this code would behave
    differently on different JVMs so I am not sure how it
    could even be a �good� theoretical question (unless
    this is documented in the JLS).It is in the JLS.
    Also, loading the the interface may not really be what
    is happening; the initialization code may be in-lined
    in the class (this could be tested by printing w twice
    in main � really strange behaviour).No. It can't inline the initilization of one class in another class.

  • Use of inheritance....

    hi friends we are all say inheritance is one of the important concept in oops that will support ed by java,it will reduce the code length but in real world programming most of the cases we dont use inheritance concepts for user defined classes... My doubt is why we dont use
    inheritance is real time programming...?

    hi friends we are all say inheritance is one of the
    important concept in oops that will support ed by
    java, it will reduce the code length but in real worldI agree with the people here when they disagree with you on this.
    programming most of the cases we dont use inheritance
    concepts for user defined classes... Interesting. I thought every user-defined class is derived from Object. Besides that, maybe we often don't extend random classes all the time because we understand the OO design principles...
    My doubt is why
    we dont use
    inheritance is real time programming...?I assume it's because most real-time programs are written in C or other structured languages. But I'm sure there are exceptions.

  • Need help with log4j logging tool (org.apache.log4j.*) to log into database

    Hi,
    I need help with log4j logging tool (org.apache.log4j.*) to log into database using JDBCAppender. Have look at my logger code and corresponding log4j.properties file stated below. I'm running this program using Eclipse IDE and it's giving me the following error (highlighted in red) at the end:
    log4j: Parsing for [root] with value=[debug, stdout, Roll, CRSDBAPPENDER].
    log4j: Level token is [debug].
    log4j: Category root set to DEBUG
    log4j: Parsing appender named "stdout".
    log4j: Parsing layout options for "stdout".
    log4j: Setting property [conversionPattern] to [%x %d{HH:mm:ss,SSS} %5p [%t] (%c:%-4L %M) - %m%n].
    log4j: End of parsing for "stdout".
    log4j: Parsed "stdout" options.
    log4j: Parsing appender named "Roll".
    log4j: Parsing layout options for "Roll".
    log4j: Setting property [conversionPattern] to [%x %d{yyyy.MM.dd HH:mm:ss,SSS} %5p [%t] (%c:%-4L %M) - %m%n].
    log4j: End of parsing for "Roll".
    log4j: Setting property [file] to [HelloWorld.log].
    log4j: Setting property [maxBackupIndex] to [10].
    log4j: Setting property [maxFileSize] to [20KB].
    log4j: setFile called: HelloWorld.log, true
    log4j: setFile ended
    log4j: Parsed "Roll" options.
    log4j: Parsing appender named "CRSDBAPPENDER".
    {color:#ff0000}
    Can't find class HelloWorld{color}
    import org.apache.log4j.*;
    public class HelloWorld {
    static Logger log = Logger.getLogger(HelloWorld.class.getName());
    public static void main(String[] args) {
    try{
    // Now, try a few logging methods
    MDC.put("myComputerName", "Ravinder");
    MDC.put("crsServerName", "ARNDEV01");
    log.debug("Start of main()");
    log.info("Just testing a log message with priority set to INFO");
    log.warn("Just testing a log message with priority set to WARN");
    log.error("Just testing a log message with priority set to ERROR");
    log.fatal("Just testing a log message with priority set to FATAL");
    catch(Exception e){
    e.printStackTrace();
    ------------------------- log4j.properties file ------------------------------
    #### Use three appenders - log to console, file and database
    log4j.rootCategory=debug, stdout, Roll, CRSDBAPPENDER
    log4j.debug=true
    # Print only messages of priority WARN or higher for your category
    # log4j.category.your.category.name=WARN
    # Specifically inherit the priority level
    # log4j.category.your.category.name=INHERITED
    #### stdout - First appender writes to console
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%x %d{HH:mm:ss,SSS} %5p [%t] (%c:%-4L %M) - %m%n
    #### Roll - Second appender writes to a file
    log4j.appender.Roll=org.apache.log4j.RollingFileAppender
    ##log4j.appender.Roll.File=${InstanceName}.log
    log4j.appender.Roll.File=HelloWorld.log
    log4j.appender.Roll.MaxFileSize=20KB
    log4j.appender.Roll.MaxBackupIndex=10
    log4j.appender.Roll.layout=org.apache.log4j.PatternLayout
    log4j.appender.Roll.layout.ConversionPattern=%x %d{yyyy.MM.dd HH:mm:ss,SSS} %5p [%t] (%c:%-4L %M) - %m%n
    #### CRSDBAPPENDER - third appender writes to the database
    log4j.appender.CRSDBAPPENDER=org.apache.log4j.jdbc.JDBCAppender
    log4j.appender.CRSDBAPPENDER.Driver=net.sourceforge.jtds.jdbc.Driver
    log4j.appender.CRSDBAPPENDER.URL=jdbc:jtds:sqlserver:/arncorp15:1433;DatabaseName=LOG
    log4j.appender.CRSDBAPPENDER.USER=sa
    log4j.appender.CRSDBAPPENDER.PASSWORD=p8ss3doff
    log4j.appender.CRSDBAPPENDER.layout=org.apache.log4j.PatternLayout
    log4j.appender.CRSDBAPPENDER.sql=INSERT INTO LOG (computername, crsservername, logtime, loglevel, threadname, filename, linenumber, logtext) VALUES ('%X{myComputerName}', '%X{crsServerName}', '%d{dd MMM yyyy HH:mm:ss,SSS}', '%p', '%t', '%F', '%L', '%m')
    #log4j.appender.CRSDBAPPENDER.sql=INSERT INTO LOG(COMPUTERNAME,CRSSERVERNAME,LOGTIME,LOGLEVEL,THREADNAME,FILENAME,LINENUMBER,LOGTEXT) select host_name(),'${CRSServerName}${InstanceName}','%d','%5p','%t','%F','%L','%m%n'
    #log4j.appender.CRSDBAPPENDER.sql=INSERT INTO LOG (computername, crsservername, logtime, loglevel, threadname, filename, linenumber, logtext) VALUES ("%X{myComputerName}", "%X{crsServerName}", "%d{dd MMM yyyy HH:mm:ss,SSS}", "%p", "%t", "%F", "%L", "%m")
    ------------------------------- end of log4j.properties file ------------------------------
    Here is the directory structure of my program. My log4j.properties file and HelloWorld.class file are residing in folder HelloWorld\bin.
    HelloWorld\bin
    HelloWorld\lib
    HelloWorld\src
    Please note - The same program works fine for console and file appender when I comment the database appender part in my properties file.
    Thanks
    Ravinder

    try this :
    log4j.appender.PROJECT.Append=false

  • Shipping point at storage location level in ME2O

    hi Guys,
    I am using stock transport orders at storage location level, and it works fine, we have a customizing point to configure shipping point at storage location level.
    My doubt is if we can use also shipping point det. at storage location level for creating Deliveries for Subcontracting process in ME2O.
    It works only If I customize the shipping point det. at plant level, not considering the customizing at storage location level.
    kind regards
    Brian

    Dear Ram,
    Can you please specify the configuration that you have made? And which storage location determination rule are you using for your Delivery Type?
    Regards,
    Amitabha

  • EJB 3.0 Inheritance problem

    I have to persist classes Cat, BullDog and StBernard:
    class Animal {
    private int animalId;
    private String name;
    private String dtype;
    class Dog extends Animal {
    private int dogId;
    private String furColor;
    class BullDog extends Dog {
    private int bullDogId;
    private int fightCount;
    class StBernard extends Dog {
    private int stbernardId;
    private int livesSaved;
    class Cat extends Animal {
    private int catId;
    private String preferredCatFood;
    }Planned inheritance strategy is joined table strategy. There is no problem mapping and persisting Cat and Dog tables into database, but I cannot find a way how to annotate StBernard and BullDog classes to persist them. Is it possible at all?

    do you know any official doc or reference where I can find statement, that such inheritance is not possible? i.e. only one level inheritance is allowed in JPA? Will check @SecondaryTable to see if it is helpful or not.
    @SecondaryTable This annotation is used to specify a secondary table for the annotated entity class. Specifying one or more secondary tables indicates that the data for the entity class is stored across multiple tables.@SecondaryTable is not for me :(
    Edited by: marekst on Feb 7, 2008 6:36 AM

  • Log4j error while deploying EJB 3.0 in weblogic 10

    Hi Friends,
    I am migrating an application EJB from 2.0 to 3.0 annotations.
    The log4j-1.2.3 for the project is configured in this way, it is added to the startWeblogic.cmd in weblogic 10 as :
    set JAVA_OPTIONS=%JAVA_OPTIONS% -Dlog4j.configuration=log4j.properties
    Now i am trying to deploy my EAR file that contains an EJB 3.0 Project and a Web project , it gives following error while deployment.
    ###<Jan 29, 2010 8:21:01 PM EST> <Warning> <Deployer> <ALPITSWXP00001> <wlw-pricingdev-s10> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1264814461242> <BEA-149078> <Stack trace for message 149004
    weblogic.application.ModuleException: Exception preparing module: EJBModule(streamlinesuspenseEJB.jar)
    [EJB:011023]An error occurred while reading the deployment descriptor. The error was:
    org.apache.log4j.spi.RootCategory.<init>(Lorg/apache/log4j/Level;)V.
    at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:452)
    at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
    at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
    at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
    at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:16)
    at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:155)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:197)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:89)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:723)
    at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1190)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:248)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    java.lang.NoSuchMethodError: org.apache.log4j.spi.RootCategory.<init>(Lorg/apache/log4j/Level;)V
    at org.apache.log4j.LogManager.<clinit>(LogManager.java:113)
    at org.apache.log4j.Logger.getLogger(Logger.java:124)
    at com.jmfamily.common.log.LogManager.getLogger(LogManager.java:33)
    at com.jmfamily.common.log.LogManager.getLogger(LogManager.java:42)
    at com.jmfamily.jma.contract.ejb.SuspendedContractSOBean.<clinit>(SuspendedContractSOBean.java:33)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at weblogic.ejb.container.dd.xml.EjbAnnotationProcessor.processWLSAnnotations(EjbAnnotationProcessor.java:1699)
    at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.processWLSAnnotations(EjbDescriptorReaderImpl.java:346)
    at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.createReadOnlyDescriptorFromJarFile(EjbDescriptorReaderImpl.java:192)
    at weblogic.ejb.spi.EjbDescriptorFactory.createReadOnlyDescriptorFromJarFile(EjbDescriptorFactory.java:93)
    at weblogic.ejb.container.deployer.EJBModule.loadEJBDescriptor(EJBModule.java:1198)
    at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:380)
    at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
    at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
    at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
    at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:16)
    at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:155)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:197)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:89)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:723)
    at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1190)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:248)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    >
    If i remove the "set JAVA_OPTIONS=%JAVA_OPTIONS% -Dlog4j.configuration=log4j.properties" from the weblogic statrup script and install the EAR it will be installed , but the logger is not initialized.
    If the option "set JAVA_OPTIONS=%JAVA_OPTIONS% -Dlog4j.configuration=log4j.properties" added to the startup script and i deployed the OLD EJB 2.0 app , it is installed successfully, but it didnt let me deploy EJB 3.0 app.
    I am hitting my head around it for a day now, no success so far..
    Please provide you suggestions , thanks a lot to all in advance.
    Thanks
    Sachin

    Does the ejbCreate() method of the com.package.ejbimpl.RemoteServicesEjb class have an exception on it's throws clause that is not present on the ejbCreate() method of your home interface? If so, does the error go away if you add the exception to the home's ejbCreate() method? In general, you want checked exceptions in a throws clause to match between the interface declaration of the method and the implementation of the method on the bean class.
    - Matt

Maybe you are looking for