Redeploy application after JSF managed bean modification - eclipse

Why is an application redeployment is needed for JSF managed bean modifications to take effect?
Development environment:
Eclipse Indigo.
JBoss as 7.
JBossAS Tools.
Further explanation:
If I modify a JSF page, I can visualize the modification after simply refreshing the page. But this is not the case for JSF managed bean modifications where I have to redeploy the application to visualize them.

Eclipse/JBoss cannot handle new classes, methods, nor fields during hotpublish/hotdeploy. They can however handle modified method bodies and values of non-static fields with help of JVM hot-swap.
JRebel plugin is able to handle new classes, methods and fields during hotdeploy, but not new managed bean registrations.
Please note that this all is unrelated to JSF. It's related to Java development in general and thus also affects all other kinds of Java frameworks/libraries whose code you basically try to edit "live".
See also:
Changes in .xhtml file not reflected in browser, restart and build needed

I solve like this Project -> Build Automatically

Related

How to get eclipse content assist working in XML files

I have started creating the Spring web application where I need to mention the spring classes in the XML configuration files, for ex, the deployment descriptor (web.xml) where I need to mention the DispatcherServlet class of Spring.
What I am looking for is, I want eclipse to show me the list of packages/classes when I type org.springframework..., like we do in the Java editor. I have googled to find out, but no luck. I am sure there would be plugins available. Can any of you please share me on how to fix this?
Since you are working on a spring project, I'd recommend installing the SpringToolSuite (STS). The info page is here: http://spring.io/tools
Since you already have an Eclipse instance that you are working with, you should go with the update sites: http://dist.springsource.com/release/TOOLS/update/e4.4/
(Make sure to use the correct update site for the Eclipse version you are using.)
Not only does STS include all tools for XML editing, but it also includes special tools for editing your Spring application files.

GWT blamed RequestFactory ValidationTool must be run on on sub module(project) when launching main project

GWT 2.5.0/Google Plugin for Eclipse/m2e/GWT-maven-plugin 2.5.0/Request Factory
I configs my project according to the GWT wiki working with maven and it works pretty well, but has some trouble in my sub-project.
Suppose i have two project A and B, A is a standard GWT project, B is sub-project and has one GWT module, it contains some common UI widgets and some common Entity proxies and RequestFactory, A project depends on B project through Maven dependency, and also in A's Module.gwt.xml, there is an inheritance on B module.
The problem is when i try to lauching A project using GPE, it blames:
The RequestFactory ValidationTool must be run for the … XXXRequestFactory type
where the XXXRequestFactory is in B project. I have to close project B in Eclipse, so it will not blames, this is cumbersome when i want to modify something in B project which used in A to see the changes, i have to close B then see the changes, then open B and made changes...
I wonder if there is a way to solve this problem so my life would be easier.
Thanks.
One more thing, i also use maven-processor-plugin and build-helper-maven-plugin in project B, and make sure the goals are run when i call maven install on B, but seems no help.
I also had this problem and here is the solution which fixed this issue. This answer assumes that you need to execute the GWT app in dev mode (as you mentioned you tried with gwt eclipse plugin)
You may already know this RequestFactory must validate the interfaces, domain types and proxies before execution. So you need to enable annotation processing for this which creates mapping data for server side components in addition to said validation. If this process not succeeded it will throw the error you mentioned.
You can enable the requestfactory validation for project B in the project properties. Go to compiler properties, enable annotation processing providing the path to requestfactory-apt.jar. After this when you compile the project you can see the .apt_generated in your project home dir containing mapping files. If you open one of them you can see generated mappings for your proxies.
Launch the application (project A in your case) and it should run without any errors
In Maven world you have to specify the dependency for this apt jar. In addition to this you might get compiler errors in those generated classes when doing mvn compile, to resolve that simply delete the content in .apt_generated.

Is it possible to apply changes to JSF files without republishing?

