You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gintare Ragaisiene <gi...@gmail.com> on 2009/02/24 14:20:02 UTC
Cocoon Maven 2 plugin, java class reloading problem
Hello,
I'm using Cocoon 2.2, with default Jetty, OS - Ubuntu. My cocoon came with
Cocoon Maven 2 plugin, in pom.xml:
<plugins>
<plugin>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-maven-plugin</artifactId>
<version>1.0.0-M2</version>
<executions>
<execution>
<id>prepare</id>
<phase>compile</phase>
<goals>
<goal>prepare</goal>
</goals>
</execution>
</executions>
</plugin>
I checked
http://cocoon.apache.org/2.2/maven-plugins/maven-plugin/1.0/1297_1_1.html ,
set up of this plug was done correctly. So, there is promise to detect java
changes without restart or rebuild in
http://cocoon.apache.org/2.2/maven-plugins/maven-plugin/1.0/1359_1_1.html .
But this feature doesn't work for me.
I have sitemap:
<map:actions>
<map:action name="service-tester"
src="com.myclubbingguide.myclubbingguide.TestService">
</map:actions>
....
<map:match pattern="demo/service">
<map:act type="service-tester">
<map:parameter name="word"
value="{1}"/>
</map:act>
<map:generate src="demo/counter.xml"/>
<map:transform src="demo/counter.xsl">
<map:parameter name="count" value="123"/>
<map:parameter name="word" value="hello"/>
</map:transform>
<map:serialize/>
</map:match>
I have class:
public class TestService extends AbstractAction implements ThreadSafe{
public Map act(Redirector arg0, SourceResolver arg1, Map arg2, String
arg3, Parameters arg4) throws Exception {
System.out.println("My try 1");
return null;
}
}
Now:
1. starting jetty server, reload browser, output to console -> "My try 1" ,
ok
2. change in code "My try 1" to "My try 2"
3. save TestService.java
4. reload browser
5. output to console -> "My try 1", why not "My try 2" ?
After restarting my project output is correct "My try 2".
Thank you for replay,
Gintare
Re: Cocoon Maven 2 plugin, java class reloading problem
Posted by Gintare Ragaisiene <gi...@gmail.com>.
Hi Peter,
I'm using NetBeans IDE 6.1 . And I think there no feature "Compile and
Save" in it. Only NetBeans 6.5 have it, I guess. Maybe I have to upgrade it?
My pom.xml have such configuration you've sent. I paste my pom.xml file
here:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<name>myclubbingguide</name>
<groupId>com.myclubbingguide</groupId>
<artifactId>myclubbingguide</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-core</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-servlet-service-components</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-template-impl</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-flowscript-impl</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<!--my added -->
<dependency>
<groupId>hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>Spring</groupId>
<artifactId>Spring</artifactId>
<version>2.5.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>commons-pool</artifactId>
<groupId>commons-pool</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jta</groupId>
<artifactId>jta</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>2.7.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>1.5.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>asm-attrs</groupId>
<artifactId>asm-attrs</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.6.3</version>
<!--<scope>compile</scope>-->
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-rcl-spring-reloader</artifactId>
<version>1.0.0-M2</version>
</dependency>
<!-- -->
</dependencies>
<build>
<plugins>
<!--<plugin>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-maven-plugin</artifactId>
<version>1.0.0-M2</version>
<executions>
<execution>
<id>prepare</id>
<phase>compile</phase>
<goals>
<goal>prepare</goal>
</goals>
</execution>
</executions>
<configuration>
<reloadingSpringEnabled>false</reloadingSpringEnabled>
</configuration>
</plugin>-->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.7</version>
<configuration>
<connectors>
<connector
implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8888</port>
<maxIdleTime>30000</maxIdleTime>
</connector>
</connectors>
<webAppSourceDirectory>${project.build.directory}/rcl/webapp</webAppSourceDirectory>
<contextPath>/</contextPath>
<systemProperties>
<systemProperty>
<name>org.apache.cocoon.mode</name>
<value>dev</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.1</version>
<configuration>
<archive>
<manifestEntries>
<Cocoon-Block-Name>${pom.artifactId}</Cocoon-Block-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.5</version>
</plugin>
</plugins>
</build>
<properties>
<netbeans.hint.useExternalMaven>true</netbeans.hint.useExternalMaven>
</properties>
</project>
Regars,
Gintare
Re: Cocoon Maven 2 plugin, java class reloading problem
Posted by Peter Karich <pe...@yahoo.de>.
Hi Gintare!
I must admit I am very new to cocoon.
But one question: I guess you use eclipse!? did eclipse compile the
classes into ./target/classes/ if you save the file?
And I don't know if this is necessary for this class reloading, but do
you have the plugin configuration like [1] in the pom.xml?
Regards,
Peter.
[1]
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.7</version>
<configuration>
<connectors>
<connector
implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8888</port>
<maxIdleTime>30000</maxIdleTime>
</connector>
</connectors>
<webAppSourceDirectory>${project.build.directory}/rcl/webapp</webAppSourceDirectory>
<contextPath>/</contextPath>
<systemProperties>
<systemProperty>
<name>org.apache.cocoon.mode</name>
<value>dev</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.1</version>
<configuration>
<archive>
<manifestEntries>
<Cocoon-Block-Name>${pom.artifactId}</Cocoon-Block-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
> Hello Peter,
>
> yes there's such file with content as you say:
> com.myclubbingguide.myclubbingguide.service%classes-dir=./target/classes
>
> and it refers to com.myclubbingguide.myclubbingguide.service bean in
> ./target/classes/META-INF/cocoon/spring/block-servlet-service.xml :
>
> <bean name="com.myclubbingguide.myclubbingguide.service"
> class="org.apache.cocoon.sitemap.SitemapServlet">
> <servlet:context mount-path="/myclubbingguide"
> context-path="blockcontext:/myclubbingguide/"/>
> </bean>
>
> ./target/classes exists with directories COB-INF, META-INF inside.
>
>
> Regards,
> GintarÄ—
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Cocoon Maven 2 plugin, java class reloading problem
Posted by Gintare Ragaisiene <gi...@gmail.com>.
Hello Peter,
yes there's such file with content as you say:
com.myclubbingguide.myclubbingguide.service%classes-dir=./target/classes
and it refers to com.myclubbingguide.myclubbingguide.service bean in
./target/classes/META-INF/cocoon/spring/block-servlet-service.xml :
<bean name="com.myclubbingguide.myclubbingguide.service"
class="org.apache.cocoon.sitemap.SitemapServlet">
<servlet:context mount-path="/myclubbingguide"
context-path="blockcontext:/myclubbingguide/"/>
</bean>
./target/classes exists with directories COB-INF, META-INF inside.
Regards,
GintarÄ—
Re: Cocoon Maven 2 plugin, java class reloading problem
Posted by Peter <pe...@yahoo.de>.
Hi Gintare,
did you specify a file 'rcl.properties' near the pom.xml with
com.myclubbingguide.myclubbingguide.service%classes-dir=./target/classes
?
Regards,
Peter.
> Hello,
>
> I'm using Cocoon 2.2, with default Jetty, OS - Ubuntu. My cocoon came
> with Cocoon Maven 2 plugin, in pom.xml:
>
> <plugins>
> <plugin>
> <groupId>org.apache.cocoon</groupId>
> <artifactId>cocoon-maven-plugin</artifactId>
> <version>1.0.0-M2</version>
> <executions>
> <execution>
> <id>prepare</id>
> <phase>compile</phase>
> <goals>
> <goal>prepare</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
>
> I checked
> http://cocoon.apache.org/2.2/maven-plugins/maven-plugin/1.0/1297_1_1.html
> , set up of this plug was done correctly. So, there is promise to
> detect java changes without restart or rebuild in
> http://cocoon.apache.org/2.2/maven-plugins/maven-plugin/1.0/1359_1_1.html
> . But this feature doesn't work for me.
>
> I have sitemap:
>
> <map:actions>
> <map:action name="service-tester"
> src="com.myclubbingguide.myclubbingguide.TestService">
>
> </map:actions>
>
> ....
>
> <map:match pattern="demo/service">
> <map:act type="service-tester">
> <map:parameter name="word"
> value="{1}"/>
> </map:act>
> <map:generate src="demo/counter.xml"/>
> <map:transform src="demo/counter.xsl">
> <map:parameter name="count" value="123"/>
> <map:parameter name="word" value="hello"/>
> </map:transform>
> <map:serialize/>
> </map:match>
>
>
> I have class:
>
> public class TestService extends AbstractAction implements ThreadSafe{
>
> public Map act(Redirector arg0, SourceResolver arg1, Map arg2,
> String arg3, Parameters arg4) throws Exception {
>
> System.out.println("My try 1");
>
> return null;
> }
>
> }
>
> Now:
> 1. starting jetty server, reload browser, output to console -> "My try
> 1" , ok
> 2. change in code "My try 1" to "My try 2"
> 3. save TestService.java
> 4. reload browser
> 5. output to console -> "My try 1", why not "My try 2" ?
>
> After restarting my project output is correct "My try 2".
>
>
> Thank you for replay,
> Gintare
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org