(Thumbnail synopsis; the app blows up with ClassCastException when I extend
ActionBeanContext.)

This was downloaded from


https://sourceforge.net/projects/mvnstripes/files/stripes-quickstart-1.0/1.0/stripes-archetype-quickstart-1.0.jar/download

Using eclipse with its built in maven I couldn't get it to create a new
maven project by adding the archetype using the eclipse dialog box for
creating a new project, where you can type in all of the parameters into
the dialog box (archetypeArtifactId etc.)  So I downloaded the jar file,
extracted it, and manually copied the files into a new maven project where
the selected archetype was groupid= org.apache.maven.archetypes and the
artifact id= maven-archetype-webapp, version 1.0, and fixed the places and
replaced ${groupId} with mine (com.objecteffects) and ${artifactId} with
sample.

I couldn't change the eclipse project facet Dynamic Web Module from 2.3 to
2.4 (to match the web-app 2.4 version in web.xml) so I resorted to brute
force and edited org.eclipse.wst.common.project.facet.core.xml and changed
it to 2.4 there.  Being paranoid since I'm editing one of eclipse's files I
exited and then started it.  Then right clicked on the project and ran
maven -> Update Project, followed by a menu Project -> Clean... and that
finally got rid of the red error flag on the project.


I created an eclipse run configuration for maven with the goal jetty:run
and ran that, then waited for maven to download a billion and one jar files
and start jetty, which it finally did.

Opened the url localhost:8080/sample and got the Home.html
"Congratulations!" page. (But with some intervening flailing around until I
remembered that I needed to replace the ${package} in web.xml (global
search and replace never seems to come to mind in these situations).

Next, I created a new Action Bean Context class:

package com.objecteffects.sample.action;

import net.sourceforge.stripes.action.ActionBeanContext;

/**
 */
public class SampleActionBeanContext extends ActionBeanContext {
}

Then I changed the BaseActionBean to use this class:

package com.objecteffects.sample.action;

import net.sourceforge.stripes.action.ActionBean;
import net.sourceforge.stripes.action.ActionBeanContext;

public class BaseActionBean implements ActionBean {
    private SampleActionBeanContext context;

    public ActionBeanContext getContext() {
        return this.context;
    }

    public void setContext(ActionBeanContext context1) {
        this.context = (SampleActionBeanContext) context1;
    }
}

Now when I try to open the page it blows up with a ClassCastException,
"net.sourceforge.stripes.action.ActionBeanContext cannot be cast to
com.objecteffects.sample.action.SampleActionBeanContext".  This is
happening on the line "this.context = ...".

The supplied pom.xml specifies 1.5 for the java language, and the project's
properties has 1.5 for the java compiler JDK compliance.  But I'm using jdk
1.8.0_111.

I'm going to try replacing my 1.8 jdk with the 1.5 one and see if that
fixes it, but while I'm in the process of that I thought I'd ask if anyone
knows what's wrong?

Thanks
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to