Note that there are some explanatory texts on larger screens.

plurals
  1. POClassNotFound Expection when loading beans in Grails
    primarykey
    data
    text
    <p>I have a jar file which has the beans defined in applicationContext.xml. I have added the jar file to the lib directory and also modified my build config to </p> <blockquote> <p>runtime "content:content-examiner-data:1.0"</p> </blockquote> <p>I have defined the beans in the resource.groovy as follows</p> <blockquote> <p>beans = {</p> <pre><code>importBeans("classpath*:/applicationContext.xml") </code></pre> <p>}</p> </blockquote> <p>The bean definitions are as follows</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mongo="http://www.springframework.org/schema/data/mongo" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt; &lt;mongo:mongo host="localhost" port="27017" /&gt; &lt;bean class="org.springframework.data.mongodb.core.MongoTemplate" id="mongoTemplate"&gt; &lt;constructor-arg ref="mongo"&gt;&lt;/constructor-arg&gt; &lt;constructor-arg value="documents"&gt;&lt;/constructor-arg&gt; &lt;/bean&gt; &lt;mongo:db-factory id="mongoDbFactory" dbname="database" mongo-ref="mongo"/&gt; &lt;mongo:mapping-converter id="converter" /&gt; &lt;bean id="gridTemplate" class="org.springframework.data.mongodb.gridfs.GridFsTemplate"&gt; &lt;constructor-arg ref="mongoDbFactory" /&gt; &lt;constructor-arg ref="converter" /&gt; &lt;/bean&gt; &lt;bean id="ceMongoStore" class="gov.ic.isso.ce.service.mongoimpl.CEStorageMongoImpl"&gt; &lt;constructor-arg ref="mongoTemplate" /&gt; &lt;constructor-arg ref="gridTemplate" /&gt; &lt;constructor-arg value="cedocs" /&gt; &lt;/bean&gt; &lt;/beans&gt; </code></pre> <p>I get an error as follows when running the app with run-app option</p> <pre><code> Error 2013-02-07 16:08:24,806 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error executing bootstraps: Cannot find class [gov.ic.isso.ce.service.mongoimpl.CEStorageMongoImpl] for bean with name 'ceMongoStore' defined in URL [jar:file:/C:/development/projects/sentrytrunk/Latest/fc/content-examiner-web/lib/content-examiner-data-1.0.jar!/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: gov.ic.isso.ce.service.mongoimpl.CEStorageMongoImpl Message: Cannot find class [gov.ic.isso.ce.service.mongoimpl.CEStorageMongoImpl] for bean with name 'ceMongoStore' defined in URL [jar:file:/C:/development/projects/sentrytrunk/Latest/fc/content-examiner-web/lib/content-examiner-data-1.0.jar!/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: gov.ic.isso.ce.service.mongoimpl.CEStorageMongoImpl Line | Method -&gt;&gt; 303 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 138 | run in java.util.concurrent.FutureTask | 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 908 | run in '' ^ 662 | run . . in java.lang.Thread Caused by ClassNotFoundException: gov.ic.isso.ce.service.mongoimpl.CEStorageMongoImpl -&gt;&gt; 202 | run in java.net.URLClassLoader$1 </code></pre> <p>when I do a dump of the jar file using jar tvf I get the following output</p> <pre><code>1472 Thu Feb 07 16:00:30 EST 2013 applicationContext.xml 709 Thu Feb 07 16:00:30 EST 2013 gov/ic/isso/ce/data/CEStorage.class 1946 Thu Feb 07 16:00:30 EST 2013 gov/ic/isso/ce/data/model/document/Document.class 1186 Thu Feb 07 16:00:30 EST 2013 gov/ic/isso/ce/data/model/document/DocumentStatus.class 5995 Thu Feb 07 16:00:30 EST 2013 gov/ic/isso/ce/service/mongoimpl/CEStorageMongoImpl.class 0 Thu Feb 07 16:00:34 EST 2013 META-INF/maven/ 0 Thu Feb 07 16:00:34 EST 2013 META-INF/maven/gov.ic.isso.content-examiner/ 0 Thu Feb 07 16:00:34 EST 2013 META-INF/maven/gov.ic.isso.content-examiner/content-examiner-data/ 1925 Thu Feb 07 15:54:44 EST 2013 META-INF/maven/gov.ic.isso.content-examiner/content-examiner-data/pom.xml 146 Thu Feb 07 16:00:34 EST 2013 META-INF/maven/gov.ic.isso.content-examiner/content-examiner-data/pom.properties </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload