Results 1 to 17 of 17
  1. #1
    Addymails is offline Member
    Join Date
    Jan 2012
    Posts
    14
    Rep Power
    0

    Default What is this XmlBeanFactory depricated in java ?

    Hello i am new to spring framework .. in the code
    XmlBeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource(
    "application.xml"));*/

    i am getting an error XmlBeanFactory depricated, so when this is depricated, by which we can load spring config ?
    i tried ApplicationContext applicationContext = new ClassPathXmlApplicationContext("application.xml"); but still i am getting some exceptions and errors

    So can anyone please help me how to overcome this issue :)

    Tqqq

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: What is this XmlBeanFactory depricated in java ?

    Look at the API.
    Generally when something is deprecated the API will explain what you should be doing.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default Re: What is this XmlBeanFactory depricated in java ?

    And the deprecation cannot be an error anyway. Your error must be related with something else you have done in your code. Deprecated stuff are still able to use. And also as Tolls said, Java API explains the available alternatives for those.

    If you could post the error we can have a look at it.

  4. #4
    Addymails is offline Member
    Join Date
    Jan 2012
    Posts
    14
    Rep Power
    0

    Default Re: What is this XmlBeanFactory depricated in java ?

    Tqqq,
    using ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
    "META-INF/config.xml");
    Splittermanager splittermanager = (Splittermanager) applicationContext
    .getBean("splitter1");
    the issue got resolved .. But while running the program i am getting an exception

    Exception in thread "main" java.util.IllegalFormatConversionException: d != java.lang.String
    at java.util.Formatter$FormatSpecifier.failConversion (Formatter.java:4045)
    can anyone please tell me what this exception means ?

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: What is this XmlBeanFactory depricated in java ?

    Where is that exception coming from in your code?
    WHat line?

  6. #6
    Addymails is offline Member
    Join Date
    Jan 2012
    Posts
    14
    Rep Power
    0

    Default Re: What is this XmlBeanFactory depricated in java ?

    Hello Tolls, i am sorry but that isue got resolved now, i found the place of exception n its resolved

    Thank you very much

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default Re: What is this XmlBeanFactory depricated in java ?

    Quote Originally Posted by Addymails View Post
    can anyone please tell me what this exception means ?
    Java API explains all the exceptions as well. So keep the API as your reference all the time with you.

    IllegalFormatConversionException (Java 2 Platform SE 5.0)

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default Re: What is this XmlBeanFactory depricated in java ?

    Quote Originally Posted by Addymails View Post
    Hello Tolls, i am sorry but that isue got resolved now, i found the place of exception n its resolved


    If you think that the solution you found has a value and worth to share, post it here. Because there may be some members who has the same issues and your comment could really helpful to them as well.

  9. #9
    Addymails is offline Member
    Join Date
    Jan 2012
    Posts
    14
    Rep Power
    0

    Default Re: What is this XmlBeanFactory depricated in java ?

    @Eranga Tqqqqqqq

    Sure, in my code i have used constructor injection with different data types, string n integer combination, then without using the getter methods i used only one method which has collection of all information

    there i found this IllegalFormatConversionException, bcoz of different data types

  10. #10
    Addymails is offline Member
    Join Date
    Jan 2012
    Posts
    14
    Rep Power
    0

    Default Re: What is this XmlBeanFactory depricated in java ?

    I have another query - My TL was saying that if your working on Maven project you dnt have to download and build log4j , so can u please help me how add n how to find the log files of my maven project ?

    Thank you :)

  11. #11
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: What is this XmlBeanFactory depricated in java ?

    There'll be a log4j.properties somewhere in your project defining where your log files go.

  12. #12
    Addymails is offline Member
    Join Date
    Jan 2012
    Posts
    14
    Rep Power
    0

    Default Re: What is this XmlBeanFactory depricated in java ?

    I'm sorry, may be my q'n was nt so clear, let me rephrase .. i have a maven project, i want to have log file of that project, without adding externally log4j :)

    i hope i am clear now :P

    Thanks

  13. #13
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: What is this XmlBeanFactory depricated in java ?

    Ah, the jar.
    Then you need to add log4j to your pom.
    If you have another project that already has it then do what I do and copy the dependency over, changing the version if need be.
    There are plugins for IDEs that'll search a repository for you and add it into the pom, but I tend to stick to the old-fashioned way...:)

  14. #14
    Addymails is offline Member
    Join Date
    Jan 2012
    Posts
    14
    Rep Power
    0

    Default Re: What is this XmlBeanFactory depricated in java ?

    @Toll, i am afraid, i dont have any previous project, i am dng this first tym,

    can you please tell me hwo to add this log4j in the pom and what all the dependancy code necessary to change ?

  15. #15
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: What is this XmlBeanFactory depricated in java ?

    Add it to the pom, as I said.
    I'm sure there's plenty of Maven documentation you can look at to see the structure.

  16. #16
    Addymails is offline Member
    Join Date
    Jan 2012
    Posts
    14
    Rep Power
    0

    Default Re: What is this XmlBeanFactory depricated in java ?

    Thank you @Toll

    i have one more query,

    I have a spring project, in which i am using .properties file to send the information to configuration xml file

    <!-- Externalizing the configuration -->
    <bean id="propertyConfigurer"
    class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="location">
    <value>connection.properties</value>
    </property>
    </bean>

    now i have a class which does nt have any properties, which has only method which work on the properties of .properties file (information), so i have to add this class in my xml file

    <bean id="works" class="com.manger.merit">
    </bean></beans> -- is it enough to add this class in configuration xml or do i have to add anything else (Normally ve added properties name n value, since i dont have wht i have to do)

    please help me

    Thanks

  17. #17
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: What is this XmlBeanFactory depricated in java ?

    You really ought to raise different questions in a new thread.
    If the bean has no attributes that require wiring then you just need the entry as you have it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •