Calling a remote EJB hosted on WebSphere Full Profile(v7) from app. running in Liberty - websphere-liberty

I have:
Application A running in Liberty Profile (8.5.5.7)
Application B running in WAS Full Profile V7, hosting EJB called MyBean.
I want to invoke MyBean's methods from application A.
I'm programmatically doing the lookup for MyBean with code as below, based on the documentation at:http://www-01.ibm.com/support/knowledgecenter/?lang=en#!/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/twlp_ejb_remote.html
String corbaURL = "corbaname::wasv7Server:wasv7Port#ejb/global/B/MyBean/beans.\\MyBean!com\\.acme\\.MyBeanRemoteInterface";
Object ref = new InitialContext().lookup(corbaURL);
// .. boilerplate code for narrowing the remote object and calling the remote method.
The Liberty where the app. A is running has the ejbRemote-3.2 feature enabled.
The application B deployed in WAS7 full profile had application name B and EJB module MyBean and MyBean's deployment descriptor is:
<session id="Session_beans.MyBean">
<ejb-name>beans.MyBean</ejb-name>
<home>com.acme.MyBeanHome</home>
<remote>com.acme.MyBeanRemote</remote>
<ejb-class>com.acme.MyBean</ejb-class>
...
</session>
When executing the lookup in app. A (in Liberty) I got a NameNotFoundException,
and I'm wondering if the LocationService at the WAS Full Profile V7 is understanding the corba name URL being sent by Liberty since V7, afaik, doesn't support JEE6; if this is the case how can I invoke the the bean MyBean from A running in the Liberty Profile? Can I use ejbRemote-3.2 feature and just use a different corba name URL, if so what is the correct URL to use?
UPDATE
As per #bkail recommendation changed the lookup URL to:
String corbaURL = "corbaname::wasv7Server:wasv7Port#beans\\.MyBean" ;
// dumpNameSpace shows:
// (top)/nodes/napp_srmwrk1_app-FULL/servers/AppServer/beans.MyBean
// 8 Bound Java type: com.acme.MyBeanHome
// 8 Local Java type: org.omg.stub.java.rmi._Remote_Stub
After the change still getting the NameNotFoundException. The stack trace is:
16:21:35.580 [Default Executor-thread-51] ERROR qsr - NamingException
javax.naming.NameNotFoundException: null
at
com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.java:61) ~ [na:1.8.0_60]
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:500) ~[na:1.8.0_60]
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:539) ~[na:1.8.0_60]
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:205) ~[na:1.8.0_60]
at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161) ~[na:na]
at javax.naming.InitialContext.lookup(InitialContext.java:417) ~[na:1.8.0_60]
at net.gbm.App.doGet(App.java:65) ~[mnr.war:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [com.ibm.ws.javaee.servlet.3.1_1.0.10.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [com.ibm.ws.javaee.servlet.3.1_1.0.10.jar:na]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1287) [com.ibm.ws.webcontainer_1.1.10.jar:na]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:778) [com.ibm.ws.webcontainer_1.1.10.jar:na]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475) [com.ibm.ws.webcontainer_1.1.10.jar:na]
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1158) [com.ibm.ws.webcontainer_1.1.10.jar:na]
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4867) [com.ibm.ws.webcontainer_1.1.10.jar:na]
at com.ibm.ws.webcontainer31.osgi.webapp.WebApp31.handleRequest(WebApp31.java:523) [com.ibm.ws.webcontainer31_1.0.10.jar:na]
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:297) [com.ibm.ws.webcontainer_1.1.10.jar:na]
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:997) [com.ibm.ws.webcontainer_1.1.10.jar:na]
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:262) [com.ibm.ws.webcontainer_1.1.10.jar:na]
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:955) [com.ibm.ws.transport.http_1.0.10.jar:na]
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:341) [com.ibm.ws.transport.http_1.0.10.jar:na]
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:470) [com.ibm.ws.transport.http_1.0.10.jar:na]
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:404) [com.ibm.ws.transport.http_1.0.10.jar:na]
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:284) [com.ibm.ws.transport.http_1.0.10.jar:na]
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:255) [com.ibm.ws.transport.http_1.0.10.jar:na]
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174) [com.ibm.ws.channelfw_1.0.10.jar:na]
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83) [com.ibm.ws.channelfw_1.0.10.jar:na]
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504) [com.ibm.ws.channelfw_1.0.10.jar:na]
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574) [com.ibm.ws.channelfw_1.0.10.jar:na]
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929) [com.ibm.ws.channelfw_1.0.10.jar:na]
at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018) [com.ibm.ws.channelfw_1.0.10.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72) ~[com.ibm.ws.org.apache.yoko.corba.spec.1.5_1.0.10.jar:1.8.0_60]
at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:251) ~[com.ibm.ws.org.apache.yoko.corba.spec.1.5_1.0.10.jar:1.8.0_60]
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:486) ~[na:1.8.0_60]
... 31 common frames omitted
Thanks,

