Tomcat 7 with Java 7 JRE_HOME not handling Java 7 beans - tomcat7

I've set-up my Tomcat 7 on Ubuntu 12 with a Java 7 JRE_HOME:
$ /usr/share/tomcat7/bin/version.sh
Using CATALINA_BASE: /usr/share/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME: /usr/lib/jvm/java-7-openjdk-i386
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.26
Server built: Apr 11 2012 12:24:08
Server number: 7.0.26.0
OS Name: Linux
OS Version: 3.2.0-24-generic-pae
Architecture: i386
JVM Version: 1.7.0_03-b147
JVM Vendor: Oracle Corporation
But when deploying a simple JSF application compiled to 1.7 Tomcat complains with
SEVERE: Critical error during deployment:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! java.util.concurrent.ExecutionException: java.lang.UnsupportedClassVersionError: com/corejsf/UserBean : Unsupported major.minor version 51.0 (unable to load class com.corejsf.UserBean)
When I change my Ant build.xml to compile to "1.6" the application deploys fine. Is this incompatibility with Java 7 to be expected? There is a 6-months-old related question on Tomcat 7 / Java 7 compatibility but the answers there seem to suggest that Java 7 is supported.

I encountered exactly the same issue.
Here are my steps:
Edit file:
/etc/default/tomcat7
Replace JAVA_HOME
From
JAVA_HOME=/usr/lib/jvm/openjdk-6-jdk
to
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_09
Restart Tomcat.

Related

java: Lombok visitor handler class lombok.javac.handlers.HandleVal failed: java.lang.NoSuchMethodError: TypeSymbol.isLocal()

I am trying to build Springboot project with Maven but getting below error while running it on tomcat server .
Please suggest a solution . Thanks .
java: Lombok visitor handler class lombok.javac.handlers.HandleVal failed: java.lang.NoSuchMethodError: 'boolean com.sun.tools.javac.code.Symbol$TypeSymbol.isLocal()'
Lombok
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
</dependency>
Maven
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /usr/local/Cellar/maven/3.8.4/libexec
Java version: 11.0.11, vendor: AdoptOpenJDK, runtime: /Users/psingh/.jabba/jdk/adopt#1.11.0-11/Contents/Home
Default locale: en_IN, platform encoding: US-ASCII
OS name: "mac os x", version: "11.1", arch: "x86_64", family: "mac"
Tomcat
Using CATALINA_BASE: /usr/local/Cellar/tomcat#9/9.0.55/libexec
Using CATALINA_HOME: /usr/local/Cellar/tomcat#9/9.0.55/libexec
Using CATALINA_TMPDIR: /usr/local/Cellar/tomcat#9/9.0.55/libexec/temp
Using JRE_HOME: /Users/psingh/.jabba/jdk/adopt#1.11.0-11/Contents/Home
Using CLASSPATH: /usr/local/Cellar/tomcat#9/9.0.55/libexec/bin/bootstrap.jar:/usr/local/Cellar/tomcat#9/9.0.55/libexec/bin/tomcat-juli.jar
Using CATALINA_OPTS:
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Server version: Apache Tomcat/9.0.55
Server built: Nov 10 2021 08:26:45 UTC
Server number: 9.0.55.0
OS Name: Mac OS X
OS Version: 11.1
Architecture: x86_64
JVM Version: 11.0.11+9
JVM Vendor: AdoptOpenJDK
I have updated Lombok to 1.18.24 .
It solved the issue !!
Now it is running in IntelliJ idea on Tomcat server .

Generating documentation in grails 4.0.11 returns a ClassNotFoundException: groovy.text.Template

My Setup:
a fresh grails project with src/docs/fr/guide/test1.gdoc
content in test1.gdoc is:
h1. Mon test
h2. Chapitre 1
test a voir
as for other, environment setup is:
------------------------------------------------------------
Gradle 7.1.1
------------------------------------------------------------
Build time: 2021-07-02 12:16:43 UTC
Revision: 774525a055494e0ece39f522ac7ad17498ce032c
Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 11.0.12 (Azul Systems, Inc. 11.0.12+7-LTS)
OS: Linux 5.4.0-80-generic amd64
| Grails Version: 4.0.11
| JVM Version: 11.0.12
why the command (summary) ./gradlew docs returns a
Execution failed for task ':docs'.
> groovy/text/Template
java.lang.ClassNotFoundException: groovy.text.Template?

Which version of spring supports open jdk or vice versa please confirm

