This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Strange Spring problem

 
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm getting a strange compilation error while trying my first Spring applications, where I'm passing a reference to a FileInputStream to the constructor of an XmlBeanFactory. It's saying that constructor is not found!

Can anybody tell me what can be the problem ?

Thanks in advance ...
[ October 03, 2007: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me peak into my crystal ball and see if I can read your code from here. Man, this is tough. It's pretty cloudy. I wish there was an easier way. My crystal ball just isn't working right.

Ok, how about you post your relevant code/configuration here so I can let my crystal ball take a break.
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lolllll

Here it goes:



Thanks in advance ...
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the stack trace as well as your test.xml file as well? We need all the information.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course, it could be because XmlBeanFactory doesn't accept a String as a constructor argument.

http://www.springframework.org/docs/api/org/springframework/beans/factory/xml/XmlBeanFactory.html#XmlBeanFactory(org.springframework.core.io.Resource)
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need a crystal ball to find that out
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not passing a String, I'm passing a reference to a FileInputStream ...
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm passing a reference to a FileInputStream


The problem is that there's no such constructor for the XmlBeanFactory. Use a FileSystemResource instead :
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I used FileSystemResource and it's giving me the following exception:



 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Commons logging from apache jakarta is missing on your classpath.
There is quite a bunch of libraries, spring depends on.
Download the with-dependencies thing (for example: http://sourceforge.net/project/showfiles.php?group_id=73357&package_id=173644&release_id=538515)
You dont need any of those jars for a little project. Newer books tend to start with a short introductions about when which jar is needed. Currently I can't find such information online. Of course for starting you may put all jars from the with-dependencies download in your classpath. Or start with spring.jar and add those which are missing.
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have included the apache commons API in my classpath, but yet another problem raised now , here it is:



and here's my test.xml file



Can anybody tell me what's going on ? I'm so confused about this

Thanks in advance ...
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Vassili,
Try working with the DTD in place of schema to the spring context file.

use this--

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
........
.......
</beans>

I think that will work.
bye
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It worked

Thanks alot
 
mooooooo ..... tiny ad ....
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!