Grails 5.2 can't deploy to JBoss EAP 7.4 - grails

Grails 5.2
create-app helloworld
create-controller hello (add render "Hello"
line)
Add the jboss-deployment-structure.xml file to WEB-INF folder for JBoss logging compatibility.
run-app (works)
war
Deploy to JBoss EAP 7.4 and get following error
ERROR [org.springframework.boot.SpringApplication] (ServerService Thread Pool -- 85) Application run failed: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.context.event.StartupEvent>] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2778)
I did set the logging level to TRACE for is.micronaut.context.condition but nothing is logged at the TRACE level.
The JBoss jboss-deployment-structure.xml file that I added, which I think is standard for JBoss EAP, looks like this. I do not believe this is related, I'm just including it here so that others can reproduce what I did to generate the war file.
<jboss-deployment-structure>
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<module name="org.slf4j" />
<module name="org.slf4j.impl" />
</exclusions>
</deployment>
How can I make a grails 5 app deployable to JBoss EAP 7.4?

Related

log4j.ConfigurationFile configuration in ant build for jetty

We trigger jetty through ant target as below
<target name="jettysh" depends="init">
<exec executable="${JETTY_HOME}/bin/jetty.sh" failonerror="true">
<env key="JAVA_OPTIONS"
value="-server -d64 ${x} ${y} ${z} ${l} -Dsettings.path=${p.path} -Dlog4j.configuration=file:///${dpath}/conf/sample.xml -Djetty.secure.port=${JETTY_SECURE_PORT} -Dapp.dir=${app.dir}"/>
</exec>
</target>
In this we pass -Dlog4j.configuration path in the older log4j 1.X version as we are migrating to newer version we are passing the new configuration -Dlog4j2.configurationFile but the logs are not getting generated .
And also we are not seeing any log files getting generated that means that log configuration itself is not picked
Help is very much appreciated as it is a time bound one.
Jetty Hightide 7.x does not have support for log4j2 at the server level.
Using that ancient EOL version of Jetty, you only have support for log4j2 within your webapps.
That means you have to put the log4j2 jars and it's configuration files in your WAR file.

Aspnet Core Azure Failing with HTTP Error 502.5 - Process Failure