current version of spring we are using is 3.2 .Is it compatible with open jdk 7
we are getting the following error after replacing the jre and jdk to open jdk
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'applicationContext-main' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1041)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:273)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1008)
at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(Singlet
This is the full stack trace
[main] INFO org.springframework.context.support.ClassPathXmlApplicationContext - Refreshing
org.springframework.context.support.ClassPathXmlApplicationContext#3f9a23f5: startup date [Mon Dec 12 05:35:37 IST 2016]; root of context hierarchy
[main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#1ec73967: defining beans []; root of factory hierarchy
Application context could not be created. Will now exit
org.springframework.beans.factory.access.BootstrapException: Unable to return specified BeanFactory instance: factory key [applicationContext-main], from group with resource name [classpath*:beanRefContext.xml]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'applicationContext-main' is defined
at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:409)
Below this is the stack trace which is shared earlier
Spring 3.2 supports OpenJDK 7.
It's also worth noting that OpenJDK 7 is the reference implementation of Java 7. If a project doesn't work with OpenJDK 7, it's really not Java 7 compatible!
Please also note that OpenJDK 7 u111 u121 is the latest security update. u79, that you are using, contains known security vulnerabilities.

glassfish-4 start failed after upgrade Mac OS Sierra

I already upgraded to MacOS Sierra and my Netbeans 8.0.2 throw an error when I try to run Glassfish.
Please check server admin user name and password properties.
Also please check the server log file for other possible causes.
I tried all posibles solutions that I found in stackoverflow but nothing worked.
Glassfish 4 Admin not running from Netbeans 7.4 (Password Incorrect)
This is the log of Glassfish
objc[35340]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java (0x1000a54c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x1001b84e0). One of the two will be used. Which one is undefined.
Listening for transport dt_socket at address: 9009
Launching GlassFish on Felix platform
Nov 02, 2016 11:28:52 AM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner createBundleProvisioner
INFO: Create bundle provisioner class = class com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner.
Nov 02, 2016 11:28:53 AM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNING: Skipping entry because it is not an absolute URI.
Nov 02, 2016 11:28:53 AM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNING: Skipping entry because it is not an absolute URI.
Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime#c76ff05 in service registry.
Found populator: com.sun.enterprise.v3.server.GFDomainXml
#!## LogManagerService.postConstruct : rootFolder=/Applications/NetBeans/glassfish-4.1/glassfish
#!## LogManagerService.postConstruct : templateDir=/Applications/NetBeans/glassfish-4.1/glassfish/lib/templates
#!## LogManagerService.postConstruct : src=/Applications/NetBeans/glassfish-4.1/glassfish/lib/templates/logging.properties
#!## LogManagerService.postConstruct : dest=/Applications/NetBeans/glassfish-4.1/glassfish/domains/domain4/config/logging.properties
Info: Running GlassFish Version: GlassFish Server Open Source Edition 4.1 (build 13)
Info: Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter
Info: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
Info: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
Info: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.
Info: Authorization Service has successfully initialized.
Info: Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry
Info: Grizzly Framework 2.3.15 started in: 58ms - bound to [/0.0.0.0:9090]
Info: Grizzly Framework 2.3.15 started in: 12ms - bound to [/0.0.0.0:9191]
Info: Grizzly Framework 2.3.15 started in: 2ms - bound to [/0.0.0.0:4848]
Info: Grizzly Framework 2.3.15 started in: 1ms - bound to [/0.0.0.0:3700]
Info: GlassFish Server Open Source Edition 4.1 (13) startup time : Felix (37,175ms), startup services(1,405ms), total(38,580ms)
Info: Creating a SecureRMIServerSocketFactory # 0.0.0.0 with ssl config = GlassFishConfigBean.org.glassfish.grizzly.config.dom.Ssl
Info: SSLParams =org.glassfish.admin.mbeanserver.ssl.SSLParams#5baca86
Warning: All SSL cipher suites disabled for network-listener(s). Using SSL implementation specific defaults
Info: SSLParams =org.glassfish.admin.mbeanserver.ssl.SSLParams#5baca86
Warning: All SSL cipher suites disabled for network-listener(s). Using SSL implementation specific defaults
Info: Grizzly Framework 2.3.15 started in: 11ms - bound to [/0.0.0.0:7676]
Info: Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl#3baf6936 as OSGi service registration: org.apache.felix.framework.ServiceRegistrationImpl#4acb2510.
Info: visiting unvisited references
Info: Created HTTP listener http-listener-1 on host/port 0.0.0.0:9090
Info: Created HTTP listener http-listener-2 on host/port 0.0.0.0:9191
Info: Created HTTP listener admin-listener on host/port 0.0.0.0:4848
Info: Created virtual server server
Info: Created virtual server __asadmin
Info: Setting JAAS app name glassfish-web
Info: Virtual server server loaded default web module
Info: Java security manager is disabled.
Info: Entering Security Startup Service.
Info: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
Info: Security Service(s) started successfully.
Info: visiting unvisited references
Info: visiting unvisited references
Info: visiting unvisited references
Info: Initializing Mojarra 2.2.7 ( 20140610-1547 https://svn.java.net/svn/mojarra~svn/tags/2.2.7#13362) for context ''
Info: HV000001: Hibernate Validator 5.0.0.Final
Info: SSLServerSocket /0.0.0.0:8686 and [SSL: ServerSocket[addr=/0.0.0.0,localport=8686]] created
Info: Loading application [__admingui] at [/]
Info: Loading application __admingui done in 15,743 ms
Info: JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://10.57.116.239:8686/jndi/rmi://10.57.116.239:8686/jmxrmi
I don't know what else to do.
Please help me with this problem.
you can set system java version,and this can do by jenv;please reference
http://boxingp.github.io/blog/2015/01/25/manage-multiple-versions-of-java-on-os-x/

Spring Ehcaching not working after Java 8 upgrade in Linux

We are using spring ehcache in our application, recently we upgraded the java version of the tomcat in which the app runs to 1.8.66.
Strangely there are no errors in the logs - but caching doesn't work on the linux machine.
On my local (windows) same version of java 1.8.66, it works like a charm... what could be the issue?
We are using aspecJ load time weaving with TomcatInstrumentableClassLoader - version 3.2.3.
Details of dependencies:
ehcache 2.7.4
aspectJ weaver 1.6.2
spring 3.1.1
INFO 2015-12-28 14:09:19,667 (org.springframework.cache.ehcache.EhCacheManagerFactoryBean.afterPropertiesSet(EhCacheManagerFactoryBean.java:100)) - Initializing EHCache CacheManager
INFO 2015-12-28 14:09:19,828 (net.sf.ehcache.pool.sizeof.filter.AnnotationSizeOfFilter.<clinit>(AnnotationSizeOfFilter.java:53)) - Using regular expression provided through VM argument net.sf.ehcache.pool.sizeof.ignore.pattern for IgnoreSizeOf annotation : ^.*cache\..*IgnoreSizeOf$
INFO 2015-12-28 14:09:19,873 (net.sf.ehcache.pool.sizeof.JvmInformation.<clinit>(JvmInformation.java:446)) - Detected JVM data model settings of: 64-Bit HotSpot JVM with Compressed OOPs
INFO 2015-12-28 14:09:20,190 (net.sf.ehcache.pool.sizeof.AgentLoader.getAgentFile(AgentLoader.java:198)) - Extracted agent jar to temporary file /opt/projects/tomcat/instance_7/temp/ehcache-sizeof-agent7845091970407661363.jar
INFO 2015-12-28 14:09:20,190 (net.sf.ehcache.pool.sizeof.AgentLoader.loadAgent(AgentLoader.java:138)) - Trying to load agent # /opt/projects/tomcat/instance_7/temp/ehcache-sizeof-agent7845091970407661363.jar
INFO 2015-12-28 14:09:20,199 (net.sf.ehcache.pool.impl.DefaultSizeOfEngine.<init>(DefaultSizeOfEngine.java:111)) - using Agent sizeof engine
INFO 2015-12-28 14:09:20,456 (net.sf.ehcache.pool.impl.DefaultSizeOfEngine.<init>(DefaultSizeOfEngine.java:111)) - using Agent sizeof engine
INFO 2015-12-28 14:09:20,746 (net.sf.ehcache.pool.impl.DefaultSizeOfEngine.<init>(DefaultSizeOfEngine.java:111)) - using Agent sizeof engine
INFO 2015-12-28 14:09:20,768 (net.sf.ehcache.pool.impl.DefaultSizeOfEngine.<init>(DefaultSizeOfEngine.java:111)) - using Agent sizeof engine
INFO 2015-12-28 14:09:20,789 (net.sf.ehcache.pool.impl.DefaultSizeOfEngine.<init>(DefaultSizeOfEngine.java:111)) - using Agent sizeof engine
I can see same logs in both Windows and Linux after application starts up
Could this be a issue with Linux JVM?
I think that it's a problem with spring 3.x.x and Java 8.
Take a look here Spring 3.2.x with Java 8

Resources