Good evening,
Currently I'm trying to add Richfaces to a Maven based project in Eclipse. However, when I deploy my application (Glassfish) I get the following warnings in my browser:
Warning: This page calls for XML namespace h++p://richfaces.org/rich declared with prefix rich but no taglibrary exists for that namespace.
Additionally, I get no error messages in my console.
In Netbeans, I had the same problem when trying Richfaces the first time. However, I was able to solve this by doing Right-click on the Dependencies folder in my web project, and then selecting Download Declared Dependencies. However, I don't have this option in Eclipse.
The project in Eclipse uses JSF 2.1 (Apache MyFaces 2.1.5). The dependencies were added as follows:
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-api</artifactId>
<version>4.2.2.Final</version>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
<version>4.2.2.Final</version>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-api</artifactId>
<version>4.2.2.Final</version>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
<version>4.2.2.Final</version>
</dependency>
Although this code worked fine in Netbeans I also tried following the advice on:
https://community.jboss.org/wiki/HowToAddRichFaces4xToMavenBasedProject
https://community.jboss.org/wiki/MavenGettingStarted-Users
However, the problem persisted. Any ideas why this is happening?
This looks as though Maven hasn't downloaded the dependencies into its local repo. The easiest way to do this in eclipse is to use the m2e plugin. Once installed, right click on your project and select;
Run As > Maven Clean
which attempts to clean a project's working directory of the files that we're generated at build-time. You can read about it here: http://maven.apache.org/plugins/maven-clean-plugin/
The again do right click on your project and select:
Run As > Maven Install
which is used to add artifact(s) to your local repository. You can read about it here: http://maven.apache.org/plugins/maven-install-plugin/
Try deploying that to your server, and it should'nt moan about missing dependencies. Also I suggest once you're happy with the concepts of maven, to get familiar with using it from the command line. Good luck!
Here's a short cookbook approach I found worked after about a dozen promised simple JSF Get Started. I have a target dictated by other areas of a project. Netbeans and no big server (e.g.) Glassfish, JBOSS. I want to start with Tomcat and migrate to an embedded server. I expected the problems with the migration. It has taken about 4 days off and on to find an example that works. Start here:
Getting Started With RichFaces 4
It is really disappointing because exact same demo took 30 min AngularJS. The first problem is there's no ready examples that run. People writing these projects just want flash examples that don't explain the basics. Secondly there's not much (virtually) nothing that works when you do it with Netbeans 8. So be prepared to hack about at first until you find what works for you.
So far I got Netbeans 8 and Tomcat 8 to run this example. I'm happy enough but there's still an error on starting. The index.xhtml works OK, so I'm counting a 'win'. If you are on Windows, you may wan to edit this on one line.
mvn archetype:generate \
-DarchetypeGroupId=org.richfaces.archetypes \
-DarchetypeArtifactId=richfaces-archetype-simpleapp \
-DarchetypeVersion=4.0.0.Final \
-DgroupId=com.jasmineconseil.samples.richfaces4 \
-DartifactId=richfaces4-start
This generatd doesn't completely work. It flounder on a missing resources/ folder. Odd since it was responsible for generating the resources folder imho. I made the resouces folder and re-did the generate. That at least gave me a POM file. Oh, yes, I'm using maven 3 if that helps people.
I moved to the project directory, and the next step of installing the POM:
mvn install
That also did some stuff and failed. Something to do with a compile. At this point I shifted to Netbeans. The POM file doesn't load as a project, I had to click on the "resolved problems" menu choice.
When I clicked resolve, most of the issues went away.
Next, Project Properties. The main thing was to set the Java version (1.8 on this project). Set the Tomcat server of choice. Check the component libraries and ensure RichFaces is ticked.
Click build -- It builds. Click Run/Debug ... If your Tomcat install is all set-up, it works! With a runtime error from Catalina. Still the web page comes up and the error doesn't display after that (so far, so good....)
13-Aug-2014 00:04:11.058 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/hellojsf]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:697)
....
I haven't looked at that yet. There are notes on JavaHotChocolate about different kinds of poblems with Jars and errors. I'm hoping I'll come across something or I'll be back here with a question on the error.
You may also find these useful to unravel the ball of wool.
RichFaces for JSF use ... this site is VERY good, the author is taking time to explain what's working (for him)
RichFaces Developer's Guide
JSF 2, Maven and Tomcat 7 ... This was to be my next example to build.
Netbeans warns blacklisted repository declarations for "http://download.java.net/maven/2" in pom.xml. How to deal? [Update]
Gotcha ...
Some things I found with Netbeans(?) especially after a clean or closing Netbeans and reopening the project.
Wants to change my server / Tomcat setting
Wants to change RichFaces (uncheck)
Standard maven plugins are missing their version number (this is a warning now, soon an error)
Also take a look at your Maven setting.xml file (see JBOSS manual).
Change the URL for java-net repository as shown: Netbeans warns blacklisted repository declarations for "http://download.java.net/maven/2" in pom.xml. How to deal? [Update]
Ensure Tomcat Catalina deployment folder is 'clean': $ tomcat\conf\Catalina\localhost [Update]
Hopefully some of the people looking on this topic can take one step forward with these examples. Bon chance!
Related
I'm trying to migrate a netbeans/ant gwt project to an eclipse/maven gwt project.
For that I used the archetype gwt-maven-archetypes, to create a maven project, and after that I copied the sources.
I had succesfully been able to run codeserver and the application itself, using maven comands, as suggested by the archetype author. I even can debug on chrome dev console.
The problem, is that I want to debug from eclipse, and it seems eclipse gwt plugin, doesn't support the current structure.
Any ideas?
Thanks
I ended up, giving up this archetype, and I'm using now simple webapp maven archetype. I figured it out, but still a little tricky on my project.
So, as #ElHoss, has suggested I'm using SDBG. Besides that, I'm not using jetty, but my own tomcat installation, so I've followed this video instructions, together with the SDBG page video's instruction.
At the end, I have 3 Running Configuration items:
The one that starts Tomcat;
The one that starts codeserver;
Chrome Launcher, as instructed on SDBG page.
If you need plus information, please comment.
Thanks.
I have a fairly complex Java EE project which can be built fine from Maven. After importing it to IDEA, I had set up a working deployment of the frontend WAR and the backend EAR to a local Weblogic 12c server. The project also have several 'common' artifacts packaged as jars and used by both the frontend and backend artifacts. For deployment, I used the exploded artifacts to save some time on packaging/unpacking, everything works fine till that point.
During development, I edit some Java sources and try to redeploy the updated artifacts to the running Weblogic. I press Shift+F10, choose Redeploy artifacts, I see IDEA building the project, the project redeploys on the server, and more often than not, I do not see any of the recent changes. Even if I choose Rebuild project explicitly and then try to redeploy artifacts after, no changes can be seen on the server. The only safe way to make my changes appear in the deployed artifacts is to invoke maven from the command line calling the package goal, and then redeploying from IDEA. (No JRebel is installed, is being used either in the IDE or on Weblogic, and I'd like to stay that way).
Is that expected behaviour from IDEA? Could this be something specific to our project or something global? Should IDEA be able to discover which projects needs rebuilt and repackaged and then redeploy the EAR/WAR artifacts properly to the server? Does it need any help from my side achieving that goal?
Whats your run/debug configurations? Check this, if not already sois not.
in the quick menu, edit configurations > Run/debug configurations window:
Server tab:
On 'update' action: restart server
Before launch: set 'run maven clean' and 'run maven install'
Deplowment tab
inserts your ear's here.
don't sure this specific answer your question but what I can suggest you is to try configure
weblogic maven plugin
then you can execute deployment from command line / or from IDEA with maven support.
http://docs.oracle.com/cd/E21764_01/web.1111/e13702/maven_deployer.htm
http://www.youtube.com/watch?v=hagaMr6UL6U
Evenif your final goal is to do the whole built process done by IntelliJ build and deployment options I will first try the following:
If your project was set up properly in maven you should be able to load you maven pom.xml within you IntelliJ. All the maven build commands and deployment setting you were doing through mvn command line will show up in your IntelliJ's maven panel in a nice three structure.
If this works out then clearly one of the libraries that are built through your IntelliJ build are not being deployed properly into the right location. You need to narrow down which one of the jars, the ear, or the war has to be affected by a single change you make and then check whether the date of the file is updated in the location it is to be deployed or not.
To wrap up, my humble sugestion though is to use either maven or gradle intelliJ panels for your J2EE projects. As you do achieve the defined goal of having your project built completely through the IntelliJ idea. Also whatever plugin you add to your maven shows up in you idea's maven/gradle panel. It is a fairly straight forward approach and you achieve a powerfull and flexible deployment and build tools within IntelliJ like your wanted.
See title. I would also like the project to redeploy after every change. I am new to this area so my knowledge isnt that good. I tried googling and searching here, but I can't find any answer.
thanks for any help
There are two plugins that combined together in Eclipse work quite well together to perform what you want:
M2E: M2Eclipse which handles everything related to Maven.
Eclipse Web Tool Platform (WTP): which handles everything Java EE related (Tomcat, JBoss, etc...)
For M2E to work properly with WTP, you need to add m2e-wtp. You may find several useful information as well as some good links here.
I would start from the Eclipse Java EE distribution (it includes already Eclipse-WTP) and then add M2E (either with their update site or through eclipse market place: look for M2E and M2E-WTP).
From there, you create a Web Project and you can run it on a Tomcat server. The first time you try to run you project on a server, you will install Tomcat and it will appear in view named "Server". Double click on the server to configure ports, automatic deployment etc...
You can easily deploy a webapp using the Cargo Tomcat plugin. Here's helpful articles on this topic:
Maven Tomcat Deployment using Cargo plugin.
Autodeployment with Maven, Tomcat, and Cargo.
Where can I find the jar file or the source code of JEE6? Or is there another way how you can get autocompletion for this in Netbeans/Eclipse?
And I have just installed glassfish so that i can use JAX-RS but i do not understand how it works. Why does the javacompiler find these classes but netbeans does not? I building with maven2 but have not set any paths or so.
And why am I not able to install JEE6 without glassfish? I just do not need an application server for a REST service with Jersey.
Best regards,
CQQL
Question #1:
See this example project.
The example project is built with maven, which may answer your question about auto-complete. Netbeans 6.8+ (approx) has built-in maven support. After the first build of the example project, I think you'll see that auto-complete works better for any dependencies (i.e. jersey) inside the pom.xml. In my Netbeans, auto-complete works, but the javadocs are not there, which may mean that Jersey wasn't bundled with them.
Question #2: Your maven on the command line and the one inside Netbeans are different copies. You can make Netbeans use a specific copy of maven in Tools/Options/Misc/Maven/External Maven Home. This may clear up some confusion.
Question #3: Jersey can run in Tomcat or Jetty if you find Glassfish to be too much app server for your needs.
So I downloaded a trial of idea ultimate, and I want to get spring mvc going with tomcat.
So I setup a new project, configured it to use sun jdk.
I chose a spring application, and it created and downloaded the following:
I don't see any spring-mvc libraries, are they included in there or do I have to do something about that?
Can someone outline what I have to do to get this to build like a spring mvc web application?
I find that the best way to start a new IDEA project is to use the Maven. This allows you to easily build your project without launching the IDE, automatically maintaining all libraries for you.
"Create project from scratch", then select "Maven module" in the next screen. Click on "Create from archetype" and select the "maven-archetype-webapp". This will give you a basic Maven layout which builds a simple WAR file.
Now to add the Spring libraries, open the Maven build file - pom.xml - and insert a new dependency on the Spring MVC framework:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
From here, you can follow the Spring MVC reference documentation - add the Dispatcher Servlet and Context Listener to web.xml, a Spring XML context and so on.
Something else you might find useful is the Maven Jetty plugin. Once configured, you can run your app by simply typing "mvn jetty:run" at the command prompt (or launching it from within the IDE). Maven will fetch all that's required and deploy the app for you, no need for an external app server setup for quick testing.
I'm not sure if your setup would be identical to mine, but when I downloaded spring-framework-2.5.6 there were jar files named spring-web.jar, spring-webmvc.jar, etc. in the \dist\modules subfolders. The tutorial indicated at least spring-webmvc.jar should be in your WEB-INF/lib folder.
This tutorial optionally used eclipse, but might be helpful anyways, especially getting started:
http://static.springsource.org/docs/Spring-MVC-step-by-step/
I think there are specific JARs for the Spring MVC stuff. Basically when you download the latest Spring Framework and you extract the zip you need to go to the dist folder and add the org.springframework.web.jar and org.springframework.web.servlet.jar/org.springframework.portlet.jar to your project. I'm pretty sure that the servlet/portlet jars will have your MVC specific classes.