I am trying to deploy an aspnet core app to Azure. This seems to have gone through OK but when I try to start up the app I am presented with the following error...
Common causes of this issue:
The application process failed to start
The application process started but then stopped
The application process started but failed to listen on the configured port
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process’ stdout messages
Attach a debugger to the application process and inspect
There seems to be much written about IIS in this but not with Azure so I'm at a loss as to where to look next. The Azure logs are not indicating anything.
The Microsoft docs give me this info...
Platform conflicts with RID
Browser: HTTP Error 502.5 - Process Failure
Application Log: - Application Error: Faulting module: KERNELBASE.dll
Exception code: 0xe0434352 Faulting module path:
C:\WINDOWS\system32\KERNELBASE.dll - IIS AspNetCore Module: Failed to
start process with commandline '"dotnet" .\my_application.dll'
(portable app) or '"PATH\my_application.exe"' (self-contained app),
ErrorCode = '0x80004005'.
ASP.NET Core Module Log: Unhandled Exception:
System.BadImageFormatException: Could not load file or assembly
'teststandalone.dll' or one of its dependencies. An attempt was made
to load a program with an incorrect format.
Troubleshooting:
If you published a self-contained application, confirm that you didn't
set a platform in buildOptions of project.json that conflicts with the
publishing RID. For example, do not specify a platform of x86 and
publish with an RID of win81-x64 (dotnet publish -c Release -r
win81-x64). The project will publish without warning or error but fail
with the above logged exceptions on the server.
...but don't actually help by telling me what these settings should be for Azure (or if it's relevant there) so I'm not sure if this is a red herring. I'm not specifying a -r switch on my dotnet publish configuration.
I managed to find an event log which threw out some XML repeatedly logging...
Failed to start process with commandline '"%LAUNCHER_PATH%"
%LAUNCHER_ARGS%', ErrorCode = '0x80070002'.
After more investigation I discovered that I needed to change the %LAUNCHER_PATH% and %LAUNCHER_ARGS% values myself. I've tried various changes to the web.config but no luck. My web.config now looks like this...
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="dotnet" arguments="site\wwwroot\Esoterix.Modle.Portalweb.dll" stdoutLogEnabled="true" stdoutLogFile="LogFiles\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
The paths are from the root of the Azure deployment which seems to work for the stdout log file path (I was getting errors reported with that) but not for the app itself. I'm still seeing the following error..
<Event>
<System>
<Provider Name="IIS AspNetCore Module"/>
<EventID>1000</EventID>
<Level>0</Level>
<Task>0</Task>
<Keywords>Keywords</Keywords>
<TimeCreated SystemTime="2016-11-28T19:31:32Z"/>
<EventRecordID>1514022203</EventRecordID>
<Channel>Application</Channel>
<Computer>RD0004FFD7108D</Computer>
<Security/>
</System>
<EventData>
<Data>Failed to start process with commandline '"dotnet" site\wwwroot\Esoterix.Modle.Portalweb.dll', ErrorCode = '0x80004005'.</Data>
</EventData>
</Event>
Which is repeated 4 times
If I look in my stdout output I have the following...
Failed to load the dll from [\?\D:\home\site\wwwroot\hostpolicy.dll],
HRESULT: 0x800700C1
An error occurred while loading required library hostpolicy.dll from
[\?\D:\home\site\wwwroot]
If I try running the exe directly with the web config here...
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="\\?\%home%\site\wwwroot\Esoterix.Modle.Portalweb.exe" arguments="" stdoutLogEnabled="true" stdoutLogFile="\\?\%home%\LogFiles\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
Then my stdout gives me the following error...
Failed to load the dll from [\?\D:\home\site\wwwroot\hostfxr.dll],
HRESULT: 0x80070057
The library hostfxr.dll was found, but loading it from
\?\D:\home\site\wwwroot\hostfxr.dll failed
Installing .NET Core prerequisites might help resolve this problem.
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
I resolved this by adding a reference to dotnet-publish-iis.
Full details on how to do this are logged in a github issue at https://github.com/aspnet/Hosting/issues/892

Migrating old JSP to Facelet (managed bean not instantiated) [duplicate]

