You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kit Yeung <wa...@outblaze.com> on 2008/09/17 10:19:34 UTC

PageTester and HttpServletRequest error.

Hi all,

I am doing a evaluation on Tapestry, I am very new to Tapestry as well as Java and 
its frameworks.

I came across a problem when I try to use the PageTester. I wrote a very simple test 
case like the one in 
http://tapestry.apache.org/tapestry5/guide/unit-testing-pages.html.

I put the test in src/test/java and execute mvn test, and it has the error I 
attached. I tried to ran a even simpler test like assertEqual without PageTester, 
and it ran fine.

Any idea? If you want more detail, please reply.. Thanks!

Kit



I am using:

Maven version: 2.0.9
Java version: 1.6.0_07
OS name: "linux" version: "2.6.20-17-generic" arch: "i386" Family: "unix"


Error:

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
	at java.lang.Class.privateGetPublicMethods(Class.java:2519)
	at java.lang.Class.getMethods(Class.java:1406)
	at 
org.apache.tapestry5.ioc.internal.DefaultModuleDefImpl.grind(DefaultModuleDefImpl.java:137)
	at 
org.apache.tapestry5.ioc.internal.DefaultModuleDefImpl.<init>(DefaultModuleDefImpl.java:106)
	at org.apache.tapestry5.ioc.RegistryBuilder.add(RegistryBuilder.java:121)
	at 
org.apache.tapestry5.internal.TapestryAppInitializer.addModules(TapestryAppInitializer.java:118)
	at 
org.apache.tapestry5.internal.TapestryAppInitializer.<init>(TapestryAppInitializer.java:80)
	at org.apache.tapestry5.test.PageTester.<init>(PageTester.java:88)
	at org.kitkitnet.pages.IndexTest.test1(IndexTest.java:17)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


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


RE: PageTester and HttpServletRequest error.

Posted by Jonathan Barker <jo...@gmail.com>.
Kit

If you feel the guide
(http://tapestry.apache.org/tapestry5/guide/unit-testing-pages.html) should
be more explicit, you should create a JIRA issue to add the instruction to
include tapestry-test into your POM.

I'm sitting on the fence on this one - I know there's a tapestry-test module
and it is obvious to me it should be included, but I've also been using
Tapestry for a while.

More experience with Java, and at least some with Maven would let you know
that you were missing a dependency.  I have had my share of trying to figure
out WHAT dependency I've missed, so that's not something that goes away
entirely - it just gets easier to solve.

I hope you enjoy Tapestry.  I selected Tapestry in 2004 as a framework I
wanted to use - two years before I actually had a project I could use it on.
I just keep getting happier with it.

Jonathan


> -----Original Message-----
> From: Kit Yeung [mailto:waikit@outblaze.com]
> Sent: Wednesday, September 17, 2008 21:57
> To: Tapestry users
> Subject: Re: PageTester and HttpServletRequest error.
> 
> Hi Hilcon,
> 
> > On Wed, Sep 17, 2008 at 01:19, Kit Yeung <wa...@outblaze.com> wrote:
> >> I am doing a evaluation on Tapestry, I am very new to Tapestry as well
> as
> >> Java and its frameworks.
> >
> > Don't you think you're taking on slightly more than you can handle? If
> > you're really that new to Java, its frameworks, and Tapestry, I would
> > suggest you focus on getting to know Java first. Even more so if
> > you're also new to programming in general (I couldn't tell from your
> > post). There are plenty of tutorials around.
> >
> > It seems difficult to properly evaluate something without a more solid
> > foundation.
> 
> Sorry for not being specify, I am working on a project on evaluating
> various Java
> frameworks. By new mean I am just not used to program in Java, but I've
> got years of
> experience in other programming languages and frameworks like Django or
> Zend.
> 
> 
> >> java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
> >
> > You don't have servlet.jar in your classpath.
> 
> I've kept trying to resolve this problem by numerous trial and error since
> I asked
> this question. And in case anyone who had this problem when following the
> tutorial
> and came across this problem, you may want to add:
> 
> <dependency>
>        <groupId>org.apache.tapestry</groupId>
>        <artifactId>tapestry-test</artifactId>
>        <version>${tapestry-release-version}</version>
> </dependency>
> 
> to your pom.xml .
> 
> I've followed the tutorial to create my project by this command:
> 
> mvn archetype:create
>    -DarchetypeGroupId=org.apache.tapestry
>    -DarchetypeArtifactId=quickstart
>    -DgroupId=org.apache.tapestry
>    -DartifactId=tutorial1
>    -DpackageName=org.apache.tapestry5.tutorial
> 
> 
> And seem the tapestry-test is not part of the pom.xml dependency when
> generated
> through the above command so the maven2 dependencies were not added
> properly, jar
> files like ant, servlet and selenium were missing.
> 
> Thanks.
> 
> Kit
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


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


Re: PageTester and HttpServletRequest error.

Posted by Kit Yeung <wa...@outblaze.com>.
Hi Hilcon,

> On Wed, Sep 17, 2008 at 01:19, Kit Yeung <wa...@outblaze.com> wrote:
>> I am doing a evaluation on Tapestry, I am very new to Tapestry as well as
>> Java and its frameworks.
> 
> Don't you think you're taking on slightly more than you can handle? If
> you're really that new to Java, its frameworks, and Tapestry, I would
> suggest you focus on getting to know Java first. Even more so if
> you're also new to programming in general (I couldn't tell from your
> post). There are plenty of tutorials around.
> 
> It seems difficult to properly evaluate something without a more solid
> foundation.

Sorry for not being specify, I am working on a project on evaluating various Java 
frameworks. By new mean I am just not used to program in Java, but I've got years of 
experience in other programming languages and frameworks like Django or Zend.


>> java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
> 
> You don't have servlet.jar in your classpath.

I've kept trying to resolve this problem by numerous trial and error since I asked 
this question. And in case anyone who had this problem when following the tutorial 
and came across this problem, you may want to add:

<dependency>
       <groupId>org.apache.tapestry</groupId>
       <artifactId>tapestry-test</artifactId>
       <version>${tapestry-release-version}</version>
</dependency>

to your pom.xml .

I've followed the tutorial to create my project by this command:

mvn archetype:create
   -DarchetypeGroupId=org.apache.tapestry
   -DarchetypeArtifactId=quickstart
   -DgroupId=org.apache.tapestry
   -DartifactId=tutorial1
   -DpackageName=org.apache.tapestry5.tutorial


And seem the tapestry-test is not part of the pom.xml dependency when generated 
through the above command so the maven2 dependencies were not added properly, jar 
files like ant, servlet and selenium were missing.

Thanks.

Kit



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


Re: PageTester and HttpServletRequest error.

Posted by Hilco Wijbenga <hi...@gmail.com>.
Hi Kit,

On Wed, Sep 17, 2008 at 01:19, Kit Yeung <wa...@outblaze.com> wrote:
> I am doing a evaluation on Tapestry, I am very new to Tapestry as well as
> Java and its frameworks.

Don't you think you're taking on slightly more than you can handle? If
you're really that new to Java, its frameworks, and Tapestry, I would
suggest you focus on getting to know Java first. Even more so if
you're also new to programming in general (I couldn't tell from your
post). There are plenty of tutorials around.

It seems difficult to properly evaluate something without a more solid
foundation.

> java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

You don't have servlet.jar in your classpath.

Cheers,
Hilco

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