Getting No bean named defined while implementing storage extension in Tridion 2011 SP1

陌路散爱 提交于 2019-12-12 13:26:33

问题


I am trying to implement the storage extension using below example,

http://www.sdltridionworld.com/articles/sdltridion2011/tutorials/extending-content-delivery-storage-sdltridion-2011-1.aspx

I created my DAO and other files with the same name used in above example. After creating these files I build my code using eclipse and coverted it into .JAR file name (cd_search_Indexer).

1) I copied my jar file to my presentation tridion_home/lib folder

2) I created bundle xml with name search_dao_bundle.xml as below and placed on same location i.e. tridion_home/config where my cd_storage_xml is placed.

<?xml version="1.0" encoding="UTF-8"?>
<StorageDAOBundles>
    <StorageDAOBundle type="persistence">
        <StorageDAO typeMapping="PublishAction" class="com.tridion.storage.extension.search.JPAPublishActionDAO" />
    </StorageDAOBundle>
</StorageDAOBundles>

3) After that I added my bundle entries into my cd_storage_conf.xml as below:

<StorageBindings>
    <Bundle src="search_dao_bundle.xml"/>
</StorageBindings>

and down under I created my new storage type as below:

<Storage Type="persistence" Id="searchdb" dialect="MSSQL" Class="com.tridion.storage.persistence.JPADAOFactory">
    <Pool Type="jdbc" Size="5" MonitorInterval="60" IdleTimeout="120" CheckoutTimeout="120" />
    <DataSource Class="com.microsoft.sqlserver.jdbc.SQLServerDataSource">
        <Property Name="serverName" Value="********" />
        <!--Property Name="portNumber" Value="1433" /-->
        <Property Name="databaseName" Value="********" />
        <Property Name="user" Value="********" />
        <Property Name="password" Value="********" />
    </DataSource>
</Storage>

After that for itemmapping I did below

<ItemTypes defaultStorageId="defaultdb" cached="false"> 
    <Item typeMapping="PublishAction" cached="false" storageId="searchdb" />
</ItemTypes>

4) I restarted my deployer service got below exception in my core logs

2013-01-03 12:44:20,713 ERROR JPADAOFactory - Unable to load JPA DAO with name: PublishAction and class: com.tridion.storage.extension.search.JPAPublishActionDAO due too exception in DAO construction
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'JPAPublishActionDAO' is defined
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:527) ~[spring-beans.jar:3.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1083) ~[spring-beans.jar:3.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:274) ~[spring-beans.jar:3.0.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) ~[spring-beans.jar:3.0.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1087) ~[spring-context.jar:3.0.5.RELEASE]
    at com.tridion.storage.persistence.JPADAOFactory.configureBundle(JPADAOFactory.java:80) ~[cd_datalayer.jar:na]
    at com.tridion.storage.configuration.StorageFactoryConfigurationLoader.configureStorage(StorageFactoryConfigurationLoader.java:91) [cd_datalayer.jar:na]
    at com.tridion.storage.configuration.StorageFactoryConfigurationLoader.configureStorage(StorageFactoryConfigurationLoader.java:65) [cd_datalayer.jar:na]
    at com.tridion.storage.configuration.StorageFactoryConfigurationLoader.configure(StorageFactoryConfigurationLoader.java:51) [cd_datalayer.jar:na]
    at com.tridion.configuration.step.ConfigurationStepLoader.configure(ConfigurationStepLoader.java:47) [cd_core.jar:na]
    at com.tridion.storage.StorageManagerFactory.configure(StorageManagerFactory.java:139) [cd_datalayer.jar:na]
    at com.tridion.services.BaseService.<init>(BaseService.java:107) [cd_core.jar:na]
    at com.tridion.storage.StorageManagerFactory.<init>(StorageManagerFactory.java:106) [cd_datalayer.jar:na]
    at com.tridion.storage.StorageManagerFactory.reloadInstance(StorageManagerFactory.java:86) [cd_datalayer.jar:na]
    at com.tridion.storage.StorageManagerFactory.<clinit>(StorageManagerFactory.java:58) [cd_datalayer.jar:na]
    at com.tridion.storage.deploy.PageHandler.deploy(PageHandler.java:58) [cd_datalayer.jar:na]
    at com.tridion.deployer.DeploymentHandler.deploy(DeploymentHandler.java:90) [cd_datalayer.jar:na]
    at com.tridion.deployer.modules.PageDeploy.processPage(PageDeploy.java:145) [cd_deployer.jar:na]    
    at com.tridion.deployer.modules.PageDeploy.processItem(PageDeploy.java:118) [cd_deployer.jar:na]
    at com.tridion.deployer.SectionVisitor.processSection(SectionVisitor.java:83) [cd_deployer.jar:na]
    at com.tridion.deployer.SectionVisitor.processSection(SectionVisitor.java:87) [cd_deployer.jar:na]
    at com.tridion.deployer.SectionVisitor.processSection(SectionVisitor.java:87) [cd_deployer.jar:na]
    at com.tridion.deployer.SectionVisitor.processSection(SectionVisitor.java:87) [cd_deployer.jar:na]
    at com.tridion.deployer.SectionVisitor.process(SectionVisitor.java:60) [cd_deployer.jar:na]
    at com.tridion.deployer.Processor.process(Processor.java:109) [cd_deployer.jar:na]
    at com.tridion.deployer.workers.ProcessorWorker.doWork(ProcessorWorker.java:74) [cd_deployer.jar:na]
    at com.tridion.deployer.phases.ProcessingPhase.execute(ProcessingPhase.java:73) [cd_deployer.jar:na]
    at com.tridion.deployer.phases.DeployPipelineExecutor.runMainExecutePhase(DeployPipelineExecutor.java:186) [cd_deployer.jar:na]
    at com.tridion.deployer.phases.DeployPipelineExecutor.doExecute(DeployPipelineExecutor.java:97) [cd_deployer.jar:na]
    at com.tridion.deployer.phases.DeployPipelineExecutor.execute(DeployPipelineExecutor.java:61) [cd_deployer.jar:na]
    at com.tridion.deployer.TransactionManager.handleDeployPackage(TransactionManager.java:80) [cd_deployer.jar:na]
    at com.tridion.deployer.queue.QueueLocationHandler$1.run(QueueLocationHandler.java:176) [cd_deployer.jar:na]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.6.0_26]
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [na:1.6.0_26]
    at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.6.0_26]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [na:1.6.0_26]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.6.0_26]
    at java.lang.Thread.run(Unknown Source) [na:1.6.0_26]

