Please help I need to solve this

K

kris

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)
 
M

Manish Pandit

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
 
A

Andrew Thompson

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.
 
K

kris

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.
 
A

Andrew Thompson

kris said:
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..
 
A

Andrew Thompson

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
 
K

kris

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
 
R

Roedy Green

[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?
 
M

Manish Pandit

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top