I'm creating my first project Java EE 7, but I'm having trouble. Appreciate any help.
Tomcat 7.0.34
JSF 2.2
Primefaces 3.5
javaee-api-7.0.jar
When the application start, the Tomcat log shows the following message:
"validateJarFile (C:\...\build\web\WEB-INF\lib\javaee-api-7.0.jar)-jar not loaded. See Servlet 2.3 Spec, section 9.7.2. Offending class: javax/servlet/Servlet .class"
when I click on the button that calls the managed bean, I get the error:
AdvertĂȘncia: /index.xhtml #18,66 value="#{indexMB.user}": Target Unreachable, identifier 'indexMB' resolved to null
javax.el.PropertyNotFoundException: /index.xhtml #18,66 value="#{indexMB.user}": Target Unreachable, identifier 'indexMB' resolved to null
IndexMB
#Named("indexMB")
#RequestScoped
public class IndexMB {
private String password;
private String user;
public String loginTest(){
return (this.user.equals("admin") ? "adminPage" : "inOutPage");
}
// getters and setters
}
index.xhtml
<html ...>
<f:loadBundle basename="i18n" var="bundle" />
<h:head>
<title>#{bundle['index_title']}</title>
</h:head>
<h:body>
#{bundle['index_appname']}
<br />
<h:form id="frmIndex">
<p:panelGrid columns="2">
<p:outputLabel for="user" value="#{bundle['lblUser']}" />
<p:inputText id="user" value="#{indexMB.user}" />
<p:outputLabel for="password" value="#{bundle['lblPassword']}" />
<p:password id="password" value="#{indexMB.password}" />
</p:panelGrid>
<p:commandButton action="#{indexMB.loginTest}" value="#{bundle['btn_login']}" />
</h:form>
</h:body>
faces-config.xml
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<locale-config>
<default-locale>pt_BR</default-locale>
<supported-locale>en</supported-locale>
<supported-locale>fr</supported-locale>
</locale-config>
</application>
These topics have not helped me:
Java EE 6 #javax.annotation.ManagedBean vs. #javax.inject.Named vs. #javax.faces.ManagedBean
Target Unreachable identifier resolved to null
Target Unreachable, identifier resolved to null
javax.el.PropertyNotFoundException : Target Unreachable, identifier 'login' resolved to null Spring + JSF
http://www.andrejkoelewijn.com/blog/2010/03/05/jee-cdi-tip-target-unreachable-identifier-resolved-to-null/
Tomcat as being a barebones JSP/Servlet container doesn't support CDI out the box. It is not correct to drop jakartaee-api.jar or javaee-api.jar in /WEB-INF/lib just to get your code to compile. The JEE API JAR contains solely the API classes, not the concrete implementation. Get rid of the whole JAR. It can cause many other portability troubles like as the ones described in this answer: How do I import the javax.servlet / jakarta.servlet API in my Eclipse project? You should actually be installing the concrete implementation along with the specific API.
You have 2 options:
Drop Tomcat and go for a true Jakarta EE container. As you're using Tomcat, just step over to TomEE. It's really simple, download the TomEE web profile zip file, extract it and integrate it in Eclipse exactly the same way as you did for Tomcat. Don't forget to remove the Jakarta EE JAR file from webapp and alter the Targeted Runtime property in project's properties from Tomcat to TomEE so that Jakarta EE dependencies are properly resolved. See also What exactly is Java EE?
No additional JARs or configuration is necessary. You can even remove the manually installed JSF/JSTL/CDI/BV/JPA/EJB/JTA/JSONPJAX-RS/etc/etc libraries from your webapp. TomEE as being a true Jakarta EE container already provides them all out the box. In case you're using Maven, the below coordinate is sufficient.
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-web-api</artifactId>
<version><!-- e.g. 10.0.0 or 9.1.0 --></version>
<scope>provided</scope>
</dependency>
Note the importance of provided and its meaning as in "the target runtime already provides this out the box". See also How to properly configure Jakarta EE libraries in Maven pom.xml for Tomcat? for detailed pom.xml examples of Tomcat and normal JEE containers.
If you want to stick to Tomcat, then you need to manually install a true CDI implementation via the webapp. Below instructions assume Tomcat 10+. Weld is one of the available CDI implementations. In the Weld installation guide you can find instructions how to integrate it in Tomcat. For sake of completeness and future reference, here are the steps:
For Tomcat 10.1.x, drop the weld-servlet-shaded.jar of version 5.x in webapp's /WEB-INF/lib. In case you're using Maven, use this coordinate:
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet-shaded</artifactId>
<version>5.1.0.Final</version>
</dependency>
For Tomcat 10.x, use weld-servlet-shaded.jar of version 4.x instead:
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet-shaded</artifactId>
<version>4.0.3.Final</version>
</dependency>
Optionally, create a /META-INF/context.xml file in webapp with following content:
<Context>
<Resource name="BeanManager"
auth="Container"
type="jakarta.enterprise.inject.spi.BeanManager"
factory="org.jboss.weld.resources.ManagerObjectFactory"/>
</Context>
This step is is only necessary when the CDI-dependent library tries to manually find it in JNDI. This step is not necessary when you're using for example Jakarta Faces / JSF version 2.3 or newer.
Create a /WEB-INF/beans.xml file in webapp to trigger activation of CDI. It can be kept empty.
That's it.
In case you prefer OpenWebBeans above Weld as CDI implementation, or need to install CDI in Tomcat 9.x or older, head to this blog for detailed Maven installation instructions: How to install CDI in Tomcat?
Other possible option is leaving beans.xml in your deployment.

Configuring ucanaccess driver on wildfly 8.0

