You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by anil <an...@btinternet.com> on 2008/08/28 01:07:56 UTC

webapp: Cannot resolve reference to bean

Hi -

I'm trying to get a webapp up and running by packaging my cocoon webapp as a
war file & deploying to tomcat.

What I have done is create two blocks - one (mla-wrp) has a dependency on
the other (mla-wrp-editable-fragments):

So, in mla-wrp's block-service-servlet.xml file I have set up
mla-wrp-editable-fragments as a connection:

  <bean name="com.semantico.mla-wrp.service"
class="org.apache.cocoon.sitemap.SitemapServlet">
    <servlet:context mount-path="/mla-wrp"
context-path="blockcontext:/mla-wrp/">
      <servlet:connections>
        <entry key="mla-wrp-editable-fragments"
value-ref="com.semantico.mla-wrp-editable-fragments.service"/>
      </servlet:connections>
    </servlet:context>
  </bean>

I also have the ml-wrp-editable-fragment block set up as a dependency in the
mla-wrp pom.xml file. 

In mla-wrp-editable-fragments block, I have the block-servlet-service.xml
file set up as follows:


  <bean name="com.semantico.mla-wrp-editable-fragments.service"
class="org.apache.cocoon.sitemap.SitemapServlet">
    <servlet:context mount-path="/mla-wrp-editable-fragments"
context-path="blockcontext:/mla-wrp-editable-fragments/" />    
  </bean>

This works absolutely fine.

I then create a webapp, add in both blocks as a dependency into the pom.xml
and I get the following error:

Error creating bean with name 'com.semantico.mla-wrp.service': Cannot
resolve reference to bean 'com.semantico.mla-wrp-editable-fragments.service'
while setting bean property 'connections' with key [TypedStringValue: value
[mla-wrp-editable-fragments], target type [null]]; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'com.semantico.mla-wrp-editable-fragments.service': Invocation of
init method failed; nested exception is java.net.MalformedURLException:
Could not resolve blockcontext:/mla-wrp-editable-fragments/ due to
java.net.MalformedURLException: Unknown block name
mla-wrp-editable-fragments in block context uri
blockcontext:/mla-wrp-editable-fragments/

>From what I can gather from the documentation I have done everything that I
need to - 

Could anyone explain what the problem is here? or atleast what cocoon is
trying to do? Why can it run perfectly when I am running the mla-wrp block
using the rcl plugin, but I can't run the application in the way it is
supposed to be deployed!

If anyone could offer any assistance, I would be very grateful.

Many thanks,
Anil.
-- 
View this message in context: http://www.nabble.com/webapp%3A-Cannot-resolve-reference-to-bean-tp19191486p19191486.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: webapp: Cannot resolve reference to bean

Posted by anil <an...@btinternet.com>.

Hi -

I thought I would just respond to this thread as I've managed to resolve the
issue that I had.

As I mentioned in my previous posting, I mentioned that blocks were created
in the target directory. I modified the blockcontext path of my
mla-wrp-editable-fragments block (which is the one that is a dependency of
the first block) so that it included the version information - i.e.:



<bean name="com.semantico.mla-wrp-editable-fragments.service"  
class="org.apache.cocoon.sitemap.SitemapServlet">
    <servlet:context mount-path="/mla-wrp-editable-fragments"
context-path="blockcontext:/mla-wrp-editable-fragments-1.0.0/" />    
</bean>


and this resolved the issue.

You don't seem to have to do this when you are running 1 block with a
dependency of another - but you do have to do this when you are running the
webapp to package up the application. 

Fortunately, this change doesn't seem to affect the system when you're
running jetty over just the block - i.e. the configuration can stay like
this.

Anyway, hope that helps anyone who has the same problem.

Many thanks,
Anil.

-- 
View this message in context: http://www.nabble.com/webapp%3A-Cannot-resolve-reference-to-bean-tp19191486p19197647.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: webapp: Cannot resolve reference to bean

Posted by anil <an...@btinternet.com>.
One thing I should add, is that when I check the target directory of the
webapp, I do see two blocks created within the target/works/blocks directory
but it is rather strange - I see the block listing:

mla-wrp
mla-wrp-editable-fragments-1.0-SNAPSHOT

but in my poms the mla-wrp block is marked as 1.0-SNAPSHOT as well - so the
naming convention isn't consistent here. Could this be why I get the error
that the system cannot find the block it's looking for - i.e. it's looking
for mla-wrp-editable-fragments but what has actually been created is
mla-wrp-editable-fragments-1.0-SNAPSHOT.

Sorry, I know I'm clutching at straws here a bit but I'm just trying to
understand what is happening.

Many thanks,
Anil.
-- 
View this message in context: http://www.nabble.com/webapp%3A-Cannot-resolve-reference-to-bean-tp19191486p19191561.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org