Getting java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured, while using gRPC(google pub/sub) to publish/consumes messages from Kafka.
Try adding a runtime dependency on netty-tcnative-boringssl-static. See gRPC's SECURITY.md. Note that the version of netty-tcnative necessary changes over time; you should look at the version of the document for a particular release (e.g., this is for 1.2.0).
Finally, went back to boot class class path approach. Prefixed the jetty-alpn.jar to boot class path and it starts working fine in cloud foundry now.
Adding the ALPN client JAR which matches my JDK version fixed this issue for me. In eclipse, you need to set up the jar as a bootstrap entry for the tomcat server.
You can find more info about it here : https://medium.com/#Parithi/jetty-alpn-npn-has-not-been-properly-configured-solution-418417ee6502
As suggested by google, use jetty container instead of tomcat, this solution works, but in our production, applications deployed on tomcat container, but of course I need it to work on tomcat in production.
On debugging the gRPC code, found that guava version causing the issue, updated the guava version 18.0, (where in some classes missed in previous versions), solved the problem , but failed while deploying in CF
Customized emebed-tomcat-core, and it works fine consistently, but again, team say no to custom tomcat container.
Java –jar apm-asset-xxxx.jar – works fine locally, but need to provide a custom command to CF start, didn’t have luxury to change the CF start process.
Finally, trick, the class loader to use tcnative-boring-ssl, library instead of tomcat-core library at runtime, by providing the following dependency in pom.xml. For the past 3 days, this solution is working CF.
org.springframework.boot
spring-boot-starter-web
org.hibernate
*
org.apache.tomcat.embed
tomcat-embed-core
org.apache.tomcat.embed
tomcat-embed-core
provided
Maven manifest plugin to promote the tc-native library to the top in the classloader.
In POM, try to place the gRPC dependency before the spring boot dependency (the order of dependencies matters). I did that and the issue was solved. For example:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-language</artifactId>
<version>0.13.0-beta</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Related
Hi I'm building a java REST client application that uses json. There's a conflict in my dependencies: one essential dependency requires jackson databind/core/annotations 2.10.1, another essential dependency uses an older version 2.2.2.
When running the app in Eclipse, this led to a MessageBodyProviderNotFoundException. The problem was that maven included version 2.2.2 instead of 2.10.1. So I use dependency management to resolve the conflict and include version 2.10.1. Within Eclipse this solved the issue and the app runs fine.
But after building the app with the maven shade plugin, the standalone app still fails with the MessageBodyProviderNotFoundException. The exception is thrown in a part of the code requiring version 2.10.1, not in the part depending on version 2.2.2.
Any thoughts? Thanks in advance!
EDIT: I checked my local maven repository and it only contains version 2.10.1. So the problem is not that the jar somehow still includes version 2.2.2.
Problem solved. Running the app within Eclipse apparently doesn't require explicitly registering a JacksonJsonProvider, but running the standalone app does:
ClientConfig config = new ClientConfig().connectorProvider(new ApacheConnectorProvider()).register(new JacksonJsonProvider());
Client client = ClientBuilder.newBuilder().withConfig(config) ...
After updating to Java 11 we get the following message:
[4/3/20, 11:47:09:184 CEST] 0000002d com.ibm.ws.classloading.internal.util.FeatureSuggestion I CWWKL0084W: The javax.transaction.TransactionManager class could not be loaded. Try enabling the jdbc-4.0 feature or a newer version of the feature in the server.xml file.
We are already using jdbc-4.3 (had the same message on 4.2 as well). The application itself does not give any errors that I can see. The application is made with maven that has the compile plugin configured with 11.
There are no problems when compiling and running tests for the application on java 11, and this only appears when deployed to liberty. Should we explicitly include a dependency for this in the war, or is this an issue that should be fixed in liberty?
From later releases on, Java EE is not included any more. The transaction classes are in the javax.transaction package.
Adding the following dependency should solve it:
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
(Not sure if it helps with your deployment, but it works with Spring Boot 2)
I'm working with EMF on a non-plugin, AppEngine Maven project that has the org.eclipse.core.runtime AND org.eclipse.ocl.ecore dependencies. The project runs perfectly when on the local server (I am using JDK 7). However, when deployed to GAE, I get the following two errors, sometimes one, sometimes the other:
java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.core.runtime.Platform
java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.ocl.ecore.internal.OCLStandardLibraryImpl
Both classes are indeed present in the JARs in the target folder's lib directory (also unzipped and checked the JARs). Here's how the dependencies look in the POM:
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.runtime</artifactId>
<version>${version.core.runtime}</version>
</dependency>
<dependency>
<groupId>org.eclipse.ocl</groupId>
<artifactId>org.eclipse.ocl.ecore</artifactId>
<version>${version.oclecore}</version>
</dependency>
Where could the problem lie? Am I missing something obvious?
Any help would be greatly appreciated!
Both classes are indeed present in the JARs in the target folder's lib
directory (also unzipped and checked the JARs
I can not see your application structure, but wherever these JARs are, if your application needs them to be the same in GAE as they are on your local machine; then you should make sure you are using the same version as present in the target version of GAE........ I used to have that problem because I started using GAE when it was new and client libraries used to change very fast.
I'm trying to work on a web application that deploys to Weblogic 10.3.5. One of the maven dependencies is Guava.
Unfortunately, upon attempting to publish the project, weblogic throws this exception:
java.lang.ClassNotFoundException: com.google.common.eventbus.EventBus
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
The rest of my maven dependencies SEEM to be working, but I'm unsure what the problem is.
Can anyone assist in troubleshooting? Environment is Eclipse with M2E plugin, Weblogic Server is integrated into Eclipse.
Update: Guava entry in pom.xml:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>11.0.2</version>
</dependency>
I included another library (commons-lang) and it worked fine.
Update 2: This may be a classloader issue. I got a clue from this blog: http://blog.eisele.net/2011/12/running-richfaces-410final-on-weblogic.html. It seems WLS uses some google-commons library.
I'm trying to force it to use my version by making changes in the weblogic.xml file, but it doesn't seem to be working.
Yes it's classloader issue (application vs. WebLogic classloading)
guava libraries and com.google.common contains same classes
WebLogic has com.google.common_1.0.0.0_0-6.jar or com.google.common_1.1.0.0_0-6.jar in it's classpath, in modules directory. (depending on WebLogic version, but the jar content is same, only META-INF\MANIFEST.MF is different)
You cannot find this library in WebLogic Classloader Analysis Tool (CAT). I'm not sure why is that....
Why not using WebLogic built in feature with help of FilteringClassLoaders - prefer-application-packages ?
you need to add something like this to your weblogic.xml or weblogic-application.xml if you are in EAR application
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>com.google.common.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
Then redeploy the application.
It works for us.
pros: no need to replace & rename magic with com.google.common*.jar files... that's a way to suicide...
Hope it helps.
For more info, see the link:
https://www.rational-pi.be/2013/03/guava-and-weblogic12c/
Go to your weblogic folder, weblogic-home >modules and if there is a com.google.common....jar file, just delete it and replace it with a guava.jar file, and you have to rename the guava file with the old com.google.common......jar name (cuz weblogic is looking for this name, but its conflicting with your guava file). i had the same problem here
I am currently working on Spring MVC web app and trying to hook up validation using the #Valid annotation. When I fire up the application I'm getting the following exception:
javax.validation.ValidationException: Unable to find a default provider
I have Hibernate Validator 3.1.0.GA on the classpath as well as javax validation 1.0.0.GA, Hibernate Core 3.3.1.GA and Hibernate Annotations 3.4.0.GA.
Is there an incompatiblity in those versions that I'm not seeing, or can anyone think of any reason why I'm still getting this exception with Hibernate Validator on the class path?
Cheers,
Caps
See this answer : https://stackoverflow.com/a/3989936/325742
To fix, Add this maven dependency Hibernate Validator Annotation Processor.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
<version>4.1.0.Final</version>
</dependency>
That's the latest stable version of that artifact, as seen from here
Generic way of finding a dependency
Let's say that you got a a NoClassDefFoundError stating that the class org.postgresql.Driver was not found.
Use Jarvana to search for a dependency that can provide org.postgresql.Driver like so : http://www.jarvana.com/jarvana/search?search_type=class&java_class=org.postgresql.Driver which gives
Translate the above dependency into maven dependency format :
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901.jdbc4</version>
</dependency>
Confirm that the above is available at Maven Central by searching like this : g:"postgresql" AND a:"postgresql"
(where g stands for GroupID and a stands for artifactID)
Finally, add it to your pom.xml
Finding Dependencies using m2e
If you have an approximate idea of the dependency needed or can figure out the one you need given a list, then m2e's dependency search can be the quickest way of adding a dependency to your pom.xml
Steps :
Click on the Dependencies tab (A) in your pom.xml
Click on Add (B)
Search for the dependency by groupId/artifactId (C)
Double click the required one from the search results to have it added directly to your pom.xml (D)
A-D marked in the following snapshot :
Finding dependencies in IntelliJ Idea
In IntelliJ, looking up a dependency is much easier. All you need to do, is to make sure that the maven central repo has been indexed by IntelliJ like so:
And then, go into the pom, do a dep+Tab (or an Alt+Insert as shown here), and this is what you get:
If you are in a class which has an unresolved import, then the quick fix gives you an option of searching and adding the corresponding maven repo by doing an Alt+Enter on the missing Class/Package:
Awesome I say !
Hibernate Validator 3.1 is not a JSR303 provider. You need to upgrade to Hibernate Validator 4 or later.
This happened to me without Hibernate.
Running great on my PC, it didn't work on my EC2 Linux server.
The reason was an existence of validation-api-1.0.0.GA.jar file under /usr/share/tomcat/lib.
Once validation-api-1.0.0.GA.jar deleted, it worked great.
In my case, I had the same problem, but it was happening because the jar of hibernate-core version 4.1.8.Final downloaded by maven was corrupted. I swithed to version 4.1.6.Final and it started working. I was using STS and spring repositories.
Hope this helps someone.
In same Situation i update my Jar version only for anotations from hibernate-anotation and hibernate-common-annotation to Hibernate4 anotations which are listed below.
For Hibernate 4 you can use this jars-
1-hibernate-commons-annotations-4.0.5.Final
2-hibernate-validator-4.2.0.Final
Hope this will work for you also.
I received the following error:
Invocation of init method failed; nested exception is javax.validation.ValidationException: Unable to get available provider resolvers
I discovered that in my WEB-INF/lib directory I had two versions of Validator.class present in both of the following jar files:
org.springframework.context-3.1.1.RELEASE.jar
com.springsource.javax.validation-1.0.0.GA.jar
I removed the com.springsource.javax.validation-1.0.0.GA.jar from the WEB-INF/lib directory because it is older and no longer supported. After doing so, my application worked perfectly. I learned from other posts that my problem had something to do with duplicate versions of the same file on the classpath. I figured out which file was causing the problem after reading Spring 3 Validation