The corbaname: URLs listed in the "Using enterprise JavaBeans with remote interfaces on the Liberty profile" topic are the names used to access EJBs running in the Liberty profile. To connect to an EJB on a full profile server, you need to use the binding name from the full profile, which likely starts with ejb/... rather than ejb/global/.... See the "Default binding pattern" section of the EJB 3.0 application bindings overview topic in the Knowledge Center.
Unlike the Liberty profile, the full profile mirrors the JNDI default namespace to the CosNaming context, so you should copy the relevant JNDI name from the CNTR0167I message in SystemOut.log (the JNDI name that does not start with java:global). Alternatively, run the PROFILE_HOME/bin/dumpNameSpace command on the full profile to dump the namespace, and you should be able to find the binding name.

Let me share my experience of very similar work that I did just yesterday.
Hope this helps somebody who searches the stackoverflow.
First I downloaded Wlp8.5.5.8 and tried adding features like ejbRemote3.2. It was not available for reasons I am unaware of.
Then I googled to find the wlp having ejbRemote3.2 feature
Downloaded that
Added following features to the ServerConfiguration.
How to add these features to Serverconfiguration? Please refer the following link:
Liberty Profile - Remote EJB
Praveen has made a spoon-feed, thanks to him
<feature>javaee-7.0</feature>
<feature>ejbRemote-3.2</feature>
<feature>jndi-1.0</feature>
<feature>ejbLite-3.2</feature>
<feature>localConnector-1.0</feature>
<feature>servlet-3.1</feature>
Added the following 6 lines of code in my servlet deployed in Liberty profile
Properties ejbProps = new Properties();
ejbProps.put(Context.PROVIDER_URL, ejbUrl);
InitialContext ffmContext = new InitialContext(ejbProps);
Object remoteObject = ffmContext.lookup(ejbName);
MyBeanRemote myBean = PortableRemoteObject.narrow(remoteObject, MyBean.class);
myBean.callingMethod();
And the magic worked: MyBean method got invoked/called.
Note: I had MyBean stub jar file generated and placed in my servlet deployed in wlp

Related

weblogic.application.Mo: javax.naming.NameNotFoundException: While trying to look up /jdbc/Myds in /app/webapp/file.war.; remaining name '/jdbc/Myds'

I'm trying to deploy a spring app on a weblogic server; the weblogic server is well configured.
I specified the datasource and I choosed my server in the target of the ds.
In my spring.properties file, here is the JNDI name:
JNDI_NAME=java:jdbc/Myds
I also tried "JNDI_NAME=jdbc/Myds" but it didn't work.
You can see the logs:
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused By: javax.naming.NameNotFoundException: While trying to look up /jdbc/Myds in /app/webapp/file.war/311012552.; remaining name '/jdbc/Myds'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1180)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:143)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:253)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:426)
at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)
at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:130)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at org.springframework.jndi.JndiTemplate.lambda$lookup$0(JndiTemplate.java:156)
at org.springframework.jndi.JndiTemplate$$Lambda$239/1681270536.doInContext(Unknown Source)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:91)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:156)
I'm new to weblogic and I need help, Thanks

Getting error when starting WAS LP server ClassNotFoundException: com.ibm.db2.jcc.DB2Driver

