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

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>

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

Issue with classloader

I am trying to move legacy application (ear application) from Websphere to liberty.
However on startup I am getting lot of "ClassNotFound" errors like
Caused by: java.lang.NoClassDefFoundError: com.abc.utilities.BaseServletFil
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClassInternal(ClassLoader.java:397)
at java.lang.ClassLoader.defineClass(ClassLoader.java:358)
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:375)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:285)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:943)
at java.lang.ClassLoader.loadClass(ClassLoader.java:888)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:535)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:495)
at java.lang.ClassLoader.loadClass(ClassLoader.java:871)
at com.ibm.ws.classloading.internal.UnifiedClassLoader.findClass(UnifiedClassLoader.java:127)
at
com.ibm.ws.classloading.internal.ThreadContextClassLoader.findClass(ThreadContextClassLoader.java:138)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:943)
at java.lang.ClassLoader.loadClass(ClassLoader.java:888)
at com.ibm.ws.classloading.internal.UnifiedClassLoader.loadClass0(UnifiedClassLoader.java:113)
at com.ibm.ws.classloading.internal.UnifiedClassLoader$Delegation.loadClass(UnifiedClassLoader.java:82)
at com.ibm.ws.classloading.internal.UnifiedClassLoader.loadClass(UnifiedClassLoader.java:106)
at com.ibm.ws.classloading.internal.ThreadContextClassLoader.loadClass(ThreadContextClassLoader.java:154)
at java.lang.ClassLoader.loadClass(ClassLoader.java:871)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:588)
... 17 more
Caused by: java.lang.ClassNotFoundException:
com.abc.utilities.BaseServletFil
at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:557)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:288)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:943)
at java.lang.ClassLoader.loadClass(ClassLoader.java:888)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:535)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:495)
at java.lang.ClassLoader.loadClass(ClassLoader.java:871)
... 37 more
BaseServletFil is defined in abc.jar which is not bundled inside the ear
To resolve the error, I added following configuration to server.xml
<application id="ABC_EJBEAR" location="abcuiejb.ear" name="ABC_EJBEAR">
<classloader>
<privateLibrary>
<fileset dir="${server.config.dir}/myLibrary" includes="*.jar" scanInterval="5s" />
</privateLibrary>
</classloader>
</application>
myLibrary directory is created at wlp\usr\servers\server1\myLibrary and contains abc.jar.
Any pointers in resolving this error will be helpful. Also how to troubleshoot classloading issues (for third party jars like apache commons)

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.

Calling a remote EJB hosted on WebSphere Full Profile(v7) from app. running in 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

IBM MobileFirst - NoClassDefFoundError

