ova2 / primefaces-cookbook

PrimeFaces Cookbook - recipes to leading JSF component suite
http://ova2.github.com/primefaces-cookbook/
100 stars 92 forks source link

Jetty deployment not working? #1

Closed cjansen18 closed 11 years ago

cjansen18 commented 11 years ago

Hi Oleg:

I've tried running the sample code on Jetty as advised in the readme file. Seems that some of the dependencies (Primefaces and Apache Commons File) need to be included in the Jetty plugin dependency list in order to get Jetty to startup.

After adding those, my Jetty server will start up, however, accessing the demo code via: http://localhost:8080/primefaces-cookbook/ produces 404 errors in my browser.

Can you please verify the Jetty deployment works?

Odd thing is that I can deploy and run to Tomcat, but when I do, I need to access the code via: http://localhost:8080/showcase

Chris

Edit: it appears the context is empty after Jetty startup:

[INFO] Webapp directory = C:\springsource\git\primefaces-cookbook\src\main\webapp Mar 27, 2013 8:49:06 AM com.sun.faces.config.ConfigureListener contextInitialized INFO: Initializing Mojarra 2.1.13 ( 20120907-1514) for context '' Mar 27, 2013 8:49:07 AM com.sun.faces.spi.InjectionProviderFactory createInstance

cjansen18 commented 11 years ago

I've made some corrections to the pom.xml in order to get the code to successfully run on embedded Jetty. They can be found in the pom.xml located under the forked repo:

https://github.com/cjansen18/primefaces-cookbook

mulderbaba commented 11 years ago

it works flawlessly for me..

can you put maven in debug mode with -X and see what happens?

Mert

On Wednesday, March 27, 2013 at 1:04 PM, Christopher Jansen wrote:

Hi Oleg: I've tried running the sample code on Jetty as advised in the readme file. Seems that some of the dependencies (Primefaces and Apache Commons File) need to be included in the Jetty plugin dependency list in order to get Jetty to startup. After adding those, my Jetty server will start up, however, accessing the demo code via: http://localhost:8080/primefaces-cookbook/ produces 404 errors in my browser. Can you please verify the Jetty deployment works? Chris

— Reply to this email directly or view it on GitHub (https://github.com/ova2/primefaces-cookbook/issues/1).

cjansen18 commented 11 years ago

Hi Mert:

I am running Maven 3.0.4 on Spring STS 3.2. Here's the error that Maven reports when running* an install followed by a jetty:run -Pmojarra -e -X *

[DEBUG] Configuring mojo 'org.mortbay.jetty:jetty-maven-plugin:8.1.0.RC4:run' --> DEBUG classesDirectory = C:\springsource\git\primefaces-cookbook\target\classes DEBUG contextPath = /showcase DEBUG daemon = false DEBUG execution = org.apache.maven.plugin.MojoExecution@398d1f81 DEBUG pluginArtifacts = [javax.el:el-api:jar:2.2:compile, com.sun.faces:jsf-api:jar:2.1.13:compile, com.sun.faces:jsf-impl:jar:2.1.13:compile, org.slf4j:slf4j-jcl:jar:1.6.4:compile, org.slf4j:slf4j-api:jar:1.6.4:compile, commons-logging:commons-logging:jar:1.1.1:compile, log4j:log4j:jar:1.2.16:compile, org.eclipse.jetty:jetty-util:jar:8.1.0.RC4:runtime, org.eclipse.jetty:jetty-webapp:jar:8.1.0.RC4:runtime, org.eclipse.jetty:jetty-xml:jar:8.1.0.RC4:runtime, org.eclipse.jetty:jetty-servlet:jar:8.1.0.RC4:runtime, org.eclipse.jetty:jetty-security:jar:8.1.0.RC4:runtime, org.eclipse.jetty:jetty-server:jar:8.1.0.RC4:runtime, org.mortbay.jetty:servlet-api:jar:3.0.20100224:runtime, org.eclipse.jetty:jetty-continuation:jar:8.1.0.RC4:runtime, org.eclipse.jetty:jetty-http:jar:8.1.0.RC4:runtime, org.eclipse.jetty:jetty-io:jar:8.1.0.RC4:runtime, org.codehaus.plexus:plexus-utils:jar:1.1:runtime, org.apache.maven.plugin-tools:maven-plugin-tools-api:jar:2.9:runtime, net.sf.jtidy:jtidy:jar:r938:runtime, org.eclipse.jetty:jetty-plus:jar:8.1.0.RC4:runtime, org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:runtime, org.eclipse.jetty:jetty-jndi:jar:8.1.0.RC4:runtime, javax.mail:mail:jar:1.4.1:runtime, org.eclipse.jetty:jetty-jmx:jar:8.1.0.RC4:runtime, org.glassfish.web:jsp-impl:jar:2.2.2-b06:runtime, javax.servlet.jsp:jsp-api:jar:2.2:runtime, javax.servlet.jsp.jstl:jstl-api:jar:1.2:runtime, org.glassfish.web:jstl-impl:jar:1.2:runtime, org.glassfish.web:el-impl:jar:2.2:runtime, org.eclipse.jdt.core.compiler:ecj:jar:3.7:runtime, org.eclipse.jetty:jetty-annotations:jar:8.1.0.RC4:runtime, org.apache.geronimo.specs:geronimo-annotation_1.0_spec:jar:1.1.1:runtime, asm:asm-commons:jar:3.1:runtime, asm:asm-tree:jar:3.1:runtime, asm:asm:jar:3.1:runtime, org.eclipse.jetty:jetty-websocket:jar:8.1.0.RC4:runtime, org.apache.maven:maven-plugin-api:jar:3.0.3:runtime, org.apache.maven:maven-artifact:jar:3.0.3:runtime, org.apache.maven:maven-core:jar:3.0.3:runtime] DEBUG project = MavenProject: org.primefaces.cookbook:showcase:0.1.0 @ C:\springsource\git\primefaces-cookbook\pom.xml DEBUG projectArtifacts = [] DEBUG reload = automatic DEBUG scanIntervalSeconds = 1 DEBUG skip = false DEBUG stopKey = foo DEBUG stopPort = 9966 DEBUG name = org.eclipse.jetty.server.Request.maxFormContentSize DEBUG value = -1 DEBUG systemProperty = org.mortbay.jetty.plugin.SystemProperty@293b9077 DEBUG systemProperties = org.mortbay.jetty.plugin.SystemProperties@58989c7 DEBUG testClassesDirectory = C:\springsource\git\primefaces-cookbook\target\test-classes DEBUG tmpDirectory = C:\springsource\git\primefaces-cookbook\target\tmp DEBUG useProvidedScope = false DEBUG useTestScope = false DEBUG webAppSourceDirectory = C:\springsource\git\primefaces-cookbook\src\main\webapp [DEBUG] -- end configuration -- [INFO] [jetty:run {execution: default-cli}] [INFO] Configuring Jetty for project: showcase [INFO] Webapp source directory = C:\springsource\git\primefaces-cookbook\src\main\webapp [INFO] Reload Mechanic: automatic [INFO] Classes = C:\springsource\git\primefaces-cookbook\target\classes [DEBUG] Starting Jetty Server ... [DEBUG] Property org.eclipse.jetty.server.Request.maxFormContentSize=-1 was set log4j:WARN No appenders could be found for logger (org.eclipse.jetty.util.log). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. [INFO] Context path = / [INFO] Tmp directory = C:\springsource\git\primefaces-cookbook\target\tmp [INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml [INFO] Web overrides = none [INFO] web.xml file = file:/C:/springsource/git/primefaces-cookbook/src/main/webapp/WEB-INF/web.xml [INFO] Webapp directory = C:\springsource\git\primefaces-cookbook\src\main\webapp [INFO] Jetty server exiting.

[INFO]

[ERROR] BUILD ERROR

[INFO]

[INFO] Failure

Embedded error: Multiple exceptions

[INFO]

[DEBUG] Trace org.apache.maven.lifecycle.LifecycleExecutionException: Failure at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138) at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60) 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.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.plugin.MojoExecutionException: Failure at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:536) at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364) at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:514) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694) ... 17 more Caused by: MultiException[java.lang.NoClassDefFoundError: org/primefaces/component/api/Widget, java.lang.IllegalStateException: !Selecting] at org.eclipse.jetty.server.Server.doStart(Server.java:256) at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511) ... 21 more

