Please help I need to solve this

Discussion in 'Java' started by kris, Sep 13, 2007.

  1. kris

    kris Guest

    Hi

    I am using Weblogic8.1 SP3 , Hibernate 3 and spring 1.2.3 version.
    While deploying the code , I am getting this exception. can any body
    help that how to solve this problem.



    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name 'sessionFactory' defined in ServletContext
    resource [/WEB-INF/applicationContext.xml]: Initialization of bean
    failed; nested exception is java.io.FileNotFoundException: class path
    resource [WEB-INF/classes/com/elemica/api/component/account/
    AccountBean.hbm.xml] cannot be opened because it does not exist
    java.io.FileNotFoundException: class path resource [WEB-INF/classes/
    com/elemica/api/component/account/AccountBean.hbm.xml] cannot be
    opened because it does not exist
    at
    org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:
    137)
    at
    org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:
    679)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:
    1091)
    at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:
    396)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:
    233)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:
    145)
    at
    org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:
    277)
    at
    org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:
    313)
    at
    org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:
    139)
    kris, Sep 13, 2007
    #1
    1. Advertising

  2. Re: Please help I need to solve this

    On Sep 12, 10:11 pm, kris <> wrote:
    > Hi
    >
    > I am using Weblogic8.1 SP3 , Hibernate 3 and spring 1.2.3 version.
    > While deploying the code , I am getting this exception. can any body
    > help that how to solve this problem.
    >
    > org.springframework.beans.factory.BeanCreationException: Error
    > creating bean with name 'sessionFactory' defined in ServletContext
    > resource [/WEB-INF/applicationContext.xml]: Initialization of bean
    > failed; nested exception is java.io.FileNotFoundException: class path
    > resource [WEB-INF/classes/com/elemica/api/component/account/
    > AccountBean.hbm.xml] cannot be opened because it does not exist
    > java.io.FileNotFoundException: class path resource [WEB-INF/classes/
    > com/elemica/api/component/account/AccountBean.hbm.xml] cannot be
    > opened because it does not exist


    Can you verify if the file it is complaining about exists?

    Location:

    your_app_root/WEB-INF/classes/com/elemica/api/component/account/
    AccountBean.hbm.xml


    -cheers,
    Manish
    Manish Pandit, Sep 13, 2007
    #2
    1. Advertising

  3. kris wrote:

    Sub: Please help I need to solve this

    Please don't be so pathetic. Other notes..
    - Is that a question? If so, adding a '?' at the end
    sure helps mark it as such.*
    - A subject of 'BeanCreationException in WebLogic' would
    be a lot better at attracting the attention of those who have
    most experience with this type of error. (And also help avoid
    acerbic comments as lead this reply).

    >I am using Weblogic8.1 SP3 , Hibernate 3 and spring 1.2.3 version.
    >While deploying the code , I am getting this exception. can any body
    >help that how to solve this problem.


    * 'Ditto' - please add question marks to questions.

    >org.springframework.beans.factory.BeanCreationException: Error


    OK - this it the immediate or end problem, but
    further down..

    >creating bean with name 'sessionFactory' defined in ServletContext
    >resource [/WEB-INF/applicationContext.xml]: Initialization of bean
    >failed; nested exception is java.io.FileNotFoundException: class path
    >resource [WEB-INF/classes/com/elemica/api/component/account/
    >AccountBean.hbm.xml] cannot be opened because it does not exist


    ..this seems to be the real or *underlying* problem.

    Some comments based on that..
    - Have you checked that path in the WEB-INF directory,
    to check that file actually *does* exist?
    - It seems odd to me that the Exception mentions the
    'classes' directory specifically. Any attempt to gain
    resources for a web app. (or app., or applet) should use
    Class.getResource("name") or similar to locate the
    resource in either the classes directory, *or* as part
    of an (.jar) archive in the ..'lib'(?) directory. If this code
    used the Class.gR() mehtod to locate the resource,
    it should have returned a null URL if the resource
    was not located, long before throwing an FNFE.
    The Exception instead suggests that some coder
    has perhaps *hard* *coded* that filename into the app.
    Slap them for me, there's a pet.

    --
    Andrew Thompson
    http://www.athompson.info/andrew/

    Message posted via http://www.javakb.com
    Andrew Thompson, Sep 13, 2007
    #3
  4. kris

    kris Guest

    Re: Please help I need to solve this

    Sorry,Ignore my english as my mother tounge is not English :). Dont
    mine.

    I verified that the file exists in the folder that specified inside
    the applicationContext.xml.

    And its inside the classes folder with the class files.
    kris, Sep 13, 2007
    #4
  5. Re: Please help I need to solve this

    kris wrote:
    >Sorry,Ignore my english as my mother tounge is not English :).


    Your English is every bit good enough to hold a
    technical discussion. After all, the fundamental
    language we all speak is 'Java'.

    (You stop apologising for your English*, and I'll
    refrain from apologising that English is the only
    language I understand. Deal?)

    >..Dont
    >mine.


    I am completely unstressed (relaxed).

    >I verified that the file exists in the folder that specified inside
    >the applicationContext.xml.


    OK. Thanks for confirming that.

    >And its inside the classes folder with the class files.


    Fine. But what about the other part of what I asked you?

    Why does the code ask for that file, by that exact
    *path*?

    That part does not make sense to me, though perhaps
    the server-side gurus can indentify a fault in my logic.
    That does seem a problem to me.

    * As an aside, the problem with being someone who speaks
    English as a 'native language' is that we too often make it
    too difficult for others to understand (mostly by accident).
    If there are any words I say that are unclear to you, please
    let me know, so that I might be able to explain, and gain
    more talent with communicating to people who use English
    as a second (3rd, or more..) language.

    Thanks in advance..

    --
    Andrew Thompson
    http://www.athompson.info/andrew/

    Message posted via http://www.javakb.com
    Andrew Thompson, Sep 13, 2007
    #5
  6. Re: Please help I need to solve this

    Andrew Thompson wrote:
    ...
    >Fine. But what about the other part of what I asked you?


    Sh*t! Sorry, but it was not an actual question,
    just a comment at the bottom of my earlier post.

    "- It seems odd to me that the Exception mentions the
    'classes' directory specifically. Any attempt to gain
    resources for a web app. (or app., or applet) should use
    Class.getResource("name") or similar to locate the
    resource in either the classes directory, *or* as part
    of an (.jar) archive in the ..'lib'(?) directory. If this code
    used the Class.gR() mehtod to locate the resource,
    it should have returned a null URL if the resource
    was not located, long before throwing an FNFE.
    The Exception instead suggests that some coder
    has perhaps *hard* *coded* that filename into the app.
    Slap them for me, there's a pet."

    I suspect this comment is central to the problem.

    --
    Andrew Thompson
    http://www.athompson.info/andrew/

    Message posted via JavaKB.com
    http://www.javakb.com/Uwe/Forums.aspx/java-general/200709/1
    Andrew Thompson, Sep 13, 2007
    #6
  7. kris

    kris Guest

    Re: Please help I need to solve this

    Actually we are using that one in the webapp only the directory
    structure follows


    APPROOT
    Pages
    Images
    WEB-INF
    Classes
    com.something....(In this folders I have the .hbm.xml's)
    lib
    applicationContext.xml ( this itself will load other parallel
    context xml's)

    The thing is the spring bean factory is not able to find the location
    of the hbm.xml file.
    And actually I am indirectly asking wether the path given is the
    correct one or something to change.
    Its a old code developed by somebody who is not in access.


    Thanks
    Kris
    kris, Sep 13, 2007
    #7
  8. kris

    Roedy Green Guest

    On Wed, 12 Sep 2007 22:11:45 -0700, kris <>
    wrote, quoted or indirectly quoted someone who said :

    > [WEB-INF/classes/com/elemica/api/component/account/
    >AccountBean.hbm.xml] cannot be opened because it does not exist
    >java.io.FileNotFoundException: class path resource [WEB-INF/classes/
    >com/elemica/api/component/account/AccountBean.hbm.xml] cannot be
    >opened because it does not exist

    Does there exist a file
    WEB-INF/classes/com/elemica/api/component/account/AccountBean.hbm.xml

    Is there a typo in there anywhere "elemica", caps off, .hbm ?

    If not, it is in a jar on the Classpath or in the ext directory?

    Is this some sort of persisted file that you are erroneously insisting
    must exist even the first time out?
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, Sep 13, 2007
    #8
  9. kris

    Roedy Green Guest

    On Thu, 13 Sep 2007 05:46:57 GMT, "Andrew Thompson" <u32984@uwe>
    wrote, quoted or indirectly quoted someone who said :

    >Please don't be so pathetic.


    for once could you make a request with belittling the questioner.
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, Sep 13, 2007
    #9
  10. Re: Please help I need to solve this

    On Sep 13, 3:02 am, kris <> wrote:
    > WEB-INF
    > Classes
    > com.something....(In this folders I have the .hbm.xml's)


    It is supposed to be classes (lower-case 'C'). If this is just a typo
    in the message, it is fine but if your app has WEB-INF/Classes instead
    of WEB-INF/classes, that could be a problem. Another way to test it
    out (if you know the file is there in its entirity, with the exact
    path as mentioned in the error) is to jar up the com-tree (everything
    under WEB-INF/classes) and add that jar to WEB-INF/lib, and removing
    the classes folder.

    -cheers,
    Manish
    Manish Pandit, Sep 13, 2007
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KK
    Replies:
    2
    Views:
    511
    Big Brian
    Oct 14, 2003
  2. Andrej Hocevar
    Replies:
    1
    Views:
    470
    Nick Austin
    Aug 18, 2003
  3. Replies:
    0
    Views:
    276
  4. tyler_durden
    Replies:
    7
    Views:
    334
    Nick Keighley
    Jan 3, 2005
  5. Simon
    Replies:
    2
    Views:
    389
    red floyd
    Jan 29, 2007
Loading...

Share This Page