I am getting below error in Eclipse console when i try to start the web sphere LP server (WP 7).
[2017-10-06 12:04:46,952] [ERROR] com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl.error [19] SimpleDataSource: Error while loading properties. Cause: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:278)
at com.ibatis.common.resources.Resources.classForName(Resources.java:267)
at com.ibatis.common.resources.Resources.instantiate(Resources.java:283)
at com.ibatis.common.jdbc.SimpleDataSource.initialize(SimpleDataSource.java:199)
at com.ibatis.common.jdbc.SimpleDataSource.<init>(SimpleDataSource.java:116)
at com.ibatis.sqlmap.engine.datasource.SimpleDataSourceFactory.initialize(SimpleDataSourceFactory.java:31)
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$9.process(SqlMapConfigParser.java:220)
at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121)
at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:105)
at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102)
at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102)
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:72)
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51)
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:46)
at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63)
at com.pm.testdatamgt.persistence.util.SqlMapBuilder.build(SqlMapBuilder.java:67)
at com.pm.testdatamgt.persistence.util.SqlMapConfig.<clinit>(SqlMapConfig.java:71)
at com.pm.testdatamgt.persistence.util.SqlMapConfigFactory.getSqlMapInstance(SqlMapConfigFactory.java:37)
at com.pm.persistence.dao.impl.ReferenceCodeDaoImpl.getRefCatIdForSname(ReferenceCodeDaoImpl.java:95)
at com.pm..service.impl.ReferenceCodeServiceImpl.initAttributeNames(ReferenceCodeServiceImpl.java:99)
at com.pm.testdatamgt.startup.StartupServlet.loadVariables(StartupServlet.java:139)
at com.pm.testdatamgt.startup.StartupServlet.init(StartupServlet.java:125)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:332)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.loadOnStartupCheck(ServletWrapper.java:1428)
at com.ibm.ws.webcontainer.webapp.WebApp.doLoadOnStartupActions(WebApp.java:1205)
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinally(WebApp.java:1173)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1075)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6595)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:468)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:463)
at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebContainer.java:1120)
at com.ibm.ws.webcontainer.osgi.WebContainer.access$000(WebContainer.java:104)
at com.ibm.ws.webcontainer.osgi.WebContainer$2.run(WebContainer.java:932)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:522)
at java.util.concurrent.FutureTask.run(FutureTask.java:277)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.lang.Thread.run(Thread.java:785)
I have added the required datasource in my server.xml
**<library id="DB2JCCLib">
<fileset dir="${server.config.dir}/resources/DB2" includes="db2jcc.jar, db2jcc_license_cisuz.jar, db2jcc_license_cu.jar"/>
</library>
dataSource id="db2" jndiName="jdbc/db2">
<jdbcDriver libraryRef="DB2JCCLib">
</jdbcDriver>
<properties.db2.jcc databaseName="DB2" serverName="tsoc.nnnn.com" portNumber="5002"/>
</dataSource>**
DB2 Jars are in the give location.
Am i missing something or any pointer how to debug this ??
Thanks
If using a dataSource in server configuration, Liberty would try to load data source implementation classes such as
com.ibm.db2.jcc.DB2DataSource
com.ibm.db2.jcc.DB2ConnectionPoolDataSource
com.ibm.db2.jcc.DB2XADataSource
rather than the driver class that shows in the exception,
com.ibm.db2.jcc.DB2Driver
so a good guess (lacking the exception stack) is that your application may be trying to use DriverManager.getConnection instead of using the configured dataSource. If you really want to do this (you will be losing out on many capabilities provided by the application server such as global transaction enlistment and connection pooling) then you would need to make the JDBC driver libraries directly available to your application.
For example,
<application location=...>
<classloader commonLibraryRef="DB2JCCLib"/>
</application>

Exception when starting liberty server 16.0.0.4

