Hotswapper plugin is not reloading classes in web project - hotswapagent

Hotswapper plugin is not reloading classes in web project (JSF, maven based) but resource files(xhtml) are reloading smoothly.
Following are my configurations.
Server: Wildfly11
Java version : 1.8.0_191
DCEVM Vesion: 25.71-b01-dcevmlight-26
Hot swapper agent : 1.3.1-SNAPSHOT (2019-04-02)
Java Option to start server: -XXaltjvm=dcevm -javaagent:/home/user/HotSwapAgent/hotswap-agent-1.3.1-SNAPSHOT.jar=autoHotswap=true -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"
I have added the following attributes in hotswap-agent.properties file of war project
LOGGER=trace
extraClasspath=/home/user/HotSwapTest/target/classes
webappDir=/home/user/HotSwapTest/src/main/webapp
watchResources=/home/user/HotSwapTest/target/classes
autoHotswap=true
autoHotswap.port=8000
In server startup i'm getting the following message.
'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'ModuleClassLoader for Module
Now i'm compiling the java file and the class is updated in the class folder. But the changes are not reloaded in the wildfly server.
How to make reloading of classes?
Note: Hotswapp is working fine if i'm attching netbeans debugger.

Related

ASP.NET Core fails to run under IIS: HTTP Error 500.0 - ANCM In-Process Handler Load Failure

I just upgraded my web application from ASP.NET (Framework) MVC to ASP.NET Core 2.2. The application runs fine under IIS Express, however as soon as I try to run it under IIS it gives the generic error:
HTTP Error 500.0 - ANCM In-Process Handler Load Failure Common causes
of this issue: The specified version of Microsoft.NetCore.App or
Microsoft.AspNetCore.App was not found. The in process request
handler, Microsoft.AspNetCore.Server.IIS, was not referenced in the
application. ANCM could not find dotnet.
I've searched the web and see that many developers are running into the same issue, it seems that Microsoft really missed the mark on this one and have made it as painful as possible to develop ASP.NET Core apps under IIS. Regardless, I'd like to break through this brick wall that I've been hitting my head against for the last 24 hours, so could use some help.
Things I've tried so far:
Installed the latest version of .NET Core Runtime and Hosting Bundle, version 2.2.4.
Installed the latest version of .NET Core SDK, version 2.2.203.
Ensured that "dotnet" is runnable from command line, and that the x64 version is before the x86 version in my environment variables.
C:\WINDOWS\system32>where dotnet C:\Program Files\dotnet\dotnet.exe
C:\Program Files (x86)\dotnet\dotnet.exe
Tried changing my auto-generated Web.config from aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" to aspNetCore processPath="dotnet" arguments="./Housters.Web.dll" however the changes don't stick, every time I build my web application the Web.config gets reverted back tot he original %LAUNCHER_PATH% values.
Tried changing "AspNetCoreModuleV2" to "AspNetCoreModule" in the Web.config.
Added IsTransformWebConfigDisabled=true to my Web.csproj file in order to keep my custom Web.config from being overwritten. It didn't work, the Web.config is still overwritten.
Tried switching AspNetCoreHostingModel=InProcess to RuntimeFrameworkName=Microsoft.AspNetCore.App in my Web.csproj file.
Cleaning the solution, as well as manually deleting the bin, obj, and even .vs folders.
None of these methods helped, I still get the same ANCM In-Process Handler Load Failure error. The Event Viewer does show a more useful error:
Application 'C:\Housters\Web\' wasn't able to start. Executable was
not found at 'C:\Housters\Web\%LAUNCHER_PATH%.exe'
However, I can't do anything about that because my Web.config changes don't persist. But really, the default settings should work out of the box, we shouldn't have to jump through hoops to get IIS development working. Why is it looking for an .exe when an ASP.NET Core project by default only generates a .dll? And why isn't it replacing %LAUNCHER_PATH% with the correct path, e.g. "bin/Debug"?
EDIT: I should also mention that at times I've been able to get my custom Web.config to persist, and when I do then every time I try to run the web application I get a JIT debugger prompt:
Choosing to debug, or viewing the event log just gives me a really unfriendly error message:
Faulting application name: w3wp.exe, version: 10.0.17134.1, time
stamp: 0xed729d4e Faulting module name: KERNELBASE.dll, version:
10.0.17134.556, time stamp: 0xb9f4a0f1 Exception code: 0xc0020001 Fault offset: 0x000000000003a388 Faulting process id: 0x2650 Faulting
application start time: 0x01d502b1f21b112e Faulting application path:
c:\windows\system32\inetsrv\w3wp.exe Faulting module path:
C:\WINDOWS\System32\KERNELBASE.dll Report Id:
5b5c14cb-8ffa-47b4-8cc1-42f951bc1256 Faulting package full name:
Faulting package-relative application ID:
You're getting this error because you're not specifying if you want the website hosted in process or out of process... in process can be specified by using UseIIS().
Try changing your CreateWebHostBuilder method in Program.cs to:
public static IWebHostBuilder CreateWebHostBuilder(string[] args)
{
var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
var builder = WebHost.CreateDefaultBuilder(args);
if (env == EnvironmentName.Staging || env == EnvironmentName.Production)
builder.UseIIS();
builder.UseStartup<Startup>();
return builder;
}
I set ASPNETCORE_ENVIRONMENT in my .pubxml deployment profile by adding:
<PropertyGroup>
<EnvironmentName>Staging</EnvironmentName>
</PropertyGroup>
The cause of this error may also be because the version of the .NET SDK which is in the global.json file of your application is not installed on your local machine. The solution is to check which version is configured in the global.json file and install it on your machine. I managed to solve this error this way (01/06/2022).
The following error will appear in the Windows Event View:
I solve this error just by changing in the web.config AspNetCoreModuleV2 to AspNetCoreModule, but this is not perfect solution.
Another solution is deploying application as Self-Contained when you will publish it.