Edit: Below are the steps I followed to create my DAO, Entity and Interface classes.

1) Open the eclipse helios

2) Created a project with name "Storage Extension"

3) Created new folder "lib" and added all the tridion_home/lib

4) Created new package "com.tridion.storage.extension.search"

5) Added my DAO, Entity and Interface java classes

6) Added 'lib' jars in reference

7) Build the package converted to jar (cd_storage_indexer)

8) copied the build jar into tridion_home/lib

9) Rest followed the same as Mihai has suggested.


回答1:


Tridion Forum user Pankaj Gaur ran into the same issue before.

We need to create the class file carefully when we are exporting them as JAR from Eclipse. To pin point on the solution: On the First screen while exporting the class file to JAR, make sure "Add Directory Entries" option is checked




回答2:


Your type mapping is wrong:

<StorageDAO typeMapping="PublishAction" ...

Each type mapping maps an existing item type to a (built-in or custom) DAO for that type. A PublishAction is not a built-in item type and I doubt you intended to store those.

Most likely you are looking to replace one of the existing item types, such as Binary and/or BinaryVariant like in Vinod's example.




回答3:


This is what I have for deployer extension config (cd_storage_conf)..

listing one then that one will be used for that publication unless it is overwriten on a lower level. If storage defined by storageId does not exist then default storage defined by ItemTypes element will be used unless lower level type mappings are not matched.

<Publication Id="000" defaultStorageId="TridionDB" cached="false">
  <Item typeMapping="BinaryVariant" storageId="defaultCdnFile" cached="false" /> 
  <Item typeMapping="Binary" storageId="defaultCdnFile" cached="false" /> 
  </Publication>


<Storage Type="filesystem" Class="com.tridion.extensions.storage.XXX.CDNFSDAOFactory" Id="defaultCdnFile" defaultFilesystem="false">
  <Root Path="X:\XXXXX\DeployerExtension" /> 
  <Mapping PublicationId="50" BaseURL="http://XXX.com" /> 
  <Akamai Username="xxxx" Password="xxxx" /> 
  <Setting Property="https.proxyHost" Value="xxxx" /> 
  <Setting Property="https.proxyPort" Value="0000" /> 
  <Setting Property="https.proxyUser" Value="xxxx" /> 
  <Setting Property="https.proxyPassword" Value="xxxx" /> 
  <Setting Property="https.proxyDomain" Value="xx" /> 
  <Setting Property="proxySet" Value="true" /> 
  </Storage>

Thanks Vin




回答4:


After few RND and suggestions given by Tridion Experts above, I finally managed to load my BEAN.

Instead of building JAR from eclipse, I tried to build it from Command Prompt (CMD).

Go to the bin directrory of your project and write below command over there

jar -cvf cd_storage_extensions.jar *

Thanks to all of the experts (Nuno, Frank and Vinod).



来源:https://stackoverflow.com/questions/14135716/getting-no-bean-named-defined-while-implementing-storage-extension-in-tridion-20

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!