Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2007

Tip: Looking for answers? Try searching our database.

Please help  I need to solve this

Thread view: 
kris - 13 Sep 2007 06:11 GMT
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)
Manish Pandit - 13 Sep 2007 06:25 GMT
> Hi
>
[quoted text clipped - 11 lines]
> 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
Andrew Thompson - 13 Sep 2007 06:46 GMT
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.

Signature

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

kris - 13 Sep 2007 08:38 GMT
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.
Andrew Thompson - 13 Sep 2007 09:52 GMT
>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..

Signature

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

Andrew Thompson - 13 Sep 2007 09:57 GMT
...
>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.

Signature

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

kris - 13 Sep 2007 11:02 GMT
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
Manish Pandit - 13 Sep 2007 20:49 GMT
>   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
Roedy Green - 13 Sep 2007 20:14 GMT
>Please don't be so pathetic.  

for once could you make a request with belittling the questioner.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Roedy Green - 13 Sep 2007 20:13 GMT
> [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?
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.