javax.servlet-api-3.0.1.jar not loded in liferay 6.1 and tomcat 7.0

With a custom plugin deployed, I'm getting the following error message and the webapp doesn't start:
validateJarFile(E:\6.1\liferay-portal-tomcat-6.1.1-ce-ga2-20120731132656558\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\temp\4-SiteSkills_CMS-portlet\WEB-INF\lib\javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Why and how can I get rid of this message?
Do not package the servlet jar in an application's WEB-INF/lib directory. This jar comes with the appserver, tomcat in this case.
As your error message states the file to be in the temp folder: make sure you don't only remove the file from the webapps directory, but do a redeploy. Or just empty your temp folder

Is it possible to deploy JSF-Web-Apps in WSO2 AS 5.2?

I tried the following steps:
At first I installed the feature "WSO2 Carbon - J2EE Runtime Environment" in the AS. Then I created a new dynamic web project in Eclipse with Servlet Module 2.5 and a configuration for JSF 1.2 using Myfaces 1.2.9 and a JSF-HTML-Template. After I had written "hello" in the view, I tested it with "run on server" in Eclipse and it runs. Then I created a WAR-File and deployed it in the AS with pasting the file in "asroot/repository/deployment/server/webapps".
Then I tried the page and it throws this error:
"/NewFile.jsp(2,57) PWC6188: The absolute uri: http://java.sun.com/jsf/core cannot be resolved in either web.xml or the jar files deployed with this application
Caused by:
org.apache.jasper.JasperException - /NewFile.jsp(2,57) PWC6188: The absolute uri: http://java.sun.com/jsf/core cannot be resolved in either web.xml or the jar files deployed with this application"
I tried it also on a local Tomcat-Server with the same result like in Eclipse.
The libs in the WAR are:
javax.servlet.jsp.jstl-1.2.1.jar
javax.servlet.jsp.jstl-api-1.2.1.jar
commons-beanutils-1.7.0.jar
commons-codec-1.3.jar
commons-collections-3.2.jar
commons-digester-1.8.jar
commons-discovery-0.4.jar
commons-logging-1.1.1.jar
myfaces-api-1.2.9.jar
myfaces-impl-1.2.9.jar
This could be a classloading issue. Please put webapp-classloading.xml file in META-INF directory of your web application with following configurations
<?xml version="1.0" encoding="ISO-8859-1"?>
<Classloading xmlns="http://wso2.org/projects/as/classloading">
<Environments>Tomcat</Environments>
</Classloading>
Refer http://docs.wso2.org/display/AS520/Webapp+ClassLoading

JSF how upgrade to Mojarra 2.1.21 in Netbeans7.1 (just sub jsf-api.jar and jsf-impl.jar fails)

I want to upgrade from JSF implementation Mojarra 2.1.3 in Netbeans7.1 (Glassfish 3.1.1).
You might ask first why I don't just upgrade to Netbeans7.3, and the reasons include that it it runs Glassfish 3.1.2.2 and that I have some other 3rd party software in my web application that is not yet compatible with Glassfish higher than 3.1.1, and besides it only has Mojarra 2.1.6 anyway.
I used to be able to upgrade Mojarra by simply replacing jsf-api.jar and jsf-impl.jar under /glassfish/modules, but that does not work with:
https://maven.java.net/content/repositories/releases/com/sun/faces/jsf-api/2.1.21/jsf-api-2.1.21.jar
https://maven.java.net/content/repositories/releases/com/sun/faces/jsf-impl/2.1.21/jsf-impl-2.1.21.jar
I get the following error:
SEVERE: java.lang.reflect.InvocationTargetException
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 com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55)
Caused by: com.sun.enterprise.module.ResolveError: Failed to start Bundle Id [301] State [INSTALLED] [org.glassfish.web.weld-integration(Weld integration for glassfish):3.1.1]
at org.jvnet.hk2.osgiadapter.OSGiModuleImpl.start(OSGiModuleImpl.java:177)
at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$2$1$1.loadClass(OSGiModuleImpl.java:344)
at com.sun.hk2.component.LazyInhabitant.loadClass(LazyInhabitant.java:124)
at com.sun.hk2.component.LazyInhabitant.fetch(LazyInhabitant.java:111)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:135)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
at org.jvnet.hk2.component.Habitat$5.get(Habitat.java:701)
at java.util.AbstractList$Itr.next(AbstractList.java:345)
at java.util.AbstractCollection.toArray(AbstractCollection.java:124)
at java.util.ArrayList.addAll(ArrayList.java:472)
at com.sun.enterprise.v3.server.SnifferManagerImpl.getSniffers(SnifferManagerImpl.java:92)
at com.sun.enterprise.v3.server.SnifferManagerImpl.getSniffer(SnifferManagerImpl.java:120)
at com.sun.enterprise.v3.server.ApplicationLifecycle.getSniffersFromApp(ApplicationLifecycle.java:2140)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:375)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:219)
at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:131)
at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:253)
at com.sun.enterprise.v3.server.AppServerStartup.doStart(AppServerStartup.java:145)
at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:136)
at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(GlassFishImpl.java:79)
at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63)
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishImpl.start(OSGiGlassFishImpl.java:69)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:117)
... 6 more
Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle org.glassfish.web.weld-integration [301]: Unable to resolve 301.0: missing requirement [301.0] package; (&(package=com.sun.faces.spi)(version>=2.1.0)) [caused by: Unable to resolve 213.1: missing requirement [213.1] package; (package=javax.faces) [caused by: Unable to resolve 211.1: missing requirement [211.1] package; (&(package=javax.el)(version>=2.2.1))]]
at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3443)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1727)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:922)
at org.jvnet.hk2.osgiadapter.OSGiModuleImpl.start(OSGiModuleImpl.java:169)
I tried web app specific JSF but that also fails:
glassfish change default jsf impl
Added to web.xml:
<class-loader delegate="false" />
<property name="useBundledJsf" value="true" />
I get the error:
Error occurred during deployment: Exception while loading the app :
java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: java.lang.RuntimeException:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED!
org.glassfish.weld.jsf.WeldFacesConfigProvider cannot be cast to
com.sun.faces.spi.ConfigurationResourceProvider. Please see server.log for more details.
Grateful for suggestions.
Try following steps
Download jsf 2.1.21 jar from here
Rename it to javax.faces.jar .
Take backup of javax.faces.jar available at docroot\glassfish\modules
Paste and replace the old javax.faces.jar with downloaded javax.faces.jar available at docroot\glassfish\modules
Delete the osgi cache glassfish3\glassfish\osgi for the changes to
take effect
OK I finally have 2 workarounds (only) for getting Mojarra-2.1.21 running with Netbeans7.1.
Firstly, the following recommended approach does not as far as I can tell work in Netbeans7.1, it stubbornly refuses to recognise the server installed javax.faces.jar.
From https://weblogs.java.net/blog/edburns/archive/2011/09/26/try-out-mojarra-220-snapshot?force=714:
Once you download the javax.faces.jar, you must take some steps to install it in GlassFish 3.1 or 3.1.1.
Remove jsf-api.jar and jsf-impl.jar from the modules directory.
Put javax.faces.jar in the modules directory.
You must modify the default-web.xml file in domains/domain1/config and lib/templates. In
each directory, remove any mention of jsf-api.jar and jsf-impl.jar from the default.web.xml file.
In place of the two jars, add a reference to javax.faces.jar.
No matter what I do with Netbeans7.1 (and no matter whether clear osgi-cache and netbeans cache or whether remove then re-add server in Netbeans7.1 or how many times I restart glassfish3.1.1 and/or netbeans7.1), Netbeans7.1 will NOT see javax.faces.jar.
If you try to add the javax.faces.jar (only) to your web app libs and use this in glassfish-web.xml to for it to use web-app specific JSF, it will prevent import errors in your Netbeans7.1 project, but it still will not run:
<class-loader delegate="false" />
<property name="useBundledJsf" value="true" />
I get this error:
Error occurred during deployment: Exception while loading the app :
java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: java.lang.RuntimeException:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED!
org.glassfish.weld.jsf.WeldFacesConfigProvider cannot be cast to
com.sun.faces.spi.ConfigurationResourceProvider.
The reason is described here: http://java.dzone.com/articles/upgrading-latest-mojarra
The issue seems to be that there are two versions of
ConfigurationResourceProvider on the class path: one at the web app
level (your bundled jar file) and a second at the parent class loader
level (provided by GlassFish). WeldFacesConfigProvider extends
ConfigurationResourceProvider at the parent class loader, but it ends
up casting this to ConfigurationResourceProvider at the web app class
loader. ...
Workaround: Adding the missing dependency to your app If you can't cast across class loaders you have to make the missing part available
to the right class-loader. Not replacing the javax.faces.jar in your
server's modules leads to adding the magic WeldFacesConfigProvider to
your app. It is contained in the
glassfish3\glassfish\modules\weld-integration.jar and by simply
putting that as an additional library to your application you also
solve the issue.
You now have 2 workaround choices:
Include the weld-integration.jar in your web app libs, and run with web app JSF settings in glassfish-web.xml.
Dirty trick: With .../glassfish/modules/javax.faces.jar still in place and also in your web app libs, disable or uncomment the bit in your glassfish-web.xml. It will then run with the server javax.faces.jar (and will see /modules/weld-integration.jar), and Netbeans will see the web app specific lib for imports.
This is unsatisfactory, I don't consider the question fully answered.
Q: How can one run JSF Mojarra 2.1.21 as Glassfish3.1.1 server JSF libs in NetBeans7.1 ?
And again, the reason I can't just upgrade Netbeans+Glassfish is that I have multiple problems with ObjectDB with versions of Glassfish above 3.1.1, which is why I am so adamant about installing JSF Mojarra 2.1.21 on Netbeans7.1+Glassfish3.1.1.
Grateful for any further suggestions.

