Grails 3 in Tomcat 6 - deployment

I am trying to deploy my grails app version 3 on a Tomcat 6 container and I am facing the following error when tomcat is trying to deploy the app:
Jan 05, 2016 5:24:44 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\murruer\DEV\apache-tomcat-6.0.37\webapps\grailstomcat-0.1\WEB-INF\lib\tomcat-embed-core-8.0.28.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Is it possible to deploy a Grails 3 application into Tomcat 6??
Thank your.
Best Regards.

If you read the official Grails Doc you can see this:
Note that by default Grails will include an embeddable version of Tomcat inside the WAR file, this can cause problems if you deploy to a different version of Tomcat. If you don't intend to use the embedded container then you should change the scope of the Tomcat dependencies to provided prior to deploying to your production container in build.gradle:
provided "org.springframework.boot:spring-boot-starter-tomcat"
--Edit--
Another problem deploying a Grails 3x war into a Tomcat 6 server is that it's not suported.
The official documentatiotion says:
Grails runs on any container that supports Servlet 3.0 and above and is known to work on the following specific container products:
Tomcat 7
GlassFish 3 or above
Resin 4 or above
JBoss 6 or above
Jetty 8 or above
Oracle Weblogic 12c or above
IBM WebSphere 8.0 or above

Related

Wicket 9 & Tomcat 10 Can't Cast jakarta.servlet.Filter

I'm trying to use the Wicket Project 'QuickStart' with
Netbeans 11, Java 11, Tomcat 10, Wicket 9, and Ubuntu 18.04.
When I install the WAR package and start it, it throws:
20-May-2020 09:23:37.067 GRAVE [] org.apache.catalina.core.StandardContext.filterStart Exception at start [wicket.quickstart]
java.lang.ClassCastException: class org.apache.wicket.protocol.http.WicketFilter cannot be cast to class jakarta.servlet.Filter (org.apache.wicket.protocol.http.WicketFilter is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader)
Has anyone seen this issue before and if so, what can I do to resolve this?
The issue is that Tomcat 10 uses jakarta.** packages (Jakarta EE 9) while Wicket 9.x is still based on javax.** packages (Java EE 8).
The solutions are:
Use Tomcat 9.x
Use https://github.com/apache/tomcat-jakartaee-migration to migrate the Wicket application (the .war file) from javax to jakarta
Deploy the javax.** based application into $TOMCAT10_HOME/webapps-javaee/ folder. It will be automatically migrated to jakarta.** by Tomcat.
Don't use Tomcat 10 yet, it works with the new jakarta packages.
Switch to version 9 instead.
To make wicket 9 work with with jakarta, e.g. if using tomcat 10 or spring boot 3, you have to convert some jars. There is the tool jakartaee-migration which does this for a given jar. So apply it at least to these 4 jars and create new ones - I used -jakarta as appendix:
wicket-core -> wicket-core-jakarta
wicket-util -> wicket-util-jakarta
wicket-request -> wicket-request-jakarta
commons-fileupload -> commons-fileupload
Also create proper pom files put all together into your local/shared repository.
To use it, add the new dependencies and exclude the old ones where necessary. Run mvn dependency:tree until nothing bogus gets picked up.
Congrats - you now have wicket 9 for jakarta.

While upgrading to jdk7 to jdk11 with wildfly16 drools are not working

Hi I am having following configuration:
java version-jdk11
server-wildfly16
jars-drools 6.0 and ecj 4.6.1
in server location: C:\wildfly-16.0.0.Final\modules\org\eclipse\jdt\main
I am having jar: jasper-jdt-6.0.29
having an ear.
but after deploying my application opens though when i check rules so drls not working.
below error i am getting..
/servlet/com.fourcs.clm.iwarranty.eclaims.dataview.servlets.ClaimSearchServlet
Path Info:null
Query String:null
Stack Trace:
java.lang.NoSuchFieldError: compilation_beginningToCompile
at deployment.CLMEAR.ear//org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:428)
at deployment.CLMEAR.ear//org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:417)
at deployment.CLMEAR.ear//org.drools.compiler.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:405)
at deployment.CLMEAR.ear//org.drools.compiler.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:49)
at deployment.CLMEAR.ear//org.drools.compiler.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:405)
at deployment.CLMEAR.ear//org.drools.compiler.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:46)
at deployment.CLMEAR.ear//org.drools.compiler.compiler.PackageRegistry.compileAll(PackageRegistry.java:110)
at deployment.CLMEAR.ear//org.drools.compiler.compiler.PackageBuilder.compileAll(PackageBuilder.java:1334)
at deployment.CLMEAR.ear//org.drools.compiler.compiler.PackageBuilder.compileRules(PackageBuilder.java:1058)
at deployment.CLMEAR.ear//org.drools.compiler.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:972)
I tried upgrading jar version ecj 4.3.1 to 4.6.1 but that also not worked.
How to resolve this error. Any idea?
If you look on the drools usage forums, you can find that Drools does not work with JDK11.
Drools 6 works with JDK7, but that version is from 2013. Latest Drools versions (7.X) work on WildFly 10 to 14 with JDK8.

