JRebel caused WELD-001414 Bean name is ambiguous - jboss7.x

We created a multi-module maven project but is currently encountering the error in the title on deploy.
Here's the setup (those with parenthesis rebel means there is a jrebel configuration in that project):
-MainProject:
--Model (rebel)
--ProjectA
---Web (rebel)
---EJB (rebel)
---Config (rebel)
The weird thing is, if I removed the rebel configuration in EJB it deploys successfully.
The error:
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414 Bean name is ambiguous. Name bayadDunningInputHistoryBean resolves to beans [Managed Bean [class xxx.yyy.ClassBean] with qualifiers [#Any #Default #Named], Managed Bean [class xxx.yyy.ClassBean] with qualifiers [#Any #Default #Named]]
Base on the error, could it be that the same class is loaded twice?

The solution was to downgrade from JBoss7.2 to JBoss7.1.3. Fortunately we were really not dependent on anything from 7.2 version but still I wonder what changed could be something about class loading.

Related

OkHttp: NoSuchMethodError copyInto in TlsUtil

Running instrumentation tests with RESTMock we are getting this error
java.lang.NoSuchMethodError: No static method copyInto$default([Ljava/lang/Object;[Ljava/lang/Object;IIIILjava/lang/Object;)[Ljava/lang/Object; in class Lkotlin/collections/ArraysKt; or its super classes (declaration of 'kotlin.collections.ArraysKt' appears in /data/app/com.example.debug-1/base.apk)
FATAL EXCEPTION: pool-6-thread-1
Process: com.example.debug, PID: 6606
java.lang.NoSuchMethodError: No static method copyInto$default([Ljava/lang/Object;[Ljava/lang/Object;IIIILjava/lang/Object;)[Ljava/lang/Object; in class Lkotlin/collections/ArraysKt; or its super classes (declaration of 'kotlin.collections.ArraysKt' appears in /data/app/com.example.debug-1/base.apk)
at okhttp3.tls.internal.TlsUtil.newKeyManager(TlsUtil.kt:84)
at okhttp3.tls.HandshakeCertificates$Builder.build(HandshakeCertificates.kt:144)
at io.appflate.restmock.SslUtils.localhost(SslUtils.java:49)
at io.appflate.restmock.RESTMockServer.setUpHttps(RESTMockServer.java:91)
at io.appflate.restmock.RESTMockServer.init(RESTMockServer.java:74)
at io.appflate.restmock.RESTMockServerStarter$1.run(RESTMockServerStarter.java:56)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
This is the line in question in OkHttp
IIUC, Kotlin can treat a varargs as a Kotlin Array and then call extensions functions like copyInto
We're on OkHttp 4.0.1, Kotlin 1.3.40, R8 1.5.41
Our test apk correctly contains copyInto method so I don't think it's a proguard/R8 issue:
I'm at a loss as to what to test next. I asked on OkHttp's github issuse page and they suggested I post here link
Update: still happening on OkHttp 4.1.0. Also I realized that it can't be an R8 issue since R8 doesn't remove code from test apk.
I had a same issue , then added the mentioning lib to my project. It solved my problem:
maven :
<!-- https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.3.70</version>
</dependency>
or
'org.jetbrains.kotlin:kotlin-stdlib:1.3.70'
I got the same issue when I was using okhttp3.mockwebserver.MockWebServer with https enabled with a server certificate from okhttp-tls.
In my case, the problem was that by just importing the com.squareup.okhttp3:okhttp-tls:4.2.0 dependency, org.jetbrains.kotlin:kotlin-stdlib was being resolved to version 1.2.71.
Given the copyInto method was introduced starting kotlin 1.3 it was failing with the same error you have.
I fixed it by adding explicitly the kotlin version in my gradle.build file:
testRuntime 'org.jetbrains.kotlin:kotlin-stdlib:1.3.50'
I got the same issue, but I'm developing a multi-module java project. It was useful that add a dependency for kotlin-stdlib in pom.xml that belongs to this module while unit testing...
When I boot this whole project, this issue came out agnain. Finally, I find this dependency need to be in the whole project's pom.xml, I mean the pom.xml in the project's root dir.

Exception while running Seedstack Application

I have used seedstack dependecies for Hibernate and JPA to create DAO services that performs crud operations on Database.
I am trying to Launch this Seedstack application module through Java application Launcher in eclipse, by SeedMain class.
In pom.xml - dependecy for undertow is given.
<dependency>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-web-undertow</artifactId>
</dependency>
When executing the SeedMain class, I am getting the below error snakeyaml error:-
Exception in thread "main" java.lang.NoSuchMethodError: org.yaml.snakeyaml.DumperOptions.setSplitLines(Z)V
at com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.buildDumperOptions(YAMLGenerator.java:259)
at com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.<init>(YAMLGenerator.java:232)
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory._createGenerator(YAMLFactory.java:447)
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createGenerator(YAMLFactory.java:397)
at org.seedstack.seed.core.internal.diagnostic.DefaultDiagnosticReporter.writeDiagnosticReport(DefaultDiagnosticReporter.java:75)
at org.seedstack.seed.core.internal.diagnostic.DefaultDiagnosticReporter.writeDiagnosticReport(DefaultDiagnosticReporter.java:67)
at org.seedstack.seed.core.internal.diagnostic.DiagnosticManagerImpl.dumpDiagnosticReport(DiagnosticManagerImpl.java:70)
at org.seedstack.seed.core.SeedMain.handleException(SeedMain.java:68)
at org.seedstack.seed.core.SeedMain.main(SeedMain.java:61)
As per my understanding the Error is due to some version inconsistency for snakeyaml, But for Seedstack as the versions for dependecies are resolved by seedstack-bom dependecy, so where exactly should I do the changes to resolve the error.
Thanks in Advance!
From reading the stacktrace, it seems that you have some error on startup which is handled by the handleException() method. This method then tries to write a YAML diagnostic report but ultimately fails due to the snakeyaml version issue you mentioned.
You should do two things:
Fix the snakeyaml dependency issue by looking into the dependency tree. This kind of problem is often caused by some library that makes Maven choose an older version. SeedStack needs at least jackson-dataformat-yaml version 2.9.4 which in turn needs at least snakeyaml 1.18.
Fix the other error by looking at the full stacktrace. When a diagnostic report cannot be written, the original exception is still printed on the console (on stderr).

Simple Camel run goal with blueprint gives exception

I have a simple maven project created based on camel blueprint archetype.
When I do "mvn camel:run" I see this error
Caused by: java.lang.RuntimeException: Gave up waiting for service (objectClass=org.apache.camel.CamelContext)
at org.apache.camel.test.blueprint.CamelBlueprintHelper.getOsgiService(CamelBlueprintHelper.java:295)
at org.apache.camel.test.blueprint.CamelBlueprintHelper.getOsgiService(CamelBlueprintHelper.java:256)
at org.apache.camel.test.blueprint.Main.doStart(Main.java:110)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.main.MainSupport.run(MainSupport.java:138)
at org.apache.camel.main.MainSupport.run(MainSupport.java:390)
at org.apache.camel.test.blueprint.Main.main(Main.java:79)
Why is a test package being used ? I don't have anything in test scope or test classes. What is the sequence of the OsgiService creation and which class is supposed to create it ?
The issue was CamelContext was not getting created. The problem went away when I removed the reference to an unknown class.
I move to karaf

Hive Set up issue "SINGLETON from class org.slf4j.LoggerFactory**"

HAdoop single node cluster is working fine. HAdoop is working fine. JPS/Web interface of hadoop working fine.
I have done set up of hive.
When am entering into hive from hadoop its giving me below error :
"Exception in thread "main" java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory
Can someone help me in this case
If you get the slf4j IllegalAccessError shown above, then you are using an older version of slf4j-api, e.g. 1.4.3, with a new version of a slf4j binding, e.g. 1.5.6. As mentioned in the slf4j faq on IllegalAccessError, this typically occurs when your Maven pom.ml file incorporates hibernate 3.3.0 which declares a dependency on slf4j-api version 1.4.2. If your pom.xml declares a dependency on an slf4j binding, say slf4j-log4j12 version 1.5.6, then you will get illegal access errors.
Also refer to the solution here: IllegalAccessError slf4j

SEVERE: EJB5070: Exception creating stateless session bean - solution with beans.xml

I was struggling to overcome this problem! Went trough most of the similar posts over here however had no luck.
Deployment was fine but problem occurred during runtime.
I am working with GlassFish 3.1.2.2 and use maven, application is deployed as a WAR with multiple JARs and using EJB3, JPA, CDI.
FINALY I have found the cause: In one of my jar file with session beans I had a missing beans.xml file in src/main/resources/META-INF directory.According to cdi spec this file is needed by the jar to be recognised as a bean archive.Hope this will solve problems for others as well! cheers bb