Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
amir55
Post subject: What ways java to access beans in spring applicationcontext  PostPosted: Feb 22, 2010 - 07:51 PM
Registered Member
Registered Member


Joined: Oct 15, 2005
Posts: 173

hi dear all

1 - //used to be ok in previous versions to version 8
ApplicationContext applicationContext = new FileSystemXmlApplicationContext(new String ("src/applicationContext.xml"));

error
javax.servlet.ServletException: javax.faces.FacesException: Cant instantiate class: component1.ItemHandler.. IOException parsing XML document from file [D:\JBoss_GR\jboss-4.2.2.GA\bin\src\applicationContext.xml]; nested exception is java.io.FileNotFoundException: src\applicationContext.xml (The system cannot find the path specified)

2 - how to access in jave code the springDAOManager in next applicationContext.xml

<beans>

<bean id="husbandDAOService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="proxyTargetClass"><value>true</value></property><property name="transactionAttributes"></property>
<property name="target"><ref local="springDAOManager"/></property></bean>

</beans>

I tried next but not working for mismatch

SpringDAOManager springDAOManager = (SpringDAOManager)applicationContext.getBean("husbandDAOService"); // not ok


Amir
 
 View user's profile Send private message  
Reply with quote Back to top
support-shalini
Post subject: RE: What ways java to access beans in spring applicationcon  PostPosted: Feb 23, 2010 - 05:24 AM
Registered Member
Registered Member


Joined: May 18, 2009
Posts: 1532

Amir,
Can explain in detail what exactly you are trying to do?
Quote:

used to be ok in previous versions to version 8

Are you working on a project that is imported from an earlier version of MyEclipse?
Also, can you list out the steps to replicate the above issue?

_________________
Shalini
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
amir55
Post subject:   PostPosted: Feb 23, 2010 - 05:40 AM
Registered Member
Registered Member


Joined: Oct 15, 2005
Posts: 173

hi dear

1 - yes I use the projects from earlier versions

2 - I just try to re run those projects on version 8.

3 - I started with the jsf spring hibernte. I used to get the applicationContext.xml successfuly but now error thrown

ApplicationContext applicationContext = new FileSystemXmlApplicationContext(new String ("src/applicationContext.xml"));

error
error
javax.servlet.ServletException: javax.faces.FacesException: Cant instantiate class: component1.ItemHandler.. IOException parsing XML document from file [D:\JBoss_GR\jboss-4.2.2.GA\bin\src\applicationContext.xml]; nested exception is java.io.FileNotFoundException: src\applicationContext.xml (The system cannot find the path specified)

4 - more important spring question is

Hhow to access in jave code the springDAOManager in next applicationContext.xml

<beans>

<bean id="husbandDAOService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="proxyTargetClass"><value>true</value></property><property name="transactionAttributes"></property>
<property name="target"><ref local="springDAOManager"/></property></bean>

</beans>

I tried next but not working for mismatch. srurely it is as

a - SpringDAOManager is not husbandDAOService
b - husbandDAOService has no corrispondent bean. so how to do that thankfully

SpringDAOManager springDAOManager = (SpringDAOManager)applicationContext.getBean("husbandDAOService"); // not ok

Amir
 
 View user's profile Send private message  
Reply with quote Back to top
support-shalini
Post subject:   PostPosted: Feb 24, 2010 - 10:36 AM
Registered Member
Registered Member


Joined: May 18, 2009
Posts: 1532

Amir,
Can you try using absolute path for FileSystemXmlApplicationContext?
Please refer to the following link -
http://www.coderanch.com/forums/posts/watch/0/476364

_________________
Shalini
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits