Primefaces updated to 3.4.2 but still showing as Running on PrimeFaces 3.1.1 - eclipse

I was using Primefaces 3.1.1 and I today I have updated to 3.4.2 and to get the corresponding jar I have changed my in my pom.xml to the following and it has successfully downloaded 3.4.2 jar.
<!-- Primefaces library -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.4.2</version>
</dependency>
Problem is when I start my server it is still showing as
Running on PrimeFaces 3.1.1
I did clean project, install maven, build project etc, but of no use.
How can I point to Primefaces 3.4.2?
I am using Eclipse Helios and Glassfish 3.
Thanks

Your classpath might contain old primefaces jar. You could find out what jar provides the primefaces class. Check here and try to locate your primeface jar and remove it from classpath.

It is a good idea to check web server class path, i have encountered with the same problem. I solved it by removed the old version on my Tomcat class path.

Related

Optaplanner - drools file cannot be compiled when project is deployed

We developped a SpringBoot project with Java 11 using optaplanner-core and defining rules in a Drools file. We have no issue for running the app in intelliJ with JDK.
We then deployed the app onto Azure app service where a JRE is installed. We get the following error:
Caused by: org.kie.memorycompiler.KieMemoryCompilerException:
Cannot find the System's Java compiler. Please use JDK instead of JRE or add drools-ecj dependency to use in memory Eclipse compiler
We tried to add the following dependencies but we still get the same error:
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-core</artifactId>
<version>8.4.1.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
<version>7.51.0.Final</version>
</dependency>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>ecj</artifactId>
<version>3.26.0</version>
</dependency>
Would anyone know how to solve this problem ?
Thank you
Adding drools-ecj won't really fix this. The error message is misleading.
Using a JDK instead of a JRE. The easiest way is to upgrade to Java 11 (or higher), as that only comes with a JDK.
If running optaplanner with a JDK is no option for you, you can change the solver config to
<solver>
<scoreDirectorFactory>
<droolsAlphaNetworkCompilationEnabled>false</droolsAlphaNetworkCompilationEnabled>
</scoreDirectorFactory>
</solver>
and if you're using unit tests for java constraints that use the ConstraintVerifier, instantiate it like this
new DefaultConstraintVerifier<>(new MyConstraints(), SolutionDescriptor.buildSolutionDescriptor(myModelClasses))
.withDroolsAlphaNetworkCompilationEnabled(false)
However: From what I understood, disabling the drools alpha network compiler usually comes with a performance impact.

eclipse nullpointer exception for modulare maven project update

I'm using Eclipse 4.4.1 with m2e plugin and the latest gae dependencies. When I import the gae module sample project eclipse tells me that the project configuration is not up to date. If I run the suggested maven -> update project, I get a NPE.
There are a lot of bug reports according NPE on project updates out there. So far I've tried it with mvn eclipse:eclipse or maven project imports, in fresh or existing workspaces but I was never able to get the projects running in eclipse.
Are there any solutions to this?
EDIT:
That is the stacktrace:
java.lang.NullPointerException at
com.google.appengine.eclipse.wtp.maven.GaeRuntimeManager.getGaeRuntime(GaeRuntimeManager.java:85)
at
com.google.appengine.eclipse.wtp.maven.GaeRuntimeManager.ensureGaeRuntimeWithSdk(GaeRuntimeManager.java:55)
at
com.google.appengine.eclipse.wtp.maven.GaeFacetManager.addGaeFacet(GaeFacetManager.java:59)
at
com.google.appengine.eclipse.wtp.maven.GaeProjectConfigurator.configure(GaeProjectConfigurator.java:46)
at
org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:120)
at
org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$3.call(ProjectConfigurationManager.java:477)
at
org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$3.call(ProjectConfigurationManager.java:1)
at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:166)
at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:142)
at
org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:470)
at
org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.configureNewMavenProjects(ProjectConfigurationManager.java:250)
at
org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$1.call(ProjectConfigurationManager.java:163)
at
org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$1.call(ProjectConfigurationManager.java:1)
at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:166)
at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:142)
at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:96)
at
org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1348)
at
org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.importProjects(ProjectConfigurationManager.java:133)
at
org.eclipse.m2e.core.ui.internal.wizards.ImportMavenProjectsJob$1.doCreateMavenProjects(ImportMavenProjectsJob.java:73)
at
org.eclipse.m2e.core.ui.internal.wizards.AbstractCreateMavenProjectsOperation.run(AbstractCreateMavenProjectsOperation.java:62)
at
org.eclipse.m2e.core.ui.internal.wizards.ImportMavenProjectsJob.runInWorkspace(ImportMavenProjectsJob.java:82)
at
org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
You can comment out the appengine-maven-plugin to solve the problem, but by doing that you lose the command-line capabilities of the plugin. You can have the best of both worlds (Eclipse and Maven command-line) by using Maven profiles:
<profiles>
<profile>
<id>gae</id>
<build>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.target.version}</version>
</plugin>
</build>
</profile>
</profiles>
To activate it, for instance, to deploy the project from the command-line, you can do:
mvn appengine:update -P gae
When defining the appengine-maven-plugin only inside a profile, Eclipse won't use it, and the bug goes away. When using the command-line, just remember to activate it using the -P flag.
I had the same problem suddenly appear in one of my projects. Disabling the JPA validator seems to have resolved the issue for now.
Select Windows > Preferences > Validation
Disable the JPA Validator for both Manual validation and Build validation
It might be related to the "The persistence.xml file does not have recognized content" error described in here: www-01.ibm.com/support/docview.wss?uid=swg21616684 .
I had the same issue after updating from Eclipse Kepler (4.3) to Luna (4.4). Commenting out the app-engine-maven plugin from my pom.xml fixed it for me.
<!--
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.target.version}</version>
</plugin>
-->
I'm able to run and deploy my app without any issues so far.
seem to be a duplicate of An internal error occurred during: "Updating Maven Project". java.lang.NullPointerException
got to preferences / Server / Runtime Environemnt
--> select "Google App Engine" and associate a valid SDk to this runtime.

How to import javax.faces library in Eclipse using JDK8?

Based on the advice to use JSF, the following sample would like to be run in order to learn more about JSF and to implement this technique into the servlet. However, a number of libraries is unable to be imported:
package tobedefinedservlet;
import javax.faces.bean.ManagedBean;
#ManagedBean
public class Hello {
final String world = "Hello World!";
public String getworld() {
return world;
}
}
javax.faces
The import javax.faces cannot be resolved
ManagedBean
ManagedBean cannot be resolved to a type
You have to include a JSF library like for example Mojarra in the classpath of your application.
First of all have a look at the Primefaces user guide (especially chapter 2.2). You can download e.g. Mojarra here and include the JAR or add the dependency to your POM.xml if you are using Maven. Hope that helps.
If you're using maven for build automation, add the latest jsf-api dependency to your pom.xml:
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
</dependency>
Or the latest javax.faces-api implementation:
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
<version>2.3</version>
</dependency>
However, note that JSF is integrated into most Java EE application servers, such as JBoss.
See also this answer.
in my case ...I went to project properties and in the search engine I wrote facets ... I went to the right of the window and selected the runtime tab and select wildfly ... then apply and apply and close and solve ...
If you're not using maven you have to manually install the jar. You can download it at this link:
javax.faces
If you're using eclipse you can right click your Web App project and click properties at the bottom. Then under the java build path make sure the libraries panel at the top is selected then select the Web App library and on the right click Add External JARS. You can go to your downloads folder and select the jsf-api-2.1.jar and refresh the project and you can now import that annotation.

Building with Lombok's #Slf4j and Eclipse: Cannot find symbol log

