I have updated the Flink version to 1.16.0, after that application itself not starting. Getting below error. We are running the flink in application mode since it was working fine in 1.15.
<flink.version>1.16.0</flink.version>
Pipeline file
./bin/flink run-application --target kubernetes-application -Dkubernetes.cluster-id=sqs-signal-ingress-cluster -Dkubernetes.namespace=dev-sqs -Dkubernetes.jobmanager.service-account=flink-service-account -Dkubernetes.container.image=acrccsdev.azurecr.io/ubs-changes-oct21-sqs-signal-ingress:2022-10-21.11_27294_sqs-signal-ingress_ubs-changes-oct21 -Dkubernetes.container.image.pull-secrets=dev-ccs-acr local:///opt/flink/usrlib/signal-ingress-job.jar
Getting the below error
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.flink.connector.kafka.sink.KafkaSink]: Factory method 'kafkaSinkFsmStates' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: loader org.apache.flink.util.ChildFirstClassLoader #10feca44 wants to load class org.apache.kafka.clients.producer.ProducerRecord. A different class with the same name was previously loaded by 'app'. (org.apache.kafka.clients.producer.ProducerRecord is in unnamed module of loader 'app')
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[signal-ingress-job.jar:0.0.1-SNAPSHOT]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[signal-ingress-job.jar:0.0.1-SNAPSHOT]
... 53 common frames omitted
Caused by: java.lang.LinkageError: loader constraint violation: loader org.apache.flink.util.ChildFirstClassLoader #10feca44 wants to load class org.apache.kafka.clients.producer.ProducerRecord. A different class with the same name was previously loaded by 'app'. (org.apache.kafka.clients.producer.ProducerRecord is in unnamed module of loader 'app')
at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[na:na]
at java.base/java.lang.ClassLoader.defineClass(Unknown Source) ~[na:na]
How can I run the Flink job after updating the 1.16 version
Related
Feb 02, 2022 12:58:03 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext#71318ec4: startup date [Wed Feb 02 12:58:03 IST 2022]; root of context hierarchy
Feb 02, 2022 12:58:03 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring.xml]
Feb 02, 2022 12:58:04 PM org.springframework.context.support.AbstractApplicationContext refresh
WARNING: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'triangle' defined in class path resource [spring.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.ExceptionInInitializerError
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'triangle' defined in class path resource [spring.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:591)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:758)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)
at com.vishal.main.DrawingMain.main(DrawingMain.java:10)
Caused by: org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:215)
at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:473)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:355)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:304)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:438)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1714)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583)
... 11 more
Caused by: java.lang.ExceptionInInitializerError
at org.springframework.aop.framework.CglibAopProxy.createEnhancer(CglibAopProxy.java:232)
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:181)
... 18 more
Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module #8519cb4
at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:464)
at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91)
at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116)
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291)
at org.springframework.cglib.core.KeyFactory$Generator.create(KeyFactory.java:221)
at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:174)
at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:153)
at org.springframework.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73)
... 20 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module #8519cb4
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at org.springframework.cglib.core.ReflectUtils$1.run(ReflectUtils.java:61)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
at org.springframework.cglib.core.ReflectUtils.<clinit>(ReflectUtils.java:52)
at org.springframework.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:243)
at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:329)
... 32 more
My first guess is that you want to run an older Spring version on a JRE 16+. Probably that old Spring version depends on an equally dated CGLIB version which uses internal Java APIs now blocked due to JEP 396, which was implemented for Java 16. Maybe you can simply upgrade CGLIB and continue to use your old Spring version, maybe you need to upgrade both. Without more detailed information from you, it is hard to say. A minimal example Maven or Gradle project on GitHub, reproducing the problem, would be great.
On a second thought, maybe for now you can get away with adding
--add-opens java.base/java.lang=ALL-UNNAMED
to your JVM command line. But even if it would work, it would not be a particularly sustainable solution, only a workaround.
I was able to fix this today (with JDK 17) by upgrading to SpringBoot 2.6.4 (specifically, you need spring framework 5.3.16, so if you're using spring dependency management plugin, you only need to set the springboot version to 2.6.4).
Seems like something was fixed in spring framework 5.3.16 that resolved the issue without having to add the --add-opens JVM option.
For reference, the error for me was happening because I had autowired a Supplier bean (not for Spring cloud function).
I'm trying to load a core, but i have this error:
Error CREATEing SolrCore 'core': Unable to create core [core]
Caused by: /path/to/core/data/index/write.lock.
Caused by: org.apache.solr.common.SolrException: Unable to create core Caused by: org.apache.solr.common.SolrException: Lock held elsewhere:
Caused by: org.apache.lucene.store.LockObtainFailedException: Lock held elsewhere
Caused by: java.nio.file.AccessDeniedException:
I'm unable to load this core in solr 5.5.2
There isn't a write.lock file in the directory specified. I tried to create one, but its useless.
Hi I am new to web development and am trying to get activejdbc to connect to a cloud sql instance... I am getting the following stacktrace:
[ERROR] Failed to execute goal org.javalite:db-migrator-maven-plugin:1.4.11:migrate (dev_migrations) on project activeweb-simple: Execution dev_migrations of go
al org.javalite:db-migrator-maven-plugin:1.4.11:migrate failed: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create socket fa
ctory 'com.google.cloud.sql.mysql.SocketFactory' due to underlying exception: -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.javalite:db-migrator-maven-plugin:1.4.11:migrate (dev_migrations) on project
activeweb-simple: Execution dev_migrations of goal org.javalite:db-migrator-maven-plugin:1.4.11:migrate failed: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransien
tConnectionException: Could not create socket factory 'com.google.cloud.sql.mysql.SocketFactory' due to underlying exception:
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution dev_migrations of goal org.javalite:db-migrator-maven-plugin:1.4.11:migrate failed: com.m
ysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create socket factory 'com.google.cloud.sql.mysql.SocketFactory' due to underlying ex
ception:
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: org.javalite.db_migrator.MigrationException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create socket factory 'c
om.google.cloud.sql.mysql.SocketFactory' due to underlying exception:
at org.javalite.db_migrator.DbUtils.openConnection(DbUtils.java:183)
at org.javalite.db_migrator.maven.AbstractDbMigrationMojo.openConnection(AbstractDbMigrationMojo.java:178)
at org.javalite.db_migrator.maven.AbstractDbMigrationMojo.openConnection(AbstractDbMigrationMojo.java:170)
at org.javalite.db_migrator.maven.MigrateMojo.executeMojo(MigrateMojo.java:21)
at org.javalite.db_migrator.maven.AbstractDbMigrationMojo.executeCurrentConfiguration(AbstractDbMigrationMojo.java:96)
at org.javalite.db_migrator.maven.AbstractDbMigrationMojo.execute(AbstractDbMigrationMojo.java:80)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create socket factory 'com.google.cloud.sql.mysql.SocketFactory' due
to underlying exception:
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
at com.mysql.jdbc.Util.getInstance(Util.java:360)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:870)
at com.mysql.jdbc.MysqlIO.createSocketFactory(MysqlIO.java:3194)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:293)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2232)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2265)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:395)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at org.javalite.db_migrator.DbUtils.openConnection(DbUtils.java:181)
... 27 more
Caused by: java.lang.ClassNotFoundException: com.google.cloud.sql.mysql.SocketFactory
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.mysql.jdbc.MysqlIO.createSocketFactory(MysqlIO.java:3192)
... 43 more
My connection string in database.properties looks like this:
development.url=jdbc:mysql://google/database?cloudSqlInstance=project:location:instance&socketFactory=com.google.cloud.sql.mysql.SocketFactory&user=dbuser&password=dbuserpassword&useSSL=false
I have used the same connection string with spring-hibernate configuration with out a problem, but would like to try activeweb-activejdbc. Why the compiler cannot find the class? I have included google cloud sql dependency in pom.xml:
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>mysql-socket-factory-connector-j-6</artifactId>
<version>1.0.2</version>
</dependency>
First, you need to include a fill stack trace. Second, if you get a ClassNotFoundException, this means you do not have that class on the classpath. You need to know for a fact that the class is there. Use Maven dependency plugin, or expand all your dependent jar files and ensure you have the class. No magic here:)
UPDATE:
Now that you provided the stack trace, I see that the exception happens when you run the migrator. If you look at the migrator configuration, you will see that it requires its own class path. For instance, the example here: https://github.com/javalite/activeweb-simple/blob/master/pom.xml#L39 lists the MySQL JDBC driver especially for the migrator, even if you have it configured already for the project runtime. Just copy the config, and replace the MySQL driver with your driver.
Tried creating a camel(2.15.3) project that creates rules based on excel sheets using drools (6.2.0.Final) and I'm getting the following error:
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [**file:src/main/resources/cxf-beans.xml]; nested exception is java.lang.NoClassDefFoundError: org/drools/event/DebugProcessEventListener**
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:252)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:109)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:261)
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1427)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1417)
at
Caused by: java.lang.ClassNotFoundException: **org.drools.event.DebugProcessEventListener**
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 48 more
The class "org.drools.event.DebugProcessEventListener" is not present in drools 6.2.0.Final, any suggestion's how to proceed using drools 6.2.0 and spring 4.1.6.Release ?
It's necessary to see all of the stack dump, where that class reference comes from. FWIW, the class is in 6.2.0 but as org.drools.core.event.DebugProcessEventListener.
I have a number of test classes that are run using Arquillian (1.0.2.Final) using the 'arquillian-glassfish-embedded-3.1' container (1.0.0.CR3).
If I run any of the test classes in isolation they run as expected, if I attempt to run multiple test classes (TestSuite) I run into problems injecting EJB's into the classes.
java.lang.RuntimeException: Could not inject members
Caused by: java.lang.IllegalStateException: Exception attempting to inject Remote ejb-ref name=PackageManagerBean,Remote 3.x interface =com.dcp.pkg.PackageManager resolved to intra-app EJB PackageManagerBean in module test,ejb-link=PackageManagerBean,lookup=,mappedName=,jndi-name=PackageManagerBean,refType=Session into class com.dcp.transmission.TransmissionManagerBeanTest: Lookup failed for 'java:comp/env/PackageManagerBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=PackageManagerBean,Remote 3.x interface =com.dcp.pkg.PackageManager resolved to intra-app EJB PackageManagerBean in module test,ejb-link=PackageManagerBean,lookup=,mappedName=,jndi-name=PackageManagerBean,refType=Session into class com.dcp.transmission.TransmissionManagerBeanTest: Lookup failed for 'java:comp/env/PackageManagerBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
Caused by: javax.naming.NamingException: Lookup failed for 'java:comp/env/PackageManagerBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=PackageManagerBean,Remote 3.x interface =com.dcp.pkg.PackageManager resolved to intra-app EJB PackageManagerBean in module test,ejb-link=PackageManagerBean,lookup=,mappedName=,jndi-name=PackageManagerBean,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'PackageManagerBean#com.dcp.pkg.PackageManager' [Root exception is javax.naming.NamingException: Lookup failed for 'PackageManagerBean#com.dcp.pkg.PackageManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.dcp.pkg.PackageManager [Root exception is java.lang.IllegalArgumentException: argument type mismatch]]]]
Caused by: javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=PackageManagerBean,Remote 3.x interface =com.dcp.pkg.PackageManager resolved to intra-app EJB PackageManagerBean in module test,ejb-link=PackageManagerBean,lookup=,mappedName=,jndi-name=PackageManagerBean,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'PackageManagerBean#com.dcp.pkg.PackageManager' [Root exception is javax.naming.NamingException: Lookup failed for 'PackageManagerBean#com.dcp.pkg.PackageManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.dcp.pkg.PackageManager [Root exception is java.lang.IllegalArgumentException: argument type mismatch]]]
Caused by: javax.naming.NamingException: Lookup failed for 'PackageManagerBean#com.dcp.pkg.PackageManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.dcp.pkg.PackageManager [Root exception is java.lang.IllegalArgumentException: argument type mismatch]]
Caused by: javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.dcp.pkg.PackageManager [Root exception is java.lang.IllegalArgumentException: argument type mismatch]
Caused by: java.lang.IllegalArgumentException: argument type mismatch
The Package Manager Bean is defined as follows:
#Stateless(mappedName = "PackageManagerBean")
#Remote({ PackageManager.class })
#Local({ PackageManagerLocal.class })
public class PackageManagerBean implements PackageManager {
}
The Package Manager is injected into several of the test classes as per the example below:
#RunWith(Arquillian.class)
public class TransmissionManagerBeanTest {
#Deployment
public static Archive<?> createDeployment() {
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
.addPackages(true, TransmissionManager.class.getPackage(), Search.class.getPackage(), PackageManager.class.getPackage(), SiteManagerBean.class.getPackage())
.addAsResource("test-persistence.xml", "META-INF/persistence.xml").addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
return war;
}
#EJB
TransmissionManager transmissionManager;
#EJB
PackageManager packageManager;
#EJB
SiteManager siteManager;
#PersistenceContext
EntityManager entityManager;
#Inject
UserTransaction userTransaction;
}
I do not appear to be having problems with any of the other EJB's.
Does any one have any idea what the problem is and how I can get this working?
From what I can tell it appears to be an issue with cleaning up the resources deployed in the embedded Glassfish container between each test class. At this point I don't know if it is Arquillian, the embedded Glassfish container or my code that causes the problem.
I have found a workaround. By running in each test class in it's own JVM I avoid the issues above. It does add som additional overhead e.g. instead of re-using the embedded container for all of the test classes the container get's torn down and re-started for each test class but it does allow me to run all of my unit tests in one go.
I use maven to run the tests and use the following maven-surefire-plugin configuration to ensure each test class is run in it's own JVM:
<configuration><forkCount>1</forkCount><reuseForks>false</reuseForks>....</configuration>
For versions of maven-surefire-plugin older than 2.14 you can use forkMode=false