Results 1 to 5 of 5

Thread: Getting FileNotFoundException for context file

  1. #1

    Default Getting FileNotFoundException for context file

    Hi,

    Stacktrace:
    Code:
    Caused by: javax.ejb.EJBException: Error in ejbCreate:: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [beanRefContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [beanRefContext.xml] cannot be opened because it does not exist
    java.io.FileNotFoundException: class path resource [beanRefContext.xml] cannot be opened because it does not exist
    Here is my ejb-jar.xml entries
    Code:
    		    <env-entry>
    				<env-entry-name>ejb/BeanFactoryPath</env-entry-name>
    				<env-entry-type>java.lang.String</env-entry-type>
    				<env-entry-value>beanRefContext.xml</env-entry-value>
    			</env-entry>
    beanRefContext.xml is present my EJBModule.jar when i do a build. While one applicationContext.xml is in WEB-INF folder.

    I understand that beanRefContext.xml is not in Classpath so it is giving FileNotFoundException. So what are the ways to resolve this issue.

    thanks
    Chintan

  2. #2

    Default

    Hi,

    I was able to solve problem by giving full path for env-entry value. here is change i made,
    Code:
    <env-entry>
    				<env-entry-name>ejb/BeanFactoryPath</env-entry-name>
    				<env-entry-type>java.lang.String</env-entry-type>
    				<env-entry-value>file:/F:/eclipse/workspace/LIKETest/business/conf/beanRefContext.xml</env-entry-value>
    			</env-entry>
    If i am giving full path then it works. But i dont want to give full path as it creates hard-coding.

    How can i put this entry into classpath so that i need not do hardcoding?

    Regards
    Chintan

  3. #3
    Join Date
    May 2007
    Posts
    5

    Default

    As you file is included in the Project . You may use "classpath:[Folder]filename" instead of hard coding it with the real path.

    Regards
    Kalyan

  4. #4
    Join Date
    Feb 2007
    Location
    Ireland and Boston
    Posts
    14

    Default

    Package the file in a JAR along with any other Spring application context you decide to use and add this jar to your App Lib directory along with your other JARS

  5. #5
    Join Date
    Sep 2007
    Posts
    7

    Default

    Hardcoding the complete path in ejb-jar.xml is not right. I would suggest place the "beanRefContext.xml" in root of the ejb jar file. And the other xml files (eg: ejb-jar.xml and jboss.xml etc) in the meta-inf directory.

    That way, the FileNotFoundException should get resolved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •