Why do I get a java.lang.NoSuchFieldError on web application with JSF? - primefaces

I am working on web application with JSF and I try to make notifications by Primefaces Push but when I run the project I got this exception :
java.lang.NoSuchFieldError: framework
at org.primefaces.push.PushServlet.configureFramework(PushServlet.java:66)
at org.primefaces.push.PushServlet.configureFramework(PushServlet.java:36)
at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:74)
Also I added this Libraries :
primefaces 5.0 atmosphere-runtime-2.3.5 slf4j-api-1.7.7 commons-lang3-3.4

You should use an Atmosphere version that is compatible with PrimeFaces 5.0. That is 2.1.3 according to the docs, pom and releasenotes.

Related

org/apache/logging/log4j/util/Base64Util.class: Class Version Error Please recompile with supported JDK

/build/Debug/ant/pdm.jar!/META-INF/versions/9/org/apache/logging/log4j/util/Base64Util.class: Class Version Error. Please recompile with a supported JDK or check for an update to DashO which supports the new version.
We are using ant as build tool and Dasho as the code trimming tool.
We are migrating our code from log4j1.x to log4j2.x and we replaced old jar with new Jars(2.xapi & 2.xcore)
Since then after adding the libraries itself we are getting this error while building the project,as we are using java 8 and as per official log4j2 documentation any version of lof4j2 above 2.17.1 does support java8
Found this line when searched for this Base64Util.class in the official documentation of 2.x
link
Tried using 2.17.1 && 2.15 && 2.13 but no luck
Why this unsupported JDK is coming even after using java8 in project??
In order to support Java 8 and all later releases the log4j-api and log4j-core artifacts are multi-release jars. The class file that gives you problems uses Java 9 bytecode.
According to their web site DashO does not support multi-release jars.
Remark: removing the Java 9 classes from log4j-api and log4j-core will break logger context selection and location information on JDK 9 and later, so it is not an option.

Unable to resolve service for type Microsoft.EntityFrameworkCore.Diagnostics.IDiagnosticsLogger

I am having difficulties to scaffold an existing MySQL database using EF core.
I have added the required dependencies as mentioned in the oracle doc:
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkcore.Tools" Version="6.0.0">
and then, I ran this code in the package manager console:
Scaffold-Dbcontext "server=the.server.ip.address;user=user_name;database=db_name;password=db_password;port=3306" MySql.EntityFrameworkCore -o Data -v
It shows this error:
Unable to resolve service for type
'Microsoft.EntityFrameworkCore.Diagnostics.IDiagnosticsLogger`1[Microsoft.EntityFrameworkCore.DbLoggerCategory+Scaffolding]'
while attempting to activate
'MySql.EntityFrameworkCore.Scaffolding.Internal.MySQLDatabaseModelFactory'
Here are the relevant logs in the output window:
Finding design-time services referenced by assembly 'Test2'...
Finding design-time services referenced by assembly 'Test2'...
No referenced design-time services were found.
Finding design-time services for provider 'MySql.EntityFrameworkCore'...
Using design-time services from provider 'MySql.EntityFrameworkCore'.
Finding IDesignTimeServices implementations in assembly 'Test2'...
No design-time services were found.
I don't know how shall I implement the design time classes and nor did I find any useful links in the web.
Note that I can access and run query on the database using MySQL Workbench.
I got this error not while scaffolding but when trying to create my first migration. I didn't want to downgrade to 5.0 because it would've had to be permanent since I was going to run a lot of migrations.
I fixed it by changing my provider from MySql.Data.EntityFrameworkCore to Pomelo.EntityFrameworkCore.MySql
Remove the old provider from both my API and DAL projects:
dotnet remove package MySql.EntityFrameworkCore
Add Pomelo provider
dotnet add package Pomelo.EntityFrameworkCore.MySql
Update your startup to use Pomelos configuartion:
https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql#2-services-configuration
Migrations are working:
dotnet ef migrations add InitialCreate
According this description
https://bugs.mysql.com/bug.php?id=106592
you can solve this error by adding below class to your code
public class MysqlEntityFrameworkDesignTimeServices : IDesignTimeServices
{
public void ConfigureDesignTimeServices(IServiceCollection serviceCollection)
{
serviceCollection.AddEntityFrameworkMySQL();
new EntityFrameworkRelationalDesignServicesBuilder(serviceCollection)
.TryAddCoreServices();
}
}
and after define you have to add it as service in startup file
like this
services.AddSingleton<IDesignTimeServices, MysqlEntityFrameworkDesignTimeServices>();
After these steps you can migrate your code :)
I came across the same issue trying to scaffold an existing MySQL database. It looks like the latest version of MySql.EntityFrameworkCore (6.0.0-preview3.1) still uses the EFCore 5.0 libraries and has not been updated to EFCore 6.0.
It also seems Microsoft.EntityFrameworkCore.Diagnostics was last implemented in EFCore 5 and removed in 6.
When I downgraded all the packages to the 5 version level, I was able to run the scaffold command without that error.
To make Scaffold-Dbcontext work, I had to downgrade both the packages to 5.0.0 version.
MySql.EntityFrameworkCore
Microsoft.EntityFrameworkCore.Tools
After successful scaffolding, I upgraded these packages back to the their latest versions.
I could find the Core 6.0 documentation for microsoft.entityframeworkcore.diagnostics in the official website, but it was still not working when I tried the Scaffold-DbContext command. Had to downgrade all the packages to the last 5.0 version before it worked. Here are the packagerefs in my project settings
"Microsoft.EntityFrameworkCore.Design" Version="5.0.13"
"Microsoft.EntityFrameworkCore.Tools" Version="5.0.13"
"MySql.Data" Version="8.0.28"
"MySql.EntityFrameworkCore" Version="5.0.10"
#https://stackoverflow.com/users/1322226/quinestor I faced same issue and as #https://stackoverflow.com/users/9914700/james-ruth mentioned I downgraded the versions of all EFCore and EFCore Design to 5.0.8 in Visual Studio.
Did not look around for command line commands :) But we can also do it from from dotnet cli, which I guess you probably would be aware of. We can remove - dotnet remove package <PACKAGE_NAME>, and install specific version - dotnet add package <PACKAGE_NAME> --version
You do not need to perminately downgrade your EF version to scaffold, you can edit the project file to use
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.8">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="MySql.EntityFrameworkCore" Version="5.0.8" />
</ItemGroup>
Then you can run
dotnet ef dbcontext scaffold "[DSN String]" MySql.EntityFrameworkCore -o [DBName]
Then change your project file back (or revert changes) to use the latest version of EF.
Dont forget to edit the "protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)" and remove the DSN it adds to the code.
The latest version of MySql.EntityFrameworkCore still uses the EFCore 5.0 libraries and has not been updated to EFCore 6.0.
It also appears that Microsoft.EntityFrameworkCore.Diagnostics was removed in 6.
I resolve this error by adding the class below to my code:
public class MysqlEntityFrameworkDesignTimeServices : IDesignTimeServices
{
public void ConfigureDesignTimeServices(IServiceCollection serviceCollection)
{
serviceCollection.AddEntityFrameworkMySQL();
new EntityFrameworkRelationalDesignServicesBuilder(serviceCollection)
.TryAddCoreServices();
}
}
Then you must add it as a service in the initialization file
services.AddSingleton<IDesignTimeServices, MysqlEntityFrameworkDesignTimeServices>();
Hope this helps!

