-
1. Re: Trouble with running JSFUnit 2.0Beta1
ssilvert May 6, 2011 1:50 PM (in response to wolfgangknauf)Hi Wolfgang,
When you run with Arquillian, all the JSFUnit core classes, including JSFServerSession, are put into a jar called arquillian-jsfunit.jar. This jar is built on the fly via the JSFUnitArchiveAppender. This appender is in the jsfunit-arquillian.jar. Arquillian knows to call the JSFUnitArchiveAppender because it is declared in the META-INF/services in jsfunit-arquillian.jar.
So that brings us to your test code. Did you include @RunWith(Arquillian.class) in your test?
Also, if you should put an arquillian.xml file in src/test/resources. Put this in the file for JBoss 6 remote:
<?xml version="1.0"?> <arquillian xmlns="http://jboss.com/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jboss="urn:arq:org.jboss.arquillian.container.jbossas.remote_6"> <engine> <deploymentExportPath>target/</deploymentExportPath> </engine> </arquillian>
Then a copy of the WAR file created by shrinkwrap will end up in your target directory.
Stan
-
2. Re: Trouble with running JSFUnit 2.0Beta1
wolfgangknauf May 9, 2011 4:33 PM (in response to ssilvert)Hi Stan,
thanks for your help. Unfortunately, this did not help me. I tried different things (without actually knowing what I do ;-)), but the error did not change.
When executing the test, I see this console output for the unit test. Does this mean something (especially the "Could not read active container configuration: null" error):
09.05.2011 22:27:42 org.jboss.arquillian.impl.client.container.ContainerRegistryCreator getActivatedConfiguration
INFO: Could not read active container configuration: null
log4j:WARN No appenders could be found for logger (org.jnp.interfaces.TimedSocketFactory).
log4j:WARN Please initialize the log4j system properly.
My test class looks like this:
{code}
@RunWith(Arquillian.class)
public class GeometricModelTest
{
@Deployment
public static WebArchive createDeployment()
{
WebArchive war =ShrinkWrap.create(WebArchive.class, "test.war");
war
.setWebXML(new File("WebContent/WEB-INF/web.xml"))
.addClasses(GeometricModelHandler.class, Historie.class, Seitenlaengen.class)
.addAsWebResource(new File("WebContent", "index.jsp"))
.addAsWebResource(new File("WebContent", "geometricmodel.jsp"))
.addAsWebResource(new File("WebContent/WEB-INF/faces-config.xml"), "faces-config.xml");
return war;
}
@Test
@InitialPage("/index.faces")
public void testInitialPage(JSFServerSession server, JSFClientSession client) throws IOException
{
Assert.assertEquals("/index.jsp", server.getCurrentViewID());
System.err.println("TEST ist running!");
}
}
{code}
I tried to follow the Arquillian on using Arquillian and M2Eclipse tutorial here: http://docs.jboss.org/arquillian/reference/latest/en-US/html/gettingstarted.html#d0e574
But to make my project fit into an existing Eclipse Dynamic Web Project, I changed e.g. source and build path in pom.xml (attachment of my first post). And in the "Run Configuration" for the JUnit tests, I had to remove the project dependencies from ClassPath (error "command line too long" because of the WTP included JBoss runtime). Both the "Maven dependencies" classpath entry is still in the run configuration.
Best regards
Wolfgang
-
3. Trouble with running JSFUnit 2.0Beta1
wolfgangknauf May 10, 2011 9:23 AM (in response to wolfgangknauf)Just to clarify things a bit: when trying to fit the M2Eclipse settings to my existing "Dynamic Web Project", I changed some path mappings (see pom.xml):
<build>
<sourceDirectory>src</sourceDirectory>
<outputDirectory>build/classes</outputDirectory>
So I don't have a directory "target/" in my project any longer.
Where might a file "arquillian.xml" be placed in my situation? And how should the "deploymentExportPath" value look like? Could you give me a short hint what this file is good for?
Best regards
Wolfgang
-
4. Trouble with running JSFUnit 2.0Beta1
ssilvert May 10, 2011 4:10 PM (in response to wolfgangknauf)I think you need to get this working from the command line before you try to integrate with Eclipse. I would suggest that you try to download and run the example and then use it as a template.
I don't know anything about Eclipse, so I can't help with that. Once MavenJSFUnit/Arquillian is running from the command line, you can go to the Arquillian forum to get help on Eclipse integration.
In general, it's a bad idea to change the default directories for Maven. Using the defaults keeps your project in line with every other Maven project. So, anyone looking at your project will know where to find everything. And, when you get help, someone like me can tell you where to make your changes.
You need to put your arquillian.xml file in the src/test/resources directory. Arquillian will find it there.
BTW, what container are you trying to use?
Stan
-
5. Trouble with running JSFUnit 2.0Beta1
wolfgangknauf May 11, 2011 6:13 PM (in response to ssilvert)Hi Stan,
I made a step backwards and started with a maven archetype project "webapp-javaee6" instead of trying to map it to my old DynamicWebProject (http://blog.goyello.com/2010/06/15/how-to-create-java-web-application-with-eclipse-wtp-and-m2eclipse/
And after a long search, I found that my pom.xml pointed to Arquillian 1.0.0.5.Alpha, which is not compatible with JSFUnit2.0.0.Beta1: http://community.jboss.org/thread/164565
But now I am stuck once again and get strange ClassNotFoundExceptions. Do you have any idea? "pom.xml" is basically the same as in my post above.
org.jboss.arquillian.impl.event.FiredEventException: java.lang.RuntimeException: Could not load found class org.jboss.arquillian.testenricher.cdi.MethodParameterInjectionPoint$ArgumentAnnotated
at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)
at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)
at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:96)
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:162)
at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:186)
at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:297)
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:182)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:127)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:146)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at $Proxy0.invoke(Unknown Source)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:145)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:87)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
Caused by: java.lang.RuntimeException: Could not load found class org.jboss.arquillian.testenricher.cdi.MethodParameterInjectionPoint$ArgumentAnnotated
at org.jboss.shrinkwrap.impl.base.container.ContainerBase$2.classFound(ContainerBase.java:994)
at org.jboss.shrinkwrap.impl.base.URLPackageScanner.foundClass(URLPackageScanner.java:204)
at org.jboss.shrinkwrap.impl.base.URLPackageScanner.handleArchiveByFile(URLPackageScanner.java:159)
at org.jboss.shrinkwrap.impl.base.URLPackageScanner.handle(URLPackageScanner.java:181)
at org.jboss.shrinkwrap.impl.base.URLPackageScanner.scanPackage(URLPackageScanner.java:132)
at org.jboss.shrinkwrap.impl.base.container.ContainerBase.addPackages(ContainerBase.java:1003)
at org.jboss.shrinkwrap.impl.base.container.ContainerBase.addPackages(ContainerBase.java:957)
at org.jboss.arquillian.container.jbossas.remote_6.JBossASDeploymentAppender.createAuxiliaryArchive(JBossASDeploymentAppender.java:42)
at org.jboss.arquillian.impl.ClientDeploymentGenerator.loadAuxiliaryArchives(ClientDeploymentGenerator.java:75)
at org.jboss.arquillian.impl.ClientDeploymentGenerator.generate(ClientDeploymentGenerator.java:62)
at org.jboss.arquillian.impl.handler.ArchiveGenerator.callback(ArchiveGenerator.java:52)
at org.jboss.arquillian.impl.handler.ArchiveGenerator.callback(ArchiveGenerator.java:42)
at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)
... 20 more
Caused by: java.lang.NoClassDefFoundError: javax/enterprise/inject/spi/AnnotatedParameter
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jboss.shrinkwrap.impl.base.container.ContainerBase$2.classFound(ContainerBase.java:986)
... 32 more
Caused by: java.lang.ClassNotFoundException: javax.enterprise.inject.spi.AnnotatedParameter
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 45 more
de.fhw.komponentenarchitekturen.knauf.jsf.GeometricModelTest Time elapsed: 0.016 sec <<< ERROR!
org.jboss.arquillian.impl.event.FiredEventException: java.lang.IllegalStateException: No org.jboss.shrinkwrap.api.Archive found in context
at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)
at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)
at org.jboss.arquillian.impl.EventTestRunnerAdaptor.afterClass(EventTestRunnerAdaptor.java:108)
at org.jboss.arquillian.junit.Arquillian$3$2.evaluate(Arquillian.java:190)
at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:297)
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:182)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:127)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:146)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at $Proxy0.invoke(Unknown Source)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:145)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:87)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
Caused by: java.lang.IllegalStateException: No org.jboss.shrinkwrap.api.Archive found in context
at org.jboss.arquillian.impl.Validate.stateNotNull(Validate.java:75)
at org.jboss.arquillian.impl.handler.ContainerUndeployer.callback(ContainerUndeployer.java:58)
at org.jboss.arquillian.impl.handler.ContainerUndeployer.callback(ContainerUndeployer.java:47)
at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)
... 19 more
Best regards
Wolfgang
-
6. Trouble with running JSFUnit 2.0Beta1
ssilvert May 12, 2011 7:45 AM (in response to wolfgangknauf)This is your problem:
Caused by: java.lang.NoClassDefFoundError: javax/enterprise/inject/spi/AnnotatedParameter
So you need to add:
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
Are you using JBoss 6 with Arquillian remote mode?
I also need to ask how anxious you are to get this to work. I really wish you could work with the latest getting started example as a template. It takes a little extra work to use that right now because it's in flux. But soon I'll be doing a release. (I know I keep saying that and it doesn't happen, but I WILL get it done. Right now I'm waiting for Arquillian Beta to finally be released. It's suppossed to happen this week.)
Stan
-
7. Trouble with running JSFUnit 2.0Beta1
wolfgangknauf May 12, 2011 9:26 AM (in response to ssilvert)Hi Stan,
thanks for the help. It will take some days until I can give it a try...
> Are you using JBoss 6 with Arquillian remote mode?
yes
> I also need to ask how anxious you are to get this to work.
it is just playing around with JSFUnit - but when I start such a thing, I won't give up until it works ;-).
Yesterday, I had the intention to take a look at your sample, but forgot about it ;-). Thanks for posting the link. It seems my project is very similar to your sample, so I hope that only a depedency is missing and then it will start.
Every piece of doc that I can find (which is not much for Arquillian) declares different pom dependencies :-(.
Best regards
Wolfgang
-
8. Trouble with running JSFUnit 2.0Beta1
wolfgangknauf May 13, 2011 5:06 PM (in response to wolfgangknauf)Hi Stan,
adding a dependency on "javax.enterprise:cdi-api:1.0-SP1" resolved the error. But as I run into other problems, I tried to run your sample. This failed with this error message:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.140s
[INFO] Finished at: Fri May 13 22:50:15 CEST 2011
[INFO] Final Memory: 20M/48M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project gettingstarted: Could not resolve dependencies
for project org.jboss.jsfunit:gettingstarted:war:2.0.0-SNAPSHOT: Failure
to find org.jboss.jsfunit:jsfunit-arquillian:jar:2.0.0-SNAPSHOT in
https://repository.jboss.org/nexus/content/repositories/public was cached in the local repository,
resolution will not be reattempted until the update interval of jboss-public-repository-group
has elapsed or updates are forced
Best regards
Wolfgang
By the way: I think there is a small error in the gettingstarted pom.xml? It contains:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.4-b03</version>
<scope>provided</scope>
</dependency>
When using m2eclipse, this resulted in this error:
"Missing artifact com.sun.faces:jsf-api:jar:2.0.4-b03:provided"
which is correct, https://repository.jboss.org/nexus/content/groups/public-jboss/javax/faces/jsf-api/ does not contain this specific version.
But it is at http://download.java.net/maven/2/ (I saw this URL also in one of the JSFUnit poms).
-
9. Trouble with running JSFUnit 2.0Beta1
ssilvert May 13, 2011 7:28 PM (in response to wolfgangknauf)If you look at the getting started doc, you'll see that I left a note at the top about that. You have to pull down the other JFUnit source and build it so you can get the 2.0.0-SNAPSHOT. For the next release, I'll do a non-volitile version of getting started.
Thanks for pointing out the problem with 2.0.4-b03. It was in my local repo so I didn't get an error. The actual problem was that the pom was poining to an old JBoss repo link. I've updated the pom and committed the fix.
Stan
-
10. Re: Trouble with running JSFUnit 2.0Beta1
wolfgangknauf May 14, 2011 2:24 PM (in response to ssilvert)Ooops, I should have seen this note. But on the other hand: everyone knows that an author, who makes text bold, actually wants to say "ignore me!" ;-).
After building JSFUnit, I could run the gettingstarted sample. Now I have to find out the differences to my sample. Thanks a lot for the help!
When running "mvn -Pjboss6x" or "mvn -Pjee6,jboss6x" for the JSFUnit sources, the test "org.jboss.jsfunit.example.hellojsf.BasicAuthenticationTest" fails (see error below).
Do I need a Jetty container to run this stuff? I thought that the mvn command would only run JBoss 6 tests?
Best regards
Wolfgang
-------------------------------------------------------------------------------
Test set: org.jboss.jsfunit.example.hellojsf.BasicAuthenticationTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.032 sec <<< FAILURE!
initializationError(org.jboss.jsfunit.example.hellojsf.BasicAuthenticationTest) Time elapsed: 0 sec <<< ERROR!
java.lang.RuntimeException: Could not create and startup manager
at org.jboss.arquillian.impl.core.ManagerImpl.<init>(ManagerImpl.java:95)
at org.jboss.arquillian.impl.core.ManagerBuilder.create(ManagerBuilder.java:74)
at org.jboss.arquillian.impl.DeployableTestBuilder.build(DeployableTestBuilder.java:97)
at org.jboss.arquillian.impl.DeployableTestBuilder.build(DeployableTestBuilder.java:67)
at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:82)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.apache.maven.surefire.junit4.JUnit4TestSet.<init>(JUnit4TestSet.java:45)
at org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite.createTestSet(JUnit4DirectoryTestSuite.java:56)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:96)
at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:209)
at org.apache.maven.surefire.Surefire.run(Surefire.java:156)
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:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: org.jboss.arquillian.impl.domain.ContainerCreationException: Could not create Container jetty
at org.jboss.arquillian.impl.domain.ContainerRegistry.create(ContainerRegistry.java:78)
at org.jboss.arquillian.impl.client.container.ContainerRegistryCreator.createRegistry(ContainerRegistryCreator.java:67)
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:597)
at org.jboss.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)
at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)
at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)
at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)
at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)
at org.jboss.arquillian.impl.core.ManagerImpl.bindAndFire(ManagerImpl.java:221)
at org.jboss.arquillian.impl.core.InstanceImpl.set(InstanceImpl.java:74)
at org.jboss.arquillian.impl.bootstrap.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:58)
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:597)
at org.jboss.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)
at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)
at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)
at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)
at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)
at org.jboss.arquillian.impl.core.ManagerImpl.<init>(ManagerImpl.java:91)
... 25 more
Caused by: java.lang.IllegalStateException: No implementation found for org.jboss.arquillian.spi.client.container.DeployableContainer, please check your classpath
at org.jboss.arquillian.impl.DynamicServiceLoader.verifyOnlyOneOrSameImplementation(DynamicServiceLoader.java:134)
at org.jboss.arquillian.impl.DynamicServiceLoader.onlyOne(DynamicServiceLoader.java:92)
at org.jboss.arquillian.impl.domain.ContainerRegistry.create(ContainerRegistry.java:69)
... 48 more
-
11. Re: Trouble with running JSFUnit 2.0Beta1
wolfgangknauf May 18, 2011 4:19 PM (in response to wolfgangknauf)I tried to make my sample appear like your "gettingstarted" sample (beside a different jsf page and three java classes), but I cannot manage to make it run (even using "mvn" by command line ;-)).
My test always fails with this error:
java.lang.NullPointerException
at org.jboss.jsfunit.jsfsession.JSFServerSession.getCurrentViewID(JSFServerSession.java:79)
Do you have any idea? If it helps, I can post my app, but currently I feel a bit ashamed of it, because my project is not truely nice looking ;-).
The gettingstarted sample works, so I think it is not a general maven problem.
Best regards
Wolfgang
-
12. Re: Trouble with running JSFUnit 2.0Beta1
ssilvert May 18, 2011 5:16 PM (in response to wolfgangknauf)Hi Wolfgang,
Sorry I missed your post on Saturday. I guess you figured out that you need to start AS6 and pass -Pjbossas-remote-6 to the maven command line to run the example with AS6?
As for your problem today, I'm not sure off hand. The error is saying that it can't find FacesContext at a very early point in the process. So it's some sort of initialization problem.
If you start with the getting started app as a template and then add things to it, that should work.
Stan
-
13. Re: Trouble with running JSFUnit 2.0Beta1
wolfgangknauf May 19, 2011 2:20 PM (in response to ssilvert)Hi Stan,
Shame on me, I made a really silly error ;-): My "@InitialPage" annotation pointed to "index.faces", but "index.jsp" in my sample is just a plain JSP page, which does not contain any JSF tags, it has only a "click me" link to my JSF page. Seems no FacesContext was created in this case.
With the "real" JSF page, it worked.... How dumb of me - took me hours over hours to find this :-(
Sorry to bother you with all this stuff! But when I get a working sample with Eclipse integration, I will post a tutorial ;-).
About the failing JSF unit sources build (I did a SVN update before):
I start it with this batch (Maven args taken from the "Building JSFUnit" page linked from the "JSFUnit 2.0.0 "Getting Started" Example" - maybe the "-P" values are wrong?) :
set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_24
set JBOSS_HOME=C:\temp\jboss-6.0.0.Final
C:\temp\apache-maven-3.0.3\bin\mvn.bat -Pjee6,jboss6x
This resulted in this console output (and the error from my previous post)
=========================================================
[INFO] ------------------------------------------------------------------------
[INFO] Building arquillian hellojsf example 2.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0-beta-1:enforce (enforce-plugin-versions) @
arquillian-hellojsf ---
[WARNING] This rule is not compatible with the current version of Maven. The rul
e is not able to perform any checks.
[INFO]
[INFO] --- maven-enforcer-plugin:1.0-beta-1:enforce (enforce-java-version) @ arq
uillian-hellojsf ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.0-beta-1:enforce (enforce-maven-version) @ ar
quillian-hellojsf ---
[INFO]
[INFO] --- maven-resources-plugin:2.4.1:resources (default-resources) @ arquilli
an-hellojsf ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\temp\jfsunit-2.0.0.Snapshot\exampl
es-arquillian\hellojsf\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ arquillian-he
llojsf ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.4.1:testResources (default-testResources) @
arquillian-hellojsf ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) @ arqui
llian-hellojsf ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.4.3:test (default-test) @ arquillian-hellojsf
---
[INFO] Surefire report directory: C:\temp\jfsunit-2.0.0.Snapshot\examples-arquil
lian\hellojsf\target\surefire-reports
19.05.2011 20:00:18 org.jboss.arquillian.impl.client.container.ContainerRegistry
Creator getActivatedConfiguration
INFO: Could not read active container configuration: null
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.jboss.jsfunit.example.hellojsf.BasicAuthenticationTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.172 sec <<< FA
ILURE!
Running org.jboss.jsfunit.example.hellojsf.FasadeAPICDITest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec <<< FAILUR
E!
Running org.jboss.jsfunit.example.hellojsf.FormAuthenticationTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec <<< FAILUR
E!
Running org.jboss.jsfunit.example.hellojsf.FasadeAPINonCDITest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.015 sec <<< FA
ILURE!
Results :
Tests in error:
initializationError(org.jboss.jsfunit.example.hellojsf.BasicAuthenticationTest
)
initializationError(org.jboss.jsfunit.example.hellojsf.FasadeAPICDITest)
initializationError(org.jboss.jsfunit.example.hellojsf.FormAuthenticationTest)
initializationError(org.jboss.jsfunit.example.hellojsf.FasadeAPINonCDITest)
Tests run: 4, Failures: 0, Errors: 4, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] JSFUnit ........................................... SUCCESS [5.781s]
[INFO] JSFUnit Core ...................................... SUCCESS [8.969s]
[INFO] JSFUnit Cactus Integration ........................ SUCCESS [0.906s]
[INFO] JSFUnit Arquillian Integration .................... SUCCESS [1.109s]
[INFO] JSFUnit RichFaces Support ......................... SUCCESS [0.844s]
[INFO] JSFUnit Core Ant Tasks ............................ SUCCESS [0.625s]
[INFO] examples-arquillian ............................... SUCCESS [0.828s]
[INFO] arquillian hellojsf example ....................... FAILURE [3.344s]
[INFO] JSFUnit Analysis .................................. SKIPPED
[INFO] JSFUnit Examples .................................. SKIPPED
[INFO] HelloJSF Example App .............................. SKIPPED
[INFO] HelloJSF Example Web App .......................... SKIPPED
[INFO] HelloJSF JSFUnit Integration Test ................. SKIPPED
[INFO] HelloJSF JSFUnit Servlet 3 and JEE6 Tests ......... SKIPPED
[INFO] HelloJSF JSFUnit test with path-mapped FacesServlet SKIPPED
[INFO] Example tests for Ajax4JSF sample app ............. SKIPPED
[INFO] Test RichFaces demo app ........................... SKIPPED
[INFO] Seam Example Apps ................................. SKIPPED
[INFO] Seam Registration Example ......................... SKIPPED
[INFO] Seam Registration WAR Module ...................... SKIPPED
[INFO] Seam Registration EJB Module ...................... SKIPPED
[INFO] Seam Registration EAR Module ...................... SKIPPED
[INFO] Seam Booking Example .............................. SKIPPED
[INFO] Seam Booking EJB Module ........................... SKIPPED
[INFO] Seam Booking WAR Module ........................... SKIPPED
[INFO] Seam Booking EAR Module ........................... SKIPPED
[INFO] JSFUnit Microcontainer deployer ................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.344s
[INFO] Finished at: Thu May 19 20:00:18 CEST 2011
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
4.3:test (default-test) on project arquillian-hellojsf: There are test failures.
[ERROR]
[ERROR] Please refer to C:\temp\jfsunit-2.0.0.Snapshot\examples-arquillian\hello
jsf\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :arquillian-hellojsf
=============================================================
After reading your last post, I tried it with "mvn.bat -Pjbossas-remote-6 test":
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] JSFUnit ........................................... SUCCESS [0.375s]
[INFO] JSFUnit Core ...................................... SUCCESS [1.266s]
[INFO] JSFUnit Cactus Integration ........................ SUCCESS [0.109s]
[INFO] JSFUnit Arquillian Integration .................... SUCCESS [0.235s]
[INFO] JSFUnit RichFaces Support ......................... SUCCESS [0.093s]
[INFO] JSFUnit Core Ant Tasks ............................ SUCCESS [0.079s]
[INFO] examples-arquillian ............................... SUCCESS [1:01.875s]
[INFO] arquillian hellojsf example ....................... SUCCESS [6.109s]
[INFO] JSFUnit Analysis .................................. SUCCESS [8.391s]
[INFO] JSFUnit Examples .................................. SUCCESS [0.015s]
[INFO] HelloJSF Example App .............................. SUCCESS [0.000s]
[INFO] HelloJSF Example Web App .......................... FAILURE [0.922s]
[INFO] HelloJSF JSFUnit Integration Test ................. SKIPPED
[INFO] HelloJSF JSFUnit Servlet 3 and JEE6 Tests ......... SKIPPED
[INFO] HelloJSF JSFUnit test with path-mapped FacesServlet SKIPPED
[INFO] Example tests for Ajax4JSF sample app ............. SKIPPED
[INFO] Test RichFaces demo app ........................... SKIPPED
[INFO] Seam Example Apps ................................. SKIPPED
[INFO] Seam Registration Example ......................... SKIPPED
[INFO] Seam Registration WAR Module ...................... SKIPPED
[INFO] Seam Registration EJB Module ...................... SKIPPED
[INFO] Seam Registration EAR Module ...................... SKIPPED
[INFO] Seam Booking Example .............................. SKIPPED
[INFO] Seam Booking EJB Module ........................... SKIPPED
[INFO] Seam Booking WAR Module ........................... SKIPPED
[INFO] Seam Booking EAR Module ........................... SKIPPED
[INFO] JSFUnit Microcontainer deployer ................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:20.016s
[INFO] Finished at: Thu May 19 20:13:23 CEST 2011
[INFO] Final Memory: 28M/67M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
0.2:compile (default-compile) on project jboss-jsfunit-examples-hellojsf-webapp:
Compilation failure: Compilation failure:
[ERROR] C:\temp\jfsunit-2.0.0.Snapshot\jboss-jsfunit-examples\jboss-jsfunit-exam
ples-hellojsf\jboss-jsfunit-examples-hellojsf-webapp\src\main\java\org\jboss\jsf
unit\example\hellojsf\Marathons.java:[28,26] package javax.faces.context does no
t exist
[ERROR]
[ERROR] C:\temp\jfsunit-2.0.0.Snapshot\jboss-jsfunit-examples\jboss-jsfunit-exam
ples-hellojsf\jboss-jsfunit-examples-hellojsf-webapp\src\main\java\org\jboss\jsf
unit\example\hellojsf\Marathons.java:[59,6] cannot find symbol
[ERROR] symbol : class FacesContext
[ERROR] location: class org.jboss.jsfunit.example.hellojsf.Marathons
[ERROR]
[ERROR] C:\temp\jfsunit-2.0.0.Snapshot\jboss-jsfunit-examples\jboss-jsfunit-exam
ples-hellojsf\jboss-jsfunit-examples-hellojsf-webapp\src\main\java\org\jboss\jsf
unit\example\hellojsf\Marathons.java:[59,25] cannot find symbol
[ERROR] symbol : variable FacesContext
[ERROR] location: class org.jboss.jsfunit.example.hellojsf.Marathons
[ERROR]
[ERROR] C:\temp\jfsunit-2.0.0.Snapshot\jboss-jsfunit-examples\jboss-jsfunit-exam
ples-hellojsf\jboss-jsfunit-examples-hellojsf-webapp\src\main\java\org\jboss\jsf
unit\example\hellojsf\Marathons.java:[67,6] cannot find symbol
[ERROR] symbol : class FacesContext
[ERROR] location: class org.jboss.jsfunit.example.hellojsf.Marathons
[ERROR]
[ERROR] C:\temp\jfsunit-2.0.0.Snapshot\jboss-jsfunit-examples\jboss-jsfunit-exam
ples-hellojsf\jboss-jsfunit-examples-hellojsf-webapp\src\main\java\org\jboss\jsf
unit\example\hellojsf\Marathons.java:[67,25] cannot find symbol
[ERROR] symbol : variable FacesContext
[ERROR] location: class org.jboss.jsfunit.example.hellojsf.Marathons
==================================
So, what is the correct "-P" argument to build the full JSFUnit source bundle?
Best regards
Wolfgang
-
14. Re: Trouble with running JSFUnit 2.0Beta1
wolfgangknauf May 23, 2011 2:38 PM (in response to wolfgangknauf)A new problem :-(: did the JBoss guys switch off http://repository.jboss.org/maven2 (probably a deprecated repository)? I get a 403 when running a build.
My own sample project now fails with this error:
[ERROR] Failed to execute goal on project JSFUnit2Test2: Could not resolve depen
dencies for project JSFUnit2Test2:JSFUnit2Test2:war:0.0.1-SNAPSHOT: Failed to co
llect dependencies for [junit:junit:jar:4.8.1 (test), org.jboss.jsfunit:jsfunit-
arquillian:jar:2.0.0-SNAPSHOT (test), org.jboss.arquillian:arquillian-junit:jar:
1.0.0.Alpha5 (test), com.sun.faces:jsf-api:jar:2.0.4-b03 (provided), jboss.web:s
ervlet-api:jar:3.0.0-beta-2 (provided), javax.enterprise:cdi-api:jar:1.0-SP1 (pr
ovided), org.jboss.arquillian.container:arquillian-jbossas-remote-6:jar:1.0.0.Al
pha5 (test), org.jboss.jbossas:jboss-as-client:pom:6.0.0.Final (compile)]: Faile
d to read artifact descriptor for trove:trove:jar:2.1.1: Could not transfer arti
fact trove:trove:pom:2.1.1 from/to jboss (http://repository.jboss.org/maven2): A
ccess denied to: http://repository.jboss.org/maven2/trove/trove/2.1.1/trove-2.1.
1.pom
The JSFUnit pom.xml all point to http://repository.jboss.org/maven2, too. But they all still build.
I already tried to kill the whole "trove" directory in my local repository cache, but it still tries to download it from the old JBoss repository and fails.
Strange enough, your JSFUnit sources still build (besides the problems from my last post), so it must be something wrong with my project. But I have the same repositories as your sample pom.xml does. Might Maven cache some broken data?
Hope I don't have to kill my complete repository - my internet is poorly slow - this would be one hour of downloading again :-(.
Best regards
Wolfgang