I have the lombok plugin in Eclipse and enabled annotation processing in Eclipse under java compiler, but still it is unable to recognize the log statements when I use #Slf4j annotation.
Do we have to make any other settings?
You also have to install Lombok into Eclipse.
See also this answer on how to do that or check if Lombok is installed correctly.
Full Disclosure: I am one of the Project Lombok developers.
I also faced the similar issue on log and #Slf4j on my STS environment. To resolve this, here is what I did on spring tool suite (sts-4.4.0.RELEASE) and lombok-1.18.10.jar (current latest version available in mavenrepository).
If having maven project, ensure lombok dependency added to it. Else you need manually add the jar to your project classpath.
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
<scope>provided</scope>
</dependency>
Clean build the maven application. This will download lombok jar in your .m2 location by default from maven repository.
The path would be org\projectlombok\lombok\1.18.10\
Now open command prompt and navigate to the lombok path and execute command java -jar lombok-1.18.10.jar
C:\xxx\xxx\org\projectlombok\lombok\1.18.10>java -jar lombok-1.18.10.jar
Opens up lombok dialog box. If see message Can't find IDE
Click Specify location...
Provide the path to your STS root location
My case it is
C:\apps\sts-4.4.0.RELEASE\SpringToolSuite.exe
Install/Update
Install successful
Click Quit Installer
Now in explorer navigate to your STS root path.
C:\apps\sts-4.4.0.RELEASE\
We see lombok.jar placed in the sts root path
Now edit in notepad SpringToolSuite4.ini file
We see following appended at the end
-javaagent:C:\apps\sts-4.4.0.RELEASE\lombok.jar
Start STS using SpringToolSuite4.exe
Clean, rebuild your project.
So like others, i also faced this issue. Below is what I did.
Installed lombok.jar like explained here.
Tried restarting eclipse. (Did not work)
Tried refreshing gradle project. (Did not work)
tried what Hervian suggested in his answer here. (Did not work)
Closed the projects, deleted from workspace and then re-imported. Bam!! Worked.
I got the same error even after Lombok was installed. For me the solution was to add another lombok annotation (i used #Data) to my class after which the eclipse errors went away. Perhaps this force refreshed some cache.
Of course, I simply deleted the #Data annotation afterwards.
this got the fix to me by adding the slf4j dependency, Lombok can identify the slf4j but does not get the download, this is true for java project if you are using spring boot then slf4j comes by default.
here are my dependencies
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.6</version>
<scope>provided</scope>
</dependency>

WTP - m2e not deploying transitive dependencies

I have a web application which is structured in this way:
A.jar -> B.war -> C.war
I'm using Eclipse Juno and the WTP version is 1.1. The A.jar is a workspace utility project which is being included by B.war. B.war is a war project that is included by C.war as an overlay. That's the way I'm doing that:
<dependency>
<groupId>com.projects</groupId>
<artifactId>B</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
After that, I deploy the C project to the Tomcat server. That works like a charm if I manually deploy the Maven generated war to the Tomcat, because A.jar is included in WEB-INF/lib. However my problem comes when I let m2e-wtp do the deploy, because it's doing the overlay properly but not including the A transitive dependency. I tried including it as a pom, as I read somewhere around here, but I have the same result.
<dependency>
<groupId>com.projects</groupId>
<artifactId>B</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.projects</groupId>
<artifactId>B</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
</dependency>
I'm using the newest versions of m2e (1.2) and m2e-wtp (0.16) and have my projects updated with the Maven configuration.
Is it an m2e-wtp issue or simply do I have to organize my project in other way?
EDITED
I noticed m2e-wtp configuration is stored into Eclipse's project./settings/org.eclipse.wst.common.component file. That's how it looks for my war:
<dependent-module deploy-path="/"
handle="module:/overlay/prj/B?includes=**/**&excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type>
</dependent-module>
<dependent-module deploy-path="/"
handle="module:/overlay/slf/?includes=**/**&excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type>
</dependent-module>
As I can see the war dependency is set for consume while the jar dependencies are set for use.
Released m2e-wtp version 0.17 doesn't seem to fix it.
EDITED (2013-08-30)
Today I was back to the same problem. Even I have Eclipse kepler installed with the latest stable release of WTP out of the box, this problem seems to persist. I thought it was solved, but I apparently mischeck it...
I think it is not a problem of your project organization. Your issue is very similar to this m2e-wtp bug report.
It seems to be a Eclipse Juno and WTP Plugin problem.
I had the same problem and i solved in this way:
Backup your eclipse workspace and your project code
remove your project from eclipse (without remove the contents)
open a command terminal (cmd)
run mvn eclipse:clean
run mvn eclipse:eclipse -Dwtpversion=2.0
edit your eclipse classpath file with a text editor: %PROJECT_PATH%\.classpath
remove all lines with attribute kind="var" from your .classpath file. For example:
< classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar" sourcepath="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5-sources.jar"/>
save file & close editor.
in eclipse, click on: file->Import...->Maven->import existing maven project, and import your project again
Maven -> Update Project (if you want)
You could see on deployment assembly in eclipse project properties that problem is solved and the maven dependencies are there.
Hope this helps.
I also have this problem. I have an ugly workaround:
Put all the original war's dependencies in a separate project (type jar) and make both original war and overlay war depend on that. So for the example:
A.jar -> B.war -> C.war
becomes
A.jar -> B-dependencies.jar (new module called B-dependencies created)
B-dependencies.jar -> B.war
B-dependencies.jar -> C.war
Note that it's not specific to Tomcat; I'm using JBoss.