Noticed the below exception when starting websphere liberty server.
How can this be removed? Appreciate any help.
We have both javaee7 profile and webProfile-6.0 features installed.
The EAR application has one WAR file which uses jee6.0 / "3.0" web.xml
Exception = java.lang.NoClassDefFoundError
Source = com.ibm.ws.injectionengine.InjectionProcessorManager.getAllDeclaredFields
probeid = 249
Stack Dump = java.lang.NoClassDefFoundError: com.ibm.websphere.sdo.mediator.jdbc.ConnectionWrapper
at java.lang.Class.getDeclaredFieldsImpl(Native Method)
at java.lang.Class.getDeclaredFields(Class.java:833)
at com.ibm.ws.injectionengine.InjectionProcessorManager.getAllDeclaredFields(InjectionProcessorManager.java:375)
at com.ibm.ws.injectionengine.InjectionProcessorManager.processAnnotations(InjectionProcessorManager.java:216)
at com.ibm.ws.injectionengine.AbstractInjectionEngine.processInjectionMetaData(AbstractInjectionEngine.java:514)
at com.ibm.ws.injectionengine.osgi.internal.OSGiInjectionEngineImpl.processInjectionMetaData(OSGiInjectionEngineImpl.java:239)
at com.ibm.ws.injectionengine.ReferenceContextImpl.processImpl(ReferenceContextImpl.java:633)
at com.ibm.ws.injectionengine.ReferenceContextImpl.process(ReferenceContextImpl.java:305)
at com.ibm.ws.injectionengine.osgi.internal.OSGiReferenceContextImpl.process(OSGiReferenceContextImpl.java:31)
at com.ibm.ws.webcontainer.osgi.webapp.WebApp.commonInitializationStart(WebApp.java:254)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1038)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6562)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:468)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:266)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:331)
at com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:251)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:301)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:471)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:405)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:285)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:256)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.lang.Thread.run(Thread.java:785)
Caused by: java.lang.ClassNotFoundException: com.ibm.websphere.sdo.mediator.jdbc.ConnectionWrapper
at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:499)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:282)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:846)
at java.lang.ClassLoader.loadClass(ClassLoader.java:825)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:477)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:449)
at java.lang.ClassLoader.loadClass(ClassLoader.java:805)
... 30 more
The SDO API (com.ibm.websphere.sdo) is not available in Liberty. Looks like you are trying to run some traditional WAS application on Liberty. You will have to change your application to make it runnable in Liberty.
I'd suggest to install WebSphere Application Migration Toolkit(free Eclipse plugin from Marketplace) and analyze your application.

org.hibernate.integrator.spi.Integrator: Provider org.hibernate.envers.boot.internal.EnversIntegrator not a subtype

I am migrating my java web application from Jboss 7.1.1 Final to Wildfly 10,using :
spring 4.2.0,
hibernate 5.0.7,
jpa 2.1
and Mysql database.
I getting the following error while trying to run my code.
2016-07-20 19:30:50,176 ERROR [org.jboss.msc.service.fail]
(ServerService Thread Pool -- 61) MSC000001: Failed to start service
jboss.persistenceunit."ccp-ear-1.0-SNAPSHOT.ear/ccp-entities-1.0-SNAPSHOT.jar#ccpPU":
org.jboss.msc.service.StartException in service
jboss.persistenceunit."ccp-ear-1.0-SNAPSHOT.ear/ccp-entities-1.0-SNAPSHOT.jar#ccpPU":
java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.envers.boot.internal.EnversIntegrator not a subtype
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117)
at
org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:667)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745) at
org.jboss.threads.JBossThread.run(JBossThread.java:320) Caused by:
java.util.ServiceConfigurationError:
org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.envers.boot.internal.EnversIntegrator not a subtype at
java.util.ServiceLoader.fail(ServiceLoader.java:239) at
java.util.ServiceLoader.access$300(ServiceLoader.java:185) at
java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480) at
org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:324)
at
org.hibernate.integrator.internal.IntegratorServiceImpl.(IntegratorServiceImpl.java:40)
at
org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:213)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:365)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.(EntityManagerFactoryBuilderImpl.java:166)
at
org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:34)
at
org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:165)
at
org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:160)
at
org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:135)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:318)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$1100(PersistenceUnitServiceImpl.java:67)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:167)
... 7 more
You need to delete the hibernate.cfg.xml and move the configuration from this file to persistence.xml.
Then You have also to remove all hibernate files from WEB-INF/lib folder, because WildFly has its own ones and this situation also possibly made a conflict.
More details on this problem in this link : JBoss Community Forum
I also had a similar issue with Wildfly 10.0.0.Final. In my project also we have all hibernate related libraries within the project's lib directory. But the jboss provided libraries caused conflicts so i have removed the content within the tag <module xmlns="urn:jboss:module:1.3" name="org.hibernate"> in module.xml file available in JBOSS_HOME\modules\system\layers\base\org\hibernate\main directory. Also i have removed the dependencies of hibernate libraries in jboss-deployment-struture.xml as,
<exclusions>
<module name="org.hibernate" slot="main"/>
</exclusions>
After these changes i can able overcome the conflict issues related to hibernate.Hope this will help.
Please note jboss-deployment-struture.xml change alone has not resolved my issue the change mentioned on module.xml file is mandatory.