Native Bundle throws java.security.NoSuchAlgorithmException

I'm trying to build a native bundle, specially for mac os x, but also in windows. And in both environments the .app, .dmg, .exe get generated correctly, but when I run them, I get many java.security.NoSuchAlgorithmException exceptions. For example:
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
Caused by: java.security.NoSuchAlgorithmException: PBEWithMD5AndDES SecretKeyFactory not available
My program uses TLS, to establish xmpp connections. And also I have a webview with HTTPS which is not loading eighter.
Does anybody have any idea why this could be happening?
I should note that if I run the generated jar alone, it works fine, it only happens with the .exe and .app.
This is my build.xml fx:deploy code:
<fx:deploy width="${javafx.run.width}" height="${javafx.run.height}"
nativeBundles="all"
outdir="${basedir}/${dist.dir}" outfile="${application.title}">
<fx:application name="${application.title}"
mainClass="${javafx.main.class}"/>
<fx:resources>
<fx:fileset dir="${basedir}/${dist.dir}"
includes="*.jar"/>
<fx:fileset dir="${basedir}/${dist.dir}" includes="lib/*.jar"/>
</fx:resources>
<fx:info title="${application.title}"
vendor="${application.vendor}"/>
</fx:deploy>
Appreciate your help.
I hadn't seen this post before: JavaFX WebView Not Loading HTTPS Page
What's happening is that the jre's bundle doesn't include the /ext folder, so you have to copy it with a script when you build the bundle.

Resources