I am working on a big project that requires massive financial calculations, I am using
Netbeans IDE 7.3 with a default web application of Java EE 5 (not a maven application)
,My application server is tomcat 7 I am using jsps and servlets my OS is windows 7.
I downloaded and added the jquantlib binary to my application, but when I run it keeps saying that it needs the slf4j-api extension that is not found so i download it also and added its jar to my project but still the error persists.
How can I solve this ? and can anyone give me some guidelines on how to do it ?
The key here is that jquantlib requires slf4j-api version 1.4.0 in the jar manifest:
(from MANIFEST.MF in jquantlib.jar)
Implementation-Vendor-Id: org.jquantlib
Extension-List: slf4j-api
slf4j-api-Extension-Name: slf4j-api
slf4j-api-Implementation-Version: 1.4.0
Tomcat will try to use the version of slf4j-api that you're including in your app, but it's likely that what you've included isn't actually compatible. See http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tomcat/tomcat-catalina/7.0.34/org/apache/catalina/util/Extension.java#Extension.isCompatibleWith%28org.apache.catalina.util.Extension%29 for details.
Bottom line - try to use slf4j-api version 1.4.0 in your application.
Try removing the lines from the MANIFEST.MF file that mention the sfl4j
Related
I was using Apache tomcat 9.0.44 earlier and due to some security vulnerabilities I've upgraded it to 9.0.62 now.
/bin/Version.bat shows correct version now 9.0.62
Also checked registry keys and it also shows correct version
Still on security dashboard we are getting "Vulnerable version of Apache Tomcat is installed 9.0.44"
All the applications are working fine.
I am not sure if during upgrade I've missed anything.
During upgrade from 9.0.44 to 9.0.62 these were the steps that I'd followed:-
From this URL https://tomcat.apache.org/migration-9.html#Upgrading_9.0.x checked the configuration file changes from Apache tomcat 9.0.44 to apache tomcat 9.0.62 and perform these changes in the configuration files as applicable.
Replaced all jar files from
Downloads\apache-tomcat-9.0.62-windows-x64\apache-tomcat-9.0.62\lib to
Tomcat9/lib directory
Updated Bootstrap.jar , Tomcat-juli jar , Tomcat9.exe , Tomcat9w.exe files from
Downloads\apache-tomcat-9.0.62-windows-x64\apache-tomcat-9.0.62\bin to
Tomcat9/bin
Also java -cp "catalina.jar" org.apache.catalina.util.ServerInfo shows :-
could anyone please suggest what is incorrect in this case?
In Apache NetBeans 12.0 LTS
When I'm trying to install Hibernate plugin it says :
Some plugins require plugin Freemarker Integration to be installed
The plugin Freemarker Integration is requested in implementation version 238.
The following plugin is affected:
Hibernate
But there's on Apache NetBeans Plugin Portal Freemarker plugin is not available.
I tried installing Freemarker plugin from old plugin portal of NetBeans
FreeMarker support for NetBeans
but getting same error.
I'm using:
Debain 10.4 Buster LXQt AMD 64-bits
openjdk 11.0.7 2020-04-14 LTS
Apache NetBeans 12.0 LTS
I've also created issue there at Apache's JIRA issue tracker
No dependent plugins are available at Apache NetBeans plugin portal for Hibernate
But I think they will not pay attention.
This causes because there is a conflict for the version of freemarker, netbeans is looking for freemarker.jar with OpenIDE-Module-Implementation-Version: 238, but in my case the OpenIDE-Module-Implementation-Version: was 239 and that was causing the issue.
You can fix this by
Close your running netbeans application
Download freemarker.jar with OpenIDE-Module-Implementation-Version: 238 org-netbeans-libs-freemarker-RELEASE81.jar and rename the downloaded library to org-netbeans-libs-freemarker.jar
Navigate to ide/modules subfolder in apache netbeans installation directory
You will find the freemarker library org-netbeans-libs-freemarker.jar, replace this with your downloaded library.
Restart the netbeans(or perhaps restarting the computer should work) and you should be able to download the hibernate plugin
ps- you can check the OpenIDE-Module-Implementation-Version by opening the jar library as an archive and inside the META-INF/MANIFEST.MF file
Also refer this for more information
This is the way.
unistall netbeans.
install netbeans (but not started it yet)
Open: "netbeans-12.0/netbeans/ide/modules/org-netbeans-libs-
freemarker.jar" with an arquive manager and go to META-INF/MANIFEST.MF
change the value 239 for 238 in lines. To be like this:
OpenIDE-Module-Implementation-Version: 238
OpenIDE-Module-Specification-Version: 2.42.0.238
close and update you change.
start the netbeans for the fist time and all will go well.
The hibernate plugin was not anything important. I was trying to install that one, but because of the above error, Netbeans did not load, and on top of it, the CentOS-8-Stream came to logged-out.
So, I remove the hibernate instances.
cd ~/.netbeans/13/
grep -r "hibernate"
Resolution: Removal of the faulty plugins
Removed the JAR s from /home/jacobd/netbeans-13/netbeans/java/modules/locale/
Removed the XML s from /home/jacobd/netbeans-13/netbeans/java/config/Modules name matching hibernate, two xml will be here.
I had the same issue with NetBeans version 16 and solved it by installing freemaker.jar module which replaced the default module that comes with NetBeans.
Please try the following
step 1: Download freemaker modules from the following link:
https://drive.google.com/file/d/1AySqHHh73y1SDXU9H0wqGtu4VqMWYfRi/view?usp=sharing
step 2:
Close all NetBeans running applications and
copy the downloaded module and go to the NetBeans installation directory as follows:
C:\Program Files\NetBeans-16\netbeans\ide\modules
first delete the org-netbeans-libs-freemar.jar and paste the downloaded module to replace org-netbeans-libs-freemar.jar that comes with NetBeans ( I mean the one you deleted)
Start NetBeans and go to Tools > Plugins >Available Plugins then scroll until you see Hibernate
This is my screenshot of my installation on windows 10
I have created an app(spring boot 1.5.6) using start.spring.io and trying to deploy it to Weblogic 12.1.3.0.0.
Messages in administration console:
Error Unable to access the selected application.
Error java.io.IOException
Error weblogic.utils.compiler.ToolFailureException
Message in logs:
<23.08.2017 13:40:26 GMT+03:00> <Error> <J2EE> <BEA-160228> <AppMerge failed to merge your application. If you are running AppMerge on the command-line, merge again with the -verbose option for more details. See the error message(s) below.>
These links don't help:
https://docs.spring.io/spring-boot/docs/1.5.x/reference/html/howto-traditional-deployment.html
Deploy Spring Boot app in Weblogic
Update:
The problem is dependency JAX-RS. Without it app is deployed successfully. Not sure how to make it work With this dependency
Update x2:
Removed Jax-rs and now:
java.lang.NoSuchMethodError:org.springframework.core.annotation.AnnotationAwareOrderComparator.sort(Ljava/util/List;)V
Resolved by this
Our team started to use Spring Boot 2.0.0 and we had this issue also.
After some investigation, we have found that AppMerge tool scans all classes before deploy.
Root cause:
In case of WebLogic 12.1.3.* it fails because of Multi-Release JAR Files.
AppMerge tool can't work with JDK 9 files.
Solution:
Use Log4j 2.8.2
In pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
...
<properties>
...
<log4j2.version>2.8.2</log4j2.version>
...
</properties>
...
</project>
I had this problem, and the answer by Artyom is correct, but I'll provide an answer to give some more details.
The problem in my case was Lombok. Any version after 1.6.20 (I believe) added Java 9 Module support. This adds a module-info.class in the root of the .jar file. I confirmed this was the problem by removing the module-info.class file from the jar and rebuilding my war. Appmerge was able to run successfully with this file removed. I would not suggest doing this in production, I just did it to confirm the problem. Not sure why Appmerge does not like module-info.class files.
Some advice that can help you troubleshoot this problem:
A simple method to identify the problematic dependency is to take a known project that works, then add dependencies from the failing project until the good project fails.
Extract the jar file for the broken dependency and look for a module-info.class file in the root directory. If it's there, this is likely the problem.
A useful command for testing if the .war merges: java -cp c:\path_to_weblogic_server\wlserver\server\lib\weblogic.jar weblogic.appmerge -verbose target/your_war_file.war. This will save you time trying to deploy in the console.
As for a solution for fixing the dependency besides reverting to an older version, I'm still trying to figure out.
Note: In the case of Lombok, I believe your supposed to set the scope to provided, which I wasn't doing in my case. The .jar won't be included when the scope is provided so you won't run into this problem. See this answer for more info.
Spring boot 2.0 relies on JPA 2.1 while Weblogic 12.1.3 vanilla installation relies on JPA 1.0.
Take note that Weblogc 12.1.3 is kind of particular, it is split between two java enterprise specifications 6 and 7.
You will need to upgrade your JPA api and add the hibernate 5 implementation to your weblogic 12.1.3 instance.
In you web app, make sure what dependencies you have and that they do not overlap with the ones already provisioned under Weblogic classloader.
I have mentioned the full description of steps here:
http://javagoogleappspot.blogspot.com/2018/05/make-your-spring-boot-20-compatible.html
After trying Arytom's solution without any luck, we tried investigating joshaidan's suggestion. Upon further digging we found the Oracle support document: 2645919.1
From that article:
Cause
Application package contains incompatible jar library / class. WebLogic internally uses ASM library to check class bytecode version, it has following similar code to check bytecode version is compatible, or IllegalArgumentException will be thrown.
https://github.com/llbit/ow2-asm/blob/master/src/org/objectweb/asm/ClassReader.java
166 public ClassReader(final byte[] b, final int off, final int len) {
167 this.b = b;
168 // checks the class version
169 if (readShort(off + 6) > Opcodes.V1_8) {
170 throw new IllegalArgumentException();
171 }
Update class file version to 53.0
When generating class files in conjunction with -target 9 (specified either explicitly or implicitly), javac will generate class files with a major version number of 53. For details of version 53 class files, see the Java Virtual Machine Specification.
The JDK classes themselves mostly use version 53 class files.
Tools or libraries that rely on ASM or other bytecode manipulation libraries may need updated versions of these libraries to work with version 53 class files.
Solution
Replace the issue class/ library with compatible release.
[oracle#sandbox ~]$ cd ~/war
[oracle#sandbox war]$ for i in `find . -name '*.jar'`; do unzip -qo $i -d $i.delemete; done
[oracle#sandbox war]$ find . -name \*.class | xargs file | sort -t, -k2 | tail -n 10
./WEB-INF/js.jar.delemete/examples/webservices/jaxws/InvokeTransactionResponse.class: compiled Java class data, version 52.0 (Java 1.8)
./WEB-INF/js.jar.delemete/examples/webservices/jaxws/MyClient$1.class: compiled Java class data, version 52.0 (Java 1.8)
./WEB-INF/js.jar.delemete/examples/webservices/jaxws/MyClient.class compiled Java class data, version 52.0 (Java 1.8)
./WEB-INF/js.jar.delemete/examples/webservices/jaxws/ObjectFactory.class: compiled Java class data, version 52.0 (Java 1.8)
./WEB-INF/js.jar.delemete/examples/webservices/jaxws/package-info.class: compiled Java class data, version 52.0 (Java 1.8)
./WEB-INF/js.jar.delemete/examples/webservices/jaxws/SimpleClientJwsImpl.class compiled Java class data, version 52.0 (Java 1.8)
./WEB-INF/js.jar.delemete/examples/webservices/jaxws/SimpleClientService.class: compiled Java class data, version 52.0 (Java 1.8)
./WEB-INF/lib/jackson-annotations-2.10.2.jar.delemete/module-info.class compiled Java class data, version 53.0
./WEB-INF/lib/jackson-core-2.10.2.jar.delemete/module-info.class: compiled Java class data, version 53.0
./WEB-INF/lib/jackson-databind-2.10.2.jar.delemete/module-info.class: compiled Java class data, version 53.0
The thing to note in the above example is that the last 3 lines are class files with version 53.0, which are going to be the offending classes.
Upon investigation of our app, using Spring boot 1.5.6.RELEASE we found that the Jersey dependency was pulling in asm-all-repackaged:2.5.0-b32 which is compiled for JDK9. Adding the following explicit dependency addressed the issue, the solution to which was found here: https://github.com/jersey/jersey/issues/3617
<!--
Work around bug where Jersey pulls in asm-all-repackaged:2.5.0-b32, which is compiled for JDK9. This prevents deployment to WebLogic 12.1.3 on JDK8
https://github.com/jersey/jersey/issues/3617
Oracle Support Doc ID 2645919.1
-->
<dependency>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>asm-all-repackaged</artifactId>
<version>2.4.0</version>
</dependency>
Try to remove dependency of tomcat:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
I faced same issue, and my solution is deleting weblogic.xml file in project folder.
I shared for whom concerned.
i am upgrading current project to Tomcat 8, and I add the same external library which I used in Tomcat 6 and test with same application, but it start to throw bunch of
java.lang.NoClassDefFoundError: ...
because of compatibility issue, here is what's been inject to Tomcat 8 or 7 (via "add external jar" to server instance in Eclipse, not copy those jar files int Tomcat/lib folder)
el-api-1.0.jar
jsp-api-2.1.jar
jstl-1.2.jar
jstl-api-1.2
jstl-impl-1.2.jar
servlet-api-2.5.jar
validation-api-1.0.0.GA.jar
I checked on Tomcat versions but it didn't mention anything about backward compatibility.
Also I found in Pivotal(Server app based on Tomcat) Tomcat8(or7)/lib folder, it already include certain version of above libraries:
jsp-api.jar (version 2.3)
el-api.jar (version 3.0)
servlet-api.jar (version 3.1)
Then I take out the three jar file with lower version from the external jar files I attache to the server only leave jstl , It still gives me
java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
or
java.lang.ClassNotFoundException: org.apache.jsp.main_jsp
I understand that I can change the servlet version from 2.5 to 3.0. But I really prefer not to change anything from source code including web.xml so at this point, my questions are:
Can Tomcat 8 actually backward compatible to servlet 2.5?
If so, which version of JSTL I should put in the external jar file
Or, anyway I can suppress or remove the newer version of above api jars and use lower version from external source instead?
also
Is it ok to keep web-app to version 2.5 even in Tomcat 7/8?
I have simple question. I'm working on JAVA application which runs on Glassfish 4.1, I wrote code that needs > Guava 18.0 libs, when i run my code in my local IDE it works well, but when i try to run this code as part of the application on Glassfish I'm getting error caused by the fact that the application contains Guava libs in version 13 and i need version 18+. So, my question is:
Can i somehow add Guava 18.0 libs to the Glassfish and tell it to
prefer this new library in my application?
Thanks for answers.
Try this:
Download The new library files you're interested in (or pull them from your local repository considering you already have them there).
The outdated files in Glassfish should be inside of the glassfish module somewhere near:
\glassfish4\glassfish\modules
Replace the old library file with the newly downloaded fresh files.
I had to do the same once before with a jboss logger when getting a debugF error and I got this answer from SO here. Good luck!