Announcement Announcement Module
Collapse
No announcement yet.
classpath resource change from 3.0.2 to 3.0.5? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • classpath resource change from 3.0.2 to 3.0.5?

    Hi all,

    I have an application built using spring 3.0.2, which works fine. The problem is it craps out when I attempt to update the required libraries to 3.0.5.RELEASE.

    I current have this bean:

    Code:
    <!-- Wire up ArcGIS Server. -->
    	<bean id="arcGisState"
    	   class="ca.gc.agr.agmaf.model.cpl.bean.ArcGisState"
    	   p:domain="domain"
    	   p:user="user"
    	   p:password="pass"
    	   p:agsServerUrl="url"
    	   p:folder="classpath:projections"
    	   p:fileExtension=".prj"
    	   p:shapeFieldName="SHAPE"
    	   p:mapServiceName="service"
    	   p:landParcelIdFieldName="field"/>
    I then load a set of files contained within the folder. These are the supported projections. Like I said, this works in 3.0.2 but not 3.0.5. Here's the java code:

    Code:
    public class ArcGisState {
    
    ...
    
            /** The folder. */
    	private ClassPathResource folder;
    
    
    /**
    	 * Gets the folder.
    	 *
    	 * @return the folder
    	 */
    	public ClassPathResource getFolder() {
    		return folder;
    	}
    
    	/**
    	 * Sets the folder.
    	 *
    	 * @param folder the folder to set
    	 */
    	public void setFolder(ClassPathResource folder) {
    		this.folder = folder;
    	}
    
    
    /**
    	 * Loads configuration items from bean into object.
    	 * @throws IOException for file I/O exceptions.
    	 */
    	@PostConstruct
    	public void afterPropertiesSet() throws IOException {
    		
    		//Load projections from file.
    		if(log.isInfoEnabled()) {
    			log.info("#### Loading Projections... ####");
    			log.info("Folder: " + this.getFolder().getURL());
    			log.info("Extension: " + this.getFileExtension());
    		}
    		String[] files = this.getFolder().getFile().list();
    		if(files == null) throw new IOException("Projections folder is empty or incorrectly configured.");
    		for(String s: files) {
    			log.info("Loading projection " + CplUtils.getProjectionFromFilename(s) + " from " + this.getFolder().getFile().getAbsolutePath()+"\\" + s);
    			projectionsMap.put(CplUtils.getProjectionFromFilename(s), this.getFolder().getFile().getAbsolutePath()+ "\\" + s);
    		}
    		
    	}
    
    }
    The error occurs at the bolded spot.

    And the error is:
    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arcGisState': 
    Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path 
    resource [classpath:projections] cannot be resolved to URL because it does not exist

    It works in 3.0.2 but not 3.0.5.

    I'm assuming its not reading the classpath thing correctly, but I don't know how to fix it.

    Any suggestions?
Working...
X