primefaces showcase deployed on tomcat style not loaded

primefaces showcase deployed on tomcat style not loaded
Downloaded the source code from below link branch 8.0
https://github.com/primefaces/primefaces-showcase
deployed in tomcat the site is misalligned the styles are not loaded see image attached.
what i am missing why the site is not aligned.
TOMCAT: NO errors in tomcat logs
Glassfish : Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.webbeans.exception.WebBeansDeploymentException: java.lang.NullPointerException. Please see server.log for more deta
Wildfly : {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"primefaces-8.0-SNAPSHOT.war\".undertow-deployment.UndertowDeploymentInfoService" => "java.lang.ClassNotFoundException: org.primefaces.webapp.FileUploadChunksServlet from [Module \"deployment.primefaces-8.0-SNAPSHOT.war\" from Service Module Loader]
Caused by: java.lang.ClassNotFoundException: org.primefaces.webapp.FileUploadChunksServlet from [Module \"deployment.primefaces-8.0-SNAPSHOT.war\" from Service Module Loader]"}}
As long as it deploys in one of the server i am good to go.
So the first thing you did is check if org.primefaces.webapp.FileUploadChunksServlet is actually in the PrimeFaces 8 jar and noticed it is not there. Then you checked the PrimeFaces 8 tag in the source of PrimeFaces and noticed it is also not there. Then you checked the PrimeFaces Master (8.0.x) and noticed it IS there Then you checked the PrimeFaces showcase source to see if there, besides the 8.0.x branch there is a 8.0 tag and noticed tere is not. So your conclusion was that the 8.0.x showcase is up to date with the master and an explicit version of the showcase at the time of releasing PrimeFaces 8.0 is missing.
So you then decided you have three options
In the showcase source, go to the point in time of releasing PF 8 and download the source of that 'snapshot'
File an issue in the PrimeFaces showcase https://github.com/primefaces/primefaces-showcase/issues to request a tag to be made (maybe in retrospect even)
Do both
You then decided to do both and was happy because you could run the showcase locally and made the world a better place since you helped others in the future when the wanted to use the showcase source with a PrimeFaces community release.

Primefaces Lifecycle component is not working with Myfaces

Recently we have migrated from Mojarra 2.2.15 to myfaces 2.2.11 version and found that Primefaces Lifecycle component is not working.
Note: We are using Wildfly 11
we have added following content in faces-config.xml
<lifecycle>
<phase-listener>org.primefaces.component.lifecycle.LifecyclePhaseListener</phase-listener>
</lifecycle>
Above configuration for p:lifecycle works fine with Mojarra but same is not working with Myfaces. How to solve this issue.

Xcode 7.1 TestFairy SDK 1.5.0, Many Warnings with xxxx.app.dSYM

After adding the Test Fairy 1.5.0 SDK and using XCODE 7.0.1, getting many warnings like
while processing /Users/jefforthober/Dev/KidMix/KidMixiOS/KidMixCommon/TestFairy/libTestFairy.a(TFImageUtils.o):
warning: Could not resolve external type c:objc(cs)UIView
while processing /Users/jefforthober/Dev/KidMix/KidMixiOS/KidMixCommon/TestFairy/libTestFairy.a(TFGestureRecognizer.o):
warning: /var/folders/my/m6ynh3bn6tq06h7xr3js0z7r0000gn/C/org.llvm.clang.travis/ModuleCache/1Z8KETWXX2FXQ/UIKit-1V5UHAPTOD24G.pcm: No such file or directory
while processing /Users/jefforthober/Dev/KidMix/KidMixiOS/KidMixCommon/TestFairy/libTestFairy.a(TFGestureRecognizer.o):
The problem is solved with TestFairy iOS SDK 1.7.4
Just upgrade to the latest version.
http://docs.testfairy.com/iOS_SDK/Integrating_iOS_SDK.html