[INFO]

[INFO] Total time: 17 seconds [INFO] Finished at: Wed Mar 27 13:26:19 EDT 2013 [INFO] Final Memory: 71M/730M

[INFO]

On Wed, Mar 27, 2013 at 12:41 PM, Mert Caliskan notifications@github.comwrote:

it works flawlessly for me..

can you put maven in debug mode with -X and see what happens?

Mert

On Wednesday, March 27, 2013 at 1:04 PM, Christopher Jansen wrote:

Hi Oleg: I've tried running the sample code on Jetty as advised in the readme file. Seems that some of the dependencies (Primefaces and Apache Commons File) need to be included in the Jetty plugin dependency list in order to get Jetty to startup. After adding those, my Jetty server will start up, however, accessing the demo code via: http://localhost:8080/primefaces-cookbook/ produces 404 errors in my browser. Can you please verify the Jetty deployment works? Chris

— Reply to this email directly or view it on GitHub ( https://github.com/ova2/primefaces-cookbook/issues/1).

— Reply to this email directly or view it on GitHubhttps://github.com/ova2/primefaces-cookbook/issues/1#issuecomment-15534967 .

ova2 commented 11 years ago

I have Maven 3.0.3. It worked and works like a charm. No Problem with Jetty running.

cjansen18 commented 11 years ago

I discovered the issue and it's on my side.

In Eclipse->Run->Run Configurations->Create Maven Build, This is from where I was launching Jetty using jetty:run -Pmojarra.

In this window, you'll also see a dropdown that allows you to select Maven Runtime. Mine was set to 2.2.0 rather than 3.0.3! I have both versions in order to support some legacy projects. I am able to build and run using your version of the source.

Seems like my version also allows you to run on Maven 2.2.0! :) My thanks for creating the book. I'm enjoying going through the exercises.

-Chris

GeraldScott commented 9 years ago

I had a similar problem, and it was because I was using maven2 on Debian Wheezy.

I removed maven2 and installed maven 3.0.5 from the Debian package. All works beautifully.

Thanks for all the hard work putting the Cookbook together.

ova2 commented 9 years ago

Thanks guys for your feedback. We have almost finished the 2. edition of the PrimeFaces Cookbook. The source code is here https://github.com/ova2/primefaces-cookbook/tree/second-edition It is based on JSF 2.2 and PrimeFaces 5.2 (we use currently 5.2-SNAPSHOT because 5.2 is not released yet). There is some new stuff, such as Client Side Validation, new components, such as p:cache, p:exceptionHandler, usw. Take a look.