REST call to spring boot RestController results 404 in tomcat but works in embedded tomcat

I am new to spring boot. I have knowledge on Spring mvc. I have developed small application with one #RestController as mentioned in Update below. This is working fine when I execute using mvn spring-boot:run (ie. embedded tomcat)
The same REST call results in 404 not found when I deploy as packaged war to tomcat. Target url
http://localhost:8086/myapp/demo gives 404.
I have the log4j2.xml created and when I execute with embedded tomcat it creates the expected log file, but with the external tomcat deployment it does not create the log file too and I do not find any logs in any of the tomcat logs under <tomcat-dir>/logs
What am I missing here ?
UPDATE:
The spring boot entry point class:
#SpringBootApplication
#RestController
public class App extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
#Override
protected SpringApplicationBuilder configure(
SpringApplicationBuilder application) {
return application.sources(App.class);
}
#RequestMapping("/demo")
public String demo() {
return "Helloo.. !!";
}
}
Spring boot version => v1.3.2.RELEASE
The logs when I deploy to tcServer
INFO: Deploying web application archive C:\Users\a\vfabric-tc-server\vm1\webapps\myapp.war
Sep 12, 2016 5:07:23 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\a\vfabric-tc-server\vm1\webapps\myapp\WEB-INF\lib\tomcat-embed-el-8.0.30.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
Sep 12, 2016 5:07:24 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Sep 12, 2016 5:07:24 PM org.apache.catalina.core.ApplicationContext log
INFO: Spring WebApplicationInitializers detected on classpath: [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JerseyWebApplicationInitializer#47b35d]
Sep 12, 2016 5:07:24 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive C:\Users\a\vfabric-tc-server\vm1\webapps\myapp.war has finished in 1,913 ms
UPDATE1:
I removed Angular, kept only spring boot #restcontroller. Problem still exists.
Can you change the scope of the Tomcat embedded server to "provided" in your POM file or for deployment into a non-embedded Tomcat container, better off to exclude the JAR (so commenting it out is also a good option).
I had faced a similar issue with the old v1.3.x of Spring BOOT. I have not observed this in the new version i.e., v1.4.0.
I'm assuming that you are using Spring BOOT parent POM and "spring-boot-starter" lib in your project POM.
This was the problem with the target external Tomcat server that was pointing to JDK6, but my application was build using jdk7.
Problem resolved once I point the external Tomcat to jdk7.

WebLogic Server Version: 12.1.2.0.0 Attempting to precompile

I am deploying my JAVA EE ear app. as usual in WL server,
but suddenly it seems that everytime WL is trying precompile all the JSP again and the deployment take ages
12.1.2.0.0.>
ST> <Info> <HTTP> <BEA-101343> <my_devices: Attempting to precompile /WEB-INF/jsp/template/header.jsp, since the class file associated with it was found to be out-of-date.>
ST> <Info> <HTTP> <BEA-101295> <Recompiling JSP [ServletContext#29540787[app:my_devices module:my_devices path:null spec-version:3.0]], resource [/WEB-INF/jsp/template/popupHeader.jsp], because it is stale. It was previously compiled using a different version of WebLogic Server.
12.1.2.0.0.>
Precompile is a good thing !!
But if you want to disable it to get a faster deployment, change your weblogic.xml file and include the following:
<jsp-descriptor>
<jsp-param>
<param-name>precompile</param-name>
<param-value>false</param-value>
</jsp-param>
</jsp-descriptor>
That should help you on this !

Deplyoment Issue in Migrating from Primefaces 3.5 to 4.0

I was using primefaces 3.5 in my project and now have updated to 4.0 but its failing to deploy on Glassfish after upgrading and resulting in the following error:
Severe: Critical error during deployment:
com.sun.faces.config.ConfigurationException: java.lang.Exception:
No Function Found on type: org.primefaces.util.ComponentUtils with
signature: java.lang.String resolveWidgetVar(java.lang.String)
I have removed the 3.5 version JAR and placed the new one in the project library, but still failing to deploy with the mentioned error given.
I'm using:
Glassfish: 4.1,
Netbeans 8.0.1
You should clear glassfish cache because old primefaces library which referred in the class path of your app server.
Stop the glassfish server.
Delete the content of the osgi-cache, by removing the felix directory in your domain. This is usually found in glassfish4/glassfish/domains/domain1/osgi-cache