I'm using IBM RAD version 8.0 and deploying the EAR applications to IBM WebSphere 7.0. Each time I change a JSF file, I need to republish the application, otherwise the changes are not visible.
Publishing takes some time, so usually it takes minimum a minute before I'm able to see the efects of even the most minor change. In 'normal' application development it's about a few seconds, and it's crucial for someone who is no JSF coryphee and still learns and needs to experiment...
Is it possible to use the JSF ability to re-load the JSF page definition without application restarting, when working with IBM RAD and WebSphere? Or I'll be forced to create second environment with Eclipse & Tomcat, for JSF experiments only?
This is normally to be configured in server configuration. Doubleclick the desired server in Eclipse's Servers view and head to Publishing section.
Note that you should take Facelet cache into account as well, particularly when using MyFaces which caches relatively agressively. If you make sure that javax.faces.PROJECT_STAGE context parameter is set to Development, then both MyFaces and Mojarra will relax the Facelet caching strategy, causing it to recompile the Facelet file almost instantly instead of using the cached version for a rather long time.
An alternative to Publishing setting is to use JRebel. It is able to publish changes in Java classes such as managed beans and EJBs as well, saving a lot of hotdeployment time. It has an Eclipse plugin as well.
This thread is old, but I still had the same problem, using eclipse and WebSphere.
One place to check is this. If you use JSF files with the .xhtml ending, you have to make sure that changes in these do not trigger automatic republishing.
In the tab "Servers" double-click on your server.
Open the "Publishing settings for WebSphere Application Server"
Click on "Set Advanced Publishing Settings...".
In the "List of file extensions that do not trigger the server to publish ..." insert or append ", *.xhtml".
Close these settings and restart the server.
In web.xml I have also added a parameter with the name javax.faces.PROJECT_STAGE and the value Development , which may have an influence on the offending behavior.

Exporting Eclipse RAP war with OSGi bundles with external bundle-path

I have an Eclipse RAP product, I like to export as a web app for use inside Tomcat. For this I use the warproduct exporter in Eclipse, which until now have worked fine.
I have a problem with compilation of one of the OSGi bundles in the product as this refers to a set of external jars using a variable substitution. This is shown in the following fragment from a MANIFEST.MF:
Bundle-Name: ...
Bundle-SymbolicName: ...
Bundle-ClassPath2: external:/A/test1/jakarta-tomcat/shared/lib/a_base.jar
Bundle-ClassPath: external:$A_HOME$/jakarta-tomcat/shared/lib/a_base.jar
If I use the first classpath instead and have the correct /A/test1/jakarta-tomcat/shared/lib/a_base.jar in place, then everything is fine during the compilation... And I can even manually change the MANIFEST.MF afterwards to the correct version with the substitution.
But, I would really like to avoid this extra step, if at all possible!
I think the question is how to pass in a proper value for A_HOME during the compilation?
(Why do this? Above, I just shown a single jar file, but we have a larger number of jar files we want to share between our older Tomcat applications and the newer RAP based application. We know, there are other ways of sharing jars in this situation - e.g. via an OSGi framework extender or the extendedFrameworkExports initialization parameter in web.xml - but we need the chosen method as we use EMF and therefore cannot share the EMF meta data between Tomcat and Eclipse... And thus not the class objects...)
this feature is currently not support within the WAR Products Tooling. I recommend to open a bug against Eclipse Libra and to define the feature request their. Anyway, we have created an example how to build a RAP application with tycho which is pretty easy, maybe you want to take a look: https://github.com/eclipsesource/rap-mobile-demos
Cheers Holger

Content Assist for JSF2 + CDI (weld) beans + Eclipse Helios

Im trying JSF2 CDI (weld) beans in eclipse helios instead of ManagedBeans, but can't do the auto completion inside the expression language for my Named beans (the #{myNamedBean.Ctrl+Space} thingy)
But OTOH with ManagedBeans, the content assist works well ..
Is the content assist for CDI beans supported yet in Eclipse Helios?
Anybody got experiences in this ?
Install JBoss tools. Then by adding <nature>org.jboss.tools.jsf.jsfnature</nature> to the natures section of the .project file, the support improved in my Eclipse J2EE Helios edition. (This step is probably equal to Configure->Add JSF Capabilities in the project settings.) The context completion then works for cc.attrs.<ctrl-space> when building component compositions, but sadly still not for any #ManagedBeans.
Switch from ManagedBeans to CDI: I changed all #ManagedBeans to #javax.inject.Named and the scopes to #javax.enterprise.context.*Scoped etc. I also enable CDI Support in the project settings. Then I get context completion on beans in .xhtml!
First limitation: It only works when the EL is part of an attribute value. It does not work if you just use #{EL} somewhere else on the .xhtml page.
Second limitation: If you define the name of your bean via a constant, it is not recognized for context competion: Does not work: #Named(value = MyBean.BEANNAME). You have to set the name as a String, like: #Named(value = "myBean")
Third limitation: If you use parameterised method calls (e.g. with Tomcat7 or Glassfish), this is not supported by autocomplete. The autocomplete only shows get/set/is properties of the bean.
Note: It works out of the box in Netbeans 7.
If there is any support, it would be from JBoss Tools.
Before you install JBossTools, please note that for EL auto complete support and managed bean mapping all you need is these 2 components from the JBoss Tool set.
1. JBoss Tools JSF
2. JBoss Tools Visual Page Editor
If you do not select these specific tools then all the 20+ tools will get installed.
Also, note that sometimes your default file *.xhtml association will not change after tool installation. You may have to manually change file association preference. File>Preference>File Associations. Select *.xhtml and set "JBoss Tools Visual Page Editor" as the default editor.