I'm developing hybrid application using IBM MobileFirst Platform Studio (v6.3 - former IBM Worklight).
Since there is a requirement to call Oracle stored PL/SQL procedures which contain OUT params I used a solution offered here How to get OUT parameter when invoking a stored procedure? - calling stored procedure in java and calling java class from adapter procedure.
I added StoredProcedure.java src file to server/java folder inside my project. I also added commons-dbutils-1.6.jar and ojdbc6.jar to server/lib folder. StoredProcedure class got built on save and deployed on MobileFirst Development server. I also defined needed datasource in server.xml but when I try to test the adapter procedure I implemented (R-click on adapter Run as -> Deploy MobileFirstAdapter, R-Click on adapter Run as -> Invoke MobileFirst Procedure) I get this error message:
[ERROR ] FWLSE0099E: An error occurred while invoking procedure [project MxP]StoredProcedure/pretragaVozilaFWLSE0100E: parameters: [project MxP]
invocation of javascript function 'pretragaVozila' has failed: ResultSetHandler
FWLSE0101E: Caused by: [project MxP]java.lang.NoClassDefFoundError: ResultSetHandlerjava.lang.RuntimeException:
invocation of javascript function 'pretragaVozila' has failed: ResultSetHandler
at com.worklight.integration.js.JavaScriptProcedureInvoker.invoke(JavaScriptProcedureInvoker.java:52)
at com.worklight.integration.model.ProcedureInvoker.invokeProcedure(ProcedureInvoker.java:54)
at com.worklight.integration.model.Procedure.invoke(Procedure.java:166)
at com.worklight.integration.services.impl.DataAccessServiceImpl.callProcedureInternal(DataAccessServiceImpl.java:593)
at com.worklight.integration.services.impl.DataAccessServiceImpl.callProcedure(DataAccessServiceImpl.java:539)
at com.worklight.integration.services.impl.DataAccessServiceImpl.access$100(DataAccessServiceImpl.java:58)
at com.worklight.integration.services.impl.DataAccessServiceImpl$3.execute(DataAccessServiceImpl.java:433)
at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedureInternal(DataAccessServiceImpl.java:430)
at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedure(DataAccessServiceImpl.java:139)
at com.worklight.server.dev.InvokeProcedureHandler.handle(InvokeProcedureHandler.java:85)
at com.worklight.server.dev.DevRootServlet.service(DevRootServlet.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1274)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:767)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:469)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:127)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:88)
at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:151)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:85)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:968)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1056)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4553)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:301)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:954)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:266)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:776)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: ResultSetHandler
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2615)
at java.lang.Class.getDeclaredMethods(Class.java:1860)
at org.mozilla.javascript.JavaMembers.discoverAccessibleMethods(JavaMembers.java:315)
at org.mozilla.javascript.JavaMembers.discoverAccessibleMethods(JavaMembers.java:302)
at org.mozilla.javascript.JavaMembers.reflect(JavaMembers.java:419)
at org.mozilla.javascript.JavaMembers.<init>(JavaMembers.java:43)
at org.mozilla.javascript.JavaMembers.lookupClass(JavaMembers.java:807)
at org.mozilla.javascript.NativeJavaClass.initMembers(NativeJavaClass.java:49)
at org.mozilla.javascript.NativeJavaObject.<init>(NativeJavaObject.java:44)
at org.mozilla.javascript.NativeJavaClass.<init>(NativeJavaClass.java:43)
at org.mozilla.javascript.NativeJavaClass.<init>(NativeJavaClass.java:39)
at org.mozilla.javascript.WrapFactory.wrapJavaClass(WrapFactory.java:134)
at org.mozilla.javascript.NativeJavaPackage.getPkgProperty(NativeJavaPackage.java:133)
at org.mozilla.javascript.NativeJavaPackage.get(NativeJavaPackage.java:82)
at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:2184)
at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1492)
at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1485)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1239)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:107)
at com.worklight.integration.js.JavaScriptManager.callFunction(JavaScriptManager.java:267)
at com.worklight.integration.js.JavaScriptManager.invokeFunction(JavaScriptManager.java:241)
at com.worklight.integration.js.JavaScriptManager.invokeFunction(JavaScriptManager.java:211)
at com.worklight.integration.services.impl.AdapterManagerImpl.invokeFunction(AdapterManagerImpl.java:124)
at com.worklight.integration.js.JavaScriptProcedureInvoker.invoke(JavaScriptProcedureInvoker.java:42)
... 30 more
Caused by: java.lang.ClassNotFoundException: ResultSetHandler
at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:436)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:411)
... 59 more
com.worklight.common.log.filters.ErrorFilter
What else should I do so that backend service finds commons-dbutils-1.6.jar ?
I'm running Eclipse Version: Luna Service Release 1 (4.4.1) on Windows 7 64bit with 64bit Java v1.7.0.72, connecting to Oracle Server 11g.
Dropping the necessary jars in the server/lib dir hasn't worked for me. I have to copy the required jars (dbutils) and the custom jar created for calling the stored proc in the following dir in the Eclipse workspace relative to the WorklightServerConfig
<workspace>/WorklightServerConfig/shared/resources
which maps to the following variable in the server.xml
${shared.resource.dir}
then define the oracle lib, I have the ojdbc6.jar in a sub-directory named oracle
<library id="ORACLE_LIB">
<fileset dir="${shared.resource.dir}/oracle" includes="*.jar"/>
</library>
<connectionManager id="OraclePool" maxPoolSize="40" minPoolSize="10"/>
<dataSource id="mobileDatasource" jndiName="jdbc/mobile__datasource">
<jdbcDriver libraryRef="ORACLE_LIB"/>
<properties.oracle URL="jdbc:oracle:thin:#..." password="..." user="..."/>
</dataSource>

Resources