You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ken Starks <ke...@lampsacos.demon.co.uk> on 2008/07/15 22:25:56 UTC

Java bean puzzle. using ecliplse plugin or not.

It depends which way I do things, but I am still having
problems with 'Your first Cocoon 2.2 Application'
because the Java Bean doesn't work.

But while experimenting with the Eclipse plugin
'Maven Integration for Eclipse' as a way of
generating the block, I suddenly found that the
Java-Bean did work.

Can anyone explain this behaviour, in terms that a
non-java-speaker might understand?

+++++++++++++++++++++++++++++++++++++++++++++++++

Details:

Method One: (don't work)
++++++++++++++++++

a. In the shell,
--------------
mvn archetype:generate -DarchetypeCatalog=http://cocoon.apache.org

<snip the details, I chose an artifactId of myBlock1>

cd myBlock1
mvn eclipse:eclipse
mvn jetty:run

b. Browser
-----------
Going to http://localhost:8888/myBlock1/spring-bean,

  <spring>#message</spring>
 
 
Method two (do work!)
++++++++++=+++++

a. in Eclipse
------------
(with 'Maven integration for eclipse' plugin
from update site:-
http://m2eclipse.sonatype.org/update-dev/ 
)

Menubar --.New --> Maven --> Maven Project
--> NEXT

un-check 'Use default Workspace location'
browse to your usual 'GettingStartedApp' directory
--> Next

Nexus Indexer. select artifact Id:-
cocoon-22-archetype-block
--> Finish

<snip, to fill in details. this time I chose 'myBlock2 >


Cocoon then creates and compiles the block

b. In the shell,
--------------


cd myBlock2
mvn jetty:run

c. Browser
-----------
Going to http://localhost:8888/myBlock2/spring-bean,

  <spring>This is a message coming from a Spring bean.</spring>
 
 

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


Re: Java bean puzzle. using ecliplse plugin or not.

Posted by David Legg <da...@searchevent.co.uk>.
Hi Grek,

>> Unfortunately, it's not fixed in trunk. Take a look at the history of 
>> this file[1] and you will see that is has not changed for more than a 
>> year now.
>>
>> The problem we see here is that archetype plug-in for Maven tries to 
>> find all expressions in files that it creates...
>> Unfortunately, #{message} is treated as an expression too but it 
>> shouldn't. It's [not] aimed at archetype plug-in but Cocoon's 
>> template generator.
>>
>> According to this[2] page (archetype uses velocity) the fix should be 
>> easy: we need to escape "#" character using "\#" and everything 
>> should work just fine...

Aha!  Well spotted ;-)

>> I'll try to fix this issue ASAP.

Thanks.  As this is may be someone's very first close encounter with 
Cocoon 2.2 we want to set a good example.

Regards,
David Legg


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


Re: Java bean puzzle. using ecliplse plugin or not.

Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
Grzegorz Kossakowski pisze:
> David Legg pisze:
>> Ken,
>>> Thankyou very much, David. I can confirm that the spring-bean now 
>>> does work properly.
>>
>> Thanks for confirming that.
>>
>>> How do we report this to the developers?
>>
>> Normally, you would open a new item in the bugs database (called JIRA) 
>> [1].
>>
>> However, I've just looked at the latest version of that file in the 
>> SVN repository and it looks like it is fixed already.  I think it is 
>> in the 'trunk' at this location: -
>>
>>  [svn 
>> trunk]\tools\archetypes\cocoon-22-archetype-block\src\main\resources\archetype-resources\src\main\resources\COB-INF\demo\spring-bean.jx.xml 
>>
>>
>>  The code looks like this: -
>>
>>  <demo>
>>    <module>${groupId}:${artifactId}</module>
>>    <spring>#{message}</spring>
>>  </demo>
>>
>> I suspect though that getting this change incorporated into the wide 
>> world is a little more involved than just issuing a new release of 
>> Cocoon because someone has to upload the new version to the official 
>> maven site I think.
> 
> Unfortunately, it's not fixed in trunk. Take a look at the history of 
> this file[1] and you will see that is has not changed for more than a 
> year now.
> 
> The problem we see here is that archetype plug-in for Maven tries to 
> find all expressions in files that it creates and tries to resolve these 
> expressions to correct values. The good example is ${artifactId} 
> expression that we see above. Archetype plug-in will resolve it to 
> artifactId of the block that it prepares.
> 
> Unfortunately, #{message} is treated as an expressions too but it 
> shouldn't. It's aimed at archetype plug-in but Cocoon's template generator.
> 
> According to this[2] page (archetype uses velocity) the fix should be 
> easy: we need to escape "#" character using "\#" and everything should 
> work just fine...
> 
>> Anyhow... the main thing is it has been covered and at some point the 
>> corrected version will be available.  In the meantime we can sit back; 
>> smug in the knowledge that we know the answer ;-)
> 
> As you see, there is a bug here so one should create a JIRA report. :-)
> 
> I'll try to fix this issue ASAP.

