permaculture playing cards*
The moose likes Other Application Frameworks and the fly likes Strange Spring problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Strange Spring problem" Watch "Strange Spring problem" New topic
Author

Strange Spring problem

Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
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 ]

Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.


GenRocket - Experts at Building Test Data
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
lolllll

Here it goes:



Thanks in advance ...
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Can you post the stack trace as well as your test.xml file as well? We need all the information.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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)
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You don't need a crystal ball to find that out


[My Blog]
All roads lead to JavaRanch
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
I'm not passing a String, I'm passing a reference to a FileInputStream ...
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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

Joined: Mar 08, 2007
Posts: 1585
Hi,

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



Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
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

Joined: Mar 08, 2007
Posts: 1585
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 ...
Ashish Ojha
Greenhorn

Joined: Oct 09, 2007
Posts: 2
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

Joined: Mar 08, 2007
Posts: 1585
It worked

Thanks alot
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Strange Spring problem
 
Similar Threads
Strange RMI Exception!
Can Web Service give different responses to the same request?
NoClassDefFound.
How do I get a FileReader from an InputStream?
TCP/IP connection to the host has failed