Announcement Announcement Module
Collapse
No announcement yet.
org.springframework.beans.BeanInstantiationExcepti on Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • org.springframework.beans.BeanInstantiationExcepti on

    hi i am getting an exception called org.springframework.beans.BeanInstantiationExcepti on

    PHP Code:
    {
    Module NameCdoOnlineWebErrorweblogic.management.DeploymentExceptionError creating bean with name 'datacon' defined in ServletContext reso
    urce 
    [/WEB-INF/ApplicationContext.xml]: Instantiation of bean failednested exception is org.springframework.beans.BeanInstantiationExceptionC
    ould not instantiate bean 
    class [com.ss.apps.cdoonline.common.daf.accessor.SearchAccessor]: Constructor threw exceptionnested exc
    eption is java
    .lang.ExceptionInInitializerError with nested exception:
    [
    java.lang.NullPointerException]

    and ApplicationContext.xml file is:
    PHP Code:
    ...............<bean id="dataSource" 
          
    class="org.springframework.jdbc.datasource.DriverManagerDataSource"
        <
    property name="driverClassName"
           <
    value>oracle.jdbc.driver.OracleDriver</value
        </
    property
        <
    property name="url"
           <
    value>jdbc:oracle:thin:@10.237.204.86:1521:CDOI1</value
        </
    property
        <
    property name="username"
           <
    value>CDOPHASE2</value
        </
    property
        <
    property name="password"
           <
    value>CDOPHASE2</value
        </
    property
      </
    bean
      <
    bean id="datacon" class="com.ss.apps.cdoonline.common.daf.accessor.SearchAccessor"
        <
    property name="dataSource"
            <
    ref local="dataSource"/> 
        </
    property
      </
    bean> ...... 

  • #2
    From the JDK API (ExceptionInInitializerError):

    Signals that an unexpected exception has occurred in a static initializer. An ExceptionInInitializerError is thrown to indicate that an exception occurred during evaluation of a static initializer or the initializer for a static variable.
    So check your class "SearchAccessor" where that nested NullPointerException happens.

    Regards,
    Andreas

    Comment


    • #3
      Originally posted by Andreas Senft View Post
      So check your class "SearchAccessor" where that nested NullPointerException happens.

      Regards,
      Andreas
      hmm thats good, i got the solution, in Search Aceesor i was using logger as :

      PHP Code:
          SPLogger oDebugLogger SPLogger.getLogger("DebugLogger");
          
      SPLogger oErrorlogger SPLogger.getLogger("ErrorLogger");
          
      SPLogger oInfoLogger SPLogger.getLogger("InfoLogger"); 
      now i assigned to null:

      PHP Code:
          SPLogger oDebugLogger null;
          
      SPLogger oErrorlogger null;
          
      SPLogger oInfoLogger null
      how to configure for logger in my AppplicationContext.xml file so that need not assign logger to null in my SearchAccessor class.

      Comment


      • #4
        You might consider declaring your logger instance to be non-static. That way there should be no issue with static initialization proceedings.

        Regards,
        Andreas

        Comment


        • #5
          in that cases i need to change my existing application many places, cant we declare static initializer?

          i have declared a bean class for logger as:
          PHP Code:
          <bean name="logger" class="com.ss.framework.logger.SPLogger">
            <
          constructor-arg index="0">
                    <
          value>Accessor</value>
            </
          constructor-arg>
            </
          bean
          here problem solved.

          Comment


          • #6
            You pass the class using the logger as constructor argument to the logger itself? That seems strange to me.

            Is the problem that the logger itself is configured via Spring? In that case you might have a look at the "depends-on" attribute to ensure that the logger bean is constructed and initialized first. Unfortunately you need to specify that on every bean using the logger.

            Regards,
            Andreas

            Comment

            Working...
            X