I am trying to create a web application using MS Access as database. For it, I am using ucanaccess driver and my server is Wildfly 8.0
The issue is to how correctly configure this driver on the server ?
After researching on internet I got to know below steps
create a folder structre and place all the ucanaccess jar files-
wildfly-8.0.0.Final\modules\system\layers\base\com\ucanaccess\jdbc\main
Edit module.xml file-
<module xmlns="urn:jboss:module:1.1" name="com.ucanaccess.jdbc">
<resources>
<resource-root path="ucanaccess-2.0.9.4.jar"/>
<resource-root path="commons-lang-2.6.jar"/>
<resource-root path="commons-logging-1.1.1.jar"/>
<resource-root path="hsqldb.jar"/>
<resource-root path="jackcess-2.0.8.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
Edit standalone-full.xml file
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/MyDS" pool-name="MyDS" enabled="true" use-java-context="true">
<connection-url>jdbc:ucanaccess://C://Users//sahashu//Documents//NGCORE.accdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>ucanaccess-2.0.9.4.jar</driver>
<security>
<user-name></user-name>
<password></password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="ucanaccess" module="com.ucanaccess.jdbc">
<xa-datasource-class>org.ucanaccess.jdbc.MsAccessDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
However, still I get this error-
23:29:34,422 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 28) JBAS014613: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "ucanaccess")
]) - failure description: "JBAS010441: Failed to load module for driver [com.ucanaccess.jdbc]"
Please help me to identify the issue
Thanks
There is an easier way: Just create your own JAR using the UcanAccess JAR files.
In Eclipse:
Create a plain Java Project (for Java 8)
Create a dummy class with a dummy main method, and execute it (for example a simple Hello World program)
Right-click on the project -> Build Path -> Configure Build Path
Go to the Libraries tab and use "Add External JARs" to add all 5 JARs that you find in your UcanAccess download
Right-click on the project -> Export -> Java / Runnable JAR file, choose your dummy class as Launch configuration, and keep Library handling as "Extract required libraries..."
Now go to your WildFly administration console, and click on "Deployments". There you can add your freshly baked JAR and enable it. WildFly will recognize this driver automatically from now on, when you need to add a Microsoft Access Datasource using the Wizard in the administration console.

Error using Ant to create EJB after upgrading WAS from 6.0 to 7.0

Ant task breaks at the <wsejbdeploy> tag. The exception message is :
[wsejbdeploy] Error executing deployment: java.lang.ClassNotFoundException.
Error is com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension.
[wsejbdeploy] java.lang.ClassNotFoundException:
com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension
[wsejbdeploy] at java.lang.Class.forName(Class.java:136)
In addition to that, ivy.xml reports problems, but when I inspect it, the messages have no sense (screenshot). I suspect the problems could be:
a) Additional files that I have for the build which conflict with the upgraded Ant (in RSA 7.0 i've had Ant 1.6.5 and RSA 8.0 comes with Ant 1.7.1). Additional files are:
required for ant tasks execution
ant-contrib/ant-contrib.jar
antelope-tasks/AntelopeTasks_3.2.10.jar
antform/antform.jar
antform/defaultStyle.txt
antlr/antlr.jar
checkstyle/checkstyle-4.2.jar
checkstyle/checkstyle-optional-4.2.jar
checkstyle/checkstyle-frames-errors.xsl
clover/clover.jar
clover/cenquatasks.jar
clover/clover.license
doccheck/doccheck-modified.jar
ivy/ivy-20060723172807.jar
jakarta-commons/commons-beanutils.jar
resources/checkstyle/checks-source.xml
resources/checkstyle/checksTransformation.xsl
b) Changes in the Ant regarding EJB build which require some settings to be reconfigured.
c) Something else :)
Except the Error, everything else is a stab in the dark so feel free to ask for any additional info.
The problem was in the additional file needed for wsejbdeploy. In the 6.0 version, you copy wsanttasks.jar and wsprofile.jar from the websphere 6.0 installation folder and then reference it like this
<taskdef name="wsejbdeploy" classname="com.ibm.websphere.ant.tasks.WsEjbDeploy"
classpathref="all-libs"/>
where "all-libs" is a reference to the folder where you copied the jars. In websphere 7.0 there is no wsanttasks.jar and you must reference the runtime file, eg
<taskdef name="wsejbdeploy" classname="com.ibm.websphere.ant.tasks.WsEjbDeploy">
<classpath>
<pathelement path="C:/IBM/SDP80/runtimes/base_v7/plugins/com.ibm.ws.runtime.jar" />
</classpath>

Resources