ejb2.0, log4j and EAR project configuration

I am posting one more question on EJB2.0. I thought my earlier question won't get any answer since EJB2.0 is pretty much outdated technology and nobody wants to work on it any more. But my first question got answered and I am trying my luck one more time.
I created one simple EJB 2.x entity bean. My entity bean uses another class (UniqueIdGenerator) to generate value of primary key for persistent primary key field. UniqueIdGenerator uses log4j and JDBC connection, so I configured appropriate build path references for my EJB project.
Added following JARS to buildpath for EJB project
log4j-1.2.16.jar
db2jcc.jar
db2jcc_license_cu.jar
Then I mapped persistent fields to database table fields. Generated code using Prepare for Deployment option in RSA (deploying on WAS).
Created EAR project and using Project References option added EJB project (HMS) to EAR project.
I did not set any other path/classpath.
Started WAS, deployed EAR on WAS and launched Universal Test Client to test entity bean. Using remote interface I tried to create my first bean, I entered the values for fields and clicked on submit on Universal test client. On server side it called ejbCreate() of entity bean but failed when loading UniqueIdGenerator class with error NoClassDefFoundError
Here is stack trace
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
com.ibm.ejs.container.CreateFailureException: ; nested exception is:
java.lang.NoClassDefFoundError: org.apache.log4j.LogManager
at com.ibm.CORBA.iiop.UtilDelegateImpl.mapSystemException(UtilDelegateImpl.java:235)
at com.ibm.CORBA.iiop.UtilDelegateImpl.wrapException(UtilDelegateImpl.java:743)
at javax.rmi.CORBA.Util.wrapException(Util.java:296)
at ejbs._EJSRemoteCMPAddressHome_824957aa_Stub.create(_EJSRemoteCMPAddressHome_824957aa_Stub.java:258)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.ibm.etools.utc.model.ReflectionMethodModel.invoke(ReflectionMethodModel.java:65)
at com.ibm.etools.utc.servlet.InvokeServlet.invoke(InvokeServlet.java:113)
at com.ibm.etools.utc.servlet.InvokeServlet.doPost(InvokeServlet.java:374)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
Caused by: com.ibm.ejs.container.CreateFailureException: ; nested exception is:
java.lang.NoClassDefFoundError: org.apache.log4j.LogManager
at ejbs.EJSCMPAddressHomeBean_824957aa.create(EJSCMPAddressHomeBean_824957aa.java:47)
at ejbs.EJSRemoteCMPAddressHome_824957aa.create(EJSRemoteCMPAddressHome_824957aa.java:28)
at ejbs._EJSRemoteCMPAddressHome_824957aa_Stub.create(_EJSRemoteCMPAddressHome_824957aa_Stub.java:251)
... 29 more
Caused by: java.lang.NoClassDefFoundError: org.apache.log4j.LogManager
at utils.UniqueLongIdGenerator.(UniqueLongIdGenerator.java:40)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at utils.UniqueIdGenerator.(UniqueIdGenerator.java:28)
at utils.UniqueIdGenerator.(UniqueIdGenerator.java:24)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at ejbs.AddressBean.ejbCreate(AddressBean.java:46)
at ejbs.ConcreteAddress_824957aa.ejbCreate(ConcreteAddress_824957aa.java:122)
at ejbs.EJSCMPAddressHomeBean_824957aa.create(EJSCMPAddressHomeBean_824957aa.java:33)
... 31 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.LogManager
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:191)
at java.lang.ClassLoader.loadClass(ClassLoader.java:660)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:111)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:509)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
... 41 more
Have I missed anything in the configuration. Do I need to add all the jar files somewhere in EAR project. Isn't it sufficient to set them in the build path for EJB project?
I found answer for it on the following links
How to include external jar in ejb-jar
Developerworks Article
http://www.ibm.com/developerworks/rational/library/07/1211_schrag/index.html
You will need to import the third party jars into your EAR project and then setup JAR dependency in your EJB projects MANIFEST.MF file. Once you import external jars into your EAR project, they will be available in explorer for MANIFEST.MF

Resources