facebook

MyEclipse and Spring problem

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #233798 Reply

    asaf_lahav
    Member

    – System Setup ——————————-
    Operating System and version: windows XP
    Eclipse version: 3.1
    Eclipse build id:
    Fresh Eclipse install (y/n): y
    Other installed external plugins: NONE
    Number of plugins in the <eclipse>/plugins directory that begin with org.eclipse.pde.*:
    MyEclipse version: 4.0m1
    Eclipse JDK version: 1.5.0_08
    Application Server JDK version: Tomcat 5.0
    Are there any exceptions in the Eclipse log file? No

    – Message Body ——————————-
    I am a trial MyEclipse user.
    When I attempted to use myEclipse with Spring framework (by adding spring capabilities to my project) and started coding a very trivial sample, i encountered a very persistent exception.

    My Code:

    
    sprngConf.xml
    -----------------
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
        <bean id="myDataSource"
                class="src.MySpringTest"
                destroy-method="close">
            <property name="myProp" value="myPropValue" />
        </bean>
    </beans>
    
    
    MySpringTest.java
    ----------------------
    
    package src;
    
    public class MySpringTest {
    
        private String _s = null;
            
        public void setMyProp(String s){
            this._s = s;
        }
        
        public void close(){
            System.out.println(new String("close called"));
        }
    
        public void Execute(){
            System.out.println(new String("hello world"));
            System.out.println(_s);
        }
    }
    
    
    myMain.java
    ---------------
    
    import org.springframework.beans.factory.xml.XmlBeanFactory;
    import org.springframework.core.io.FileSystemResource;
    import org.springframework.core.io.Resource;
    import src.MySpringTest;
    
    public class myMain {
    
        /**
         * @param args
         */
        public static void main(String[] args) {
            try{
                //XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("myFile.xml"));
                Resource res = new FileSystemResource("src\\sprngConf.xml");
                XmlBeanFactory bf = new XmlBeanFactory(res);
                MySpringTest mbo = (MySpringTest) bf.getBean("myDataSource");
        
                mbo.Execute();
            }
            catch(Exception ex){
                ex.printStackTrace();
            }
    
        }
    }
    
    

    The Exception i’m constantly bumping into is as follows:

    org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException))
    at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
    at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
    at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
    at org.springframework.beans.factory.support.AbstractBeanFactory.<init>(AbstractBeanFactory.java:99)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.<init>(AbstractAutowireCapableBeanFactory.java:104)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.<init>(AbstractAutowireCapableBeanFactory.java:113)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.<init>(DefaultListableBeanFactory.java:87)
    at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:67)
    at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:56)
    at myMain.main(myMain.java:15)
    Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException)
    at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
    at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
    … 10 more
    Caused by: java.lang.NullPointerException
    at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374)
    … 11 more

    ————————————————————————
    Please, I need your help with this.

    Thanks,
    Asaf

    #233830

    Dave Trussell
    Participant

    Do you have commons-logging.jar listed under Libraries in the Java Build Path? I’m going through Pro Spring and found I had pretty much the same problem until I threw commons-logging.jar at it.

    #233865

    asaf_lahav
    Member

    Actually I used the add capabilities feature of my eclipse.
    I have:
    Spring 1.2 All Libraries
    Spring 1.2 DAO Libraries
    Spring 1.2 Core Libraries

    All added to my projects build path.

    #233973

    asaf_lahav
    Member

    Hi All,

    I eventually discovered the reason this is not working for me.
    I am very disappointed to say that the reason this very simple project I built didn’t work. And it is myEclipse.

    As soon as I built a new pure java project (NOT USING myEclipse add capabilities) spring worked like a charm.

    Anyhow, to sum it up, My Eclipse cost me about a week.

    Sorry for the harsh opinion,
    Asaf

    #233976

    Riyad Kalla
    Member

    Asaf,
    We are sorry you ran into this issue, there does seem to be a problem with the commons-logging build that Spring was using in the version we included, we are going to upgrade that before release.

    #234675

    David Orriss Jr
    Participant

    @asaf_lahav wrote:

    Actually I used the add capabilities feature of my eclipse.
    I have:
    Spring 1.2 All Libraries
    Spring 1.2 DAO Libraries
    Spring 1.2 Core Libraries

    All added to my projects build path.

    Just an FYI.. If you include “Spring 1.2 All Libraries” you don’t need to include the DAO and Core entries. They’re included in the “All” configuration.

    #234720

    Riyad Kalla
    Member

    DaveO,
    We are changing this internally to respect the pre-reqs of these libraries better.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: MyEclipse and Spring problem

You must be logged in to post in the forum log in