Argh...

Forgot to provide links:
[1] 
http://svn.eu.apache.org/viewvc/cocoon/trunk/tools/archetypes/cocoon-22-archetype-block/src/main/resources/archetype-resources/src/main/resources/COB-INF/demo/spring-bean.jx.xml?view=log
[2] http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html#getting_literal

-- 
Grzegorz Kossakowski

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


Re: Java bean puzzle. using ecliplse plugin or not.

Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
David Legg pisze:
> Ken,
>> Thankyou very much, David. I can confirm that the spring-bean now does 
>> work properly.
> 
> Thanks for confirming that.
> 
>> How do we report this to the developers?
> 
> Normally, you would open a new item in the bugs database (called JIRA) [1].
> 
> However, I've just looked at the latest version of that file in the SVN 
> repository and it looks like it is fixed already.  I think it is in the 
> 'trunk' at this location: -
> 
>  [svn 
> trunk]\tools\archetypes\cocoon-22-archetype-block\src\main\resources\archetype-resources\src\main\resources\COB-INF\demo\spring-bean.jx.xml 
> 
> 
>  The code looks like this: -
> 
>  <demo>
>    <module>${groupId}:${artifactId}</module>
>    <spring>#{message}</spring>
>  </demo>
> 
> I suspect though that getting this change incorporated into the wide 
> world is a little more involved than just issuing a new release of 
> Cocoon because someone has to upload the new version to the official 
> maven site I think.

Unfortunately, it's not fixed in trunk. Take a look at the history of this file[1] and you will see 
that is has not changed for more than a year now.

The problem we see here is that archetype plug-in for Maven tries to find all expressions in files 
that it creates and tries to resolve these expressions to correct values. The good example is 
${artifactId} expression that we see above. Archetype plug-in will resolve it to artifactId of the 
block that it prepares.

Unfortunately, #{message} is treated as an expressions too but it shouldn't. It's aimed at archetype 
plug-in but Cocoon's template generator.

According to this[2] page (archetype uses velocity) the fix should be easy: we need to escape "#" 
character using "\#" and everything should work just fine...

> Anyhow... the main thing is it has been covered and at some point the 
> corrected version will be available.  In the meantime we can sit back; 
> smug in the knowledge that we know the answer ;-)

As you see, there is a bug here so one should create a JIRA report. :-)

I'll try to fix this issue ASAP.

-- 
Best regards,
Grzegorz Kossakowski

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


Re: Java bean puzzle. using ecliplse plugin or not.

Posted by David Legg <da...@searchevent.co.uk>.
Ken,
> Thankyou very much, David. I can confirm that the spring-bean now does 
> work properly.

Thanks for confirming that.

> How do we report this to the developers?

Normally, you would open a new item in the bugs database (called JIRA) [1].

However, I've just looked at the latest version of that file in the SVN 
repository and it looks like it is fixed already.  I think it is in the 
'trunk' at this location: -

  [svn 
trunk]\tools\archetypes\cocoon-22-archetype-block\src\main\resources\archetype-resources\src\main\resources\COB-INF\demo\spring-bean.jx.xml

  The code looks like this: -

  <demo>
    <module>${groupId}:${artifactId}</module>
    <spring>#{message}</spring>
  </demo>

I suspect though that getting this change incorporated into the wide 
world is a little more involved than just issuing a new release of 
Cocoon because someone has to upload the new version to the official 
maven site I think.

Anyhow... the main thing is it has been covered and at some point the 
corrected version will be available.  In the meantime we can sit back; 
smug in the knowledge that we know the answer ;-)

Regards,
David Legg

[1] https://issues.apache.org/jira/browse/COCOON

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


Re: Java bean puzzle. using ecliplse plugin or not.

Posted by Ken Starks <ke...@lampsacos.demon.co.uk>.
Thankyou very much, David. I can confirm that the spring-bean now does 
work properly.

How do we report this to the developers?


David Legg wrote:
> Hi Ken,
>
>> It depends which way I do things, but I am still having
>> problems with 'Your first Cocoon 2.2 Application'
>> because the Java Bean doesn't work.
>>
>> Can anyone explain this behaviour, in terms that a
>> non-java-speaker might understand?
>
> I think the problem is that the 
> 'src/main/resources/COB-INF/demo/spring-bean.jx.xml' file contains an 
> old version of the JX syntax for getting hold of a javabean's property.
>
> Try editing the file so that instead of: -
>
>  <spring>#message</spring>
>
> It should say this: -
>
>  <spring>#{message}</spring>
>
>
> Regards,
> David Legg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>


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


Re: Java bean puzzle. using ecliplse plugin or not.

Posted by David Legg <da...@searchevent.co.uk>.
Hi Ken,

> It depends which way I do things, but I am still having
> problems with 'Your first Cocoon 2.2 Application'
> because the Java Bean doesn't work.
>
> Can anyone explain this behaviour, in terms that a
> non-java-speaker might understand?

I think the problem is that the 
'src/main/resources/COB-INF/demo/spring-bean.jx.xml' file contains an 
old version of the JX syntax for getting hold of a javabean's property.

Try editing the file so that instead of: -

  <spring>#message</spring>

It should say this: -

  <spring>#{message}</spring>


Regards,
David Legg


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


Re: Java bean puzzle. using ecliplse plugin or not.

Posted by David Legg <da...@searchevent.co.uk>.
> Anyone else see this too?  I've tried both approaches and have the same results.
>   

Yes I see it too.  I haven't looked too closely at the cause yet.

David Legg


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


Re: Java bean puzzle. using ecliplse plugin or not.

Posted by Ken Starks <ke...@lampsacos.demon.co.uk>.
I'm pretty sure the artifacts are not different, having done a 'compare' 
of the POMs in eclipse.

I don't know what an OSGi is, can you tell me how to check whether i 
have one?

Jeff Caldwell wrote:
> Anyone else see this too?  I've tried both approaches and have the same results.
>
> The only thing I can think is that there is not an OSGi running when we start jetty 
> with "mvn jetty:run".  Or perhaps the artifacts are actually different when running 
> from command line as opposed to running via the eclipse plug-in for maven?
>
> On Tue, Jul 15, 2008 at 09:25:56PM +0100, Ken Starks wrote:
>   
>> It depends which way I do things, but I am still having
>> problems with 'Your first Cocoon 2.2 Application'
>> because the Java Bean doesn't work.
>>
>> But while experimenting with the Eclipse plugin
>> 'Maven Integration for Eclipse' as a way of
>> generating the block, I suddenly found that the
>> Java-Bean did work.
>>
>> Can anyone explain this behaviour, in terms that a
>> non-java-speaker might understand?
>>
>> +++++++++++++++++++++++++++++++++++++++++++++++++
>>
>> Details:
>>
>> Method One: (don't work)
>> ++++++++++++++++++
>>
>> a. In the shell,
>> --------------
>> mvn archetype:generate -DarchetypeCatalog=http://cocoon.apache.org
>>
>> <snip the details, I chose an artifactId of myBlock1>
>>
>> cd myBlock1
>> mvn eclipse:eclipse
>> mvn jetty:run
>>
>> b. Browser
>> -----------
>> Going to http://localhost:8888/myBlock1/spring-bean,
>>
>>  <spring>#message</spring>
>>
>>
>> Method two (do work!)
>> ++++++++++=+++++
>>
>> a. in Eclipse
>> ------------
>> (with 'Maven integration for eclipse' plugin
>> from update site:-
>> http://m2eclipse.sonatype.org/update-dev/ )
>>
>> Menubar --.New --> Maven --> Maven Project
>> --> NEXT
>>
>> un-check 'Use default Workspace location'
>> browse to your usual 'GettingStartedApp' directory
>> --> Next
>>
>> Nexus Indexer. select artifact Id:-
>> cocoon-22-archetype-block
>> --> Finish
>>
>> <snip, to fill in details. this time I chose 'myBlock2 >
>>
>>
>> Cocoon then creates and compiles the block
>>
>> b. In the shell,
>> --------------
>>
>>
>> cd myBlock2
>> mvn jetty:run
>>
>> c. Browser
>> -----------
>> Going to http://localhost:8888/myBlock2/spring-bean,
>>
>>  <spring>This is a message coming from a Spring bean.</spring>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>     


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


Re: Java bean puzzle. using ecliplse plugin or not.

Posted by Jeff Caldwell <jc...@pace2020.com>.
Anyone else see this too?  I've tried both approaches and have the same results.

The only thing I can think is that there is not an OSGi running when we start jetty 
with "mvn jetty:run".  Or perhaps the artifacts are actually different when running 
from command line as opposed to running via the eclipse plug-in for maven?

On Tue, Jul 15, 2008 at 09:25:56PM +0100, Ken Starks wrote:
> It depends which way I do things, but I am still having
> problems with 'Your first Cocoon 2.2 Application'
> because the Java Bean doesn't work.
>
> But while experimenting with the Eclipse plugin
> 'Maven Integration for Eclipse' as a way of
> generating the block, I suddenly found that the
> Java-Bean did work.
>
> Can anyone explain this behaviour, in terms that a
> non-java-speaker might understand?
>
> +++++++++++++++++++++++++++++++++++++++++++++++++
>
> Details:
>
> Method One: (don't work)
> ++++++++++++++++++
>
> a. In the shell,
> --------------
> mvn archetype:generate -DarchetypeCatalog=http://cocoon.apache.org
>
> <snip the details, I chose an artifactId of myBlock1>
>
> cd myBlock1
> mvn eclipse:eclipse
> mvn jetty:run
>
> b. Browser
> -----------
> Going to http://localhost:8888/myBlock1/spring-bean,
>
>  <spring>#message</spring>
>
>
> Method two (do work!)
> ++++++++++=+++++
>
> a. in Eclipse
> ------------
> (with 'Maven integration for eclipse' plugin
> from update site:-
> http://m2eclipse.sonatype.org/update-dev/ )
>
> Menubar --.New --> Maven --> Maven Project
> --> NEXT
>
> un-check 'Use default Workspace location'
> browse to your usual 'GettingStartedApp' directory
> --> Next
>
> Nexus Indexer. select artifact Id:-
> cocoon-22-archetype-block
> --> Finish
>
> <snip, to fill in details. this time I chose 'myBlock2 >
>
>
> Cocoon then creates and compiles the block
>
> b. In the shell,
> --------------
>
>
> cd myBlock2
> mvn jetty:run
>
> c. Browser
> -----------
> Going to http://localhost:8888/myBlock2/spring-bean,
>
>  <spring>This is a message coming from a Spring bean.</spring>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org