Friday, August 18, 2017

How to fix OIM Design Console error javax.naming.NameNotFoundException: While trying to lookup 'ejb.stateful.tcDataBase#com.thortech.xl.ejb.interfaces.tcDataBaseRemote' didn't find subcontext 'stateful'. Resolved 'ejb'


Hi Everybody,


OIM 11G - Design Console problem:

log4j:WARN No appenders could be found for logger (org.springframework.jndi.JndiTemplate).
log4j:WARN Please initialize the log4j system properly.
Aug 17, 2018 6:31:37 PM oracle.iam.platform.OIMClient loginSessionCreated
SEVERE: An error occurred while trying to notify server that a new login session has been created.
oracle.iam.platform.utils.NoSuchServiceException: java.lang.reflect.InvocationTargetException
        at oracle.iam.platform.OIMClient.getServiceDelegate(OIMClient.java:282)
        at oracle.iam.platform.OIMClient.getService(OIMClient.java:259)
        at oracle.iam.platform.OIMClient.loginSessionCreated(OIMClient.java:294)
        at oracle.iam.platform.OIMClient.login(OIMClient.java:216)
        at oracle.iam.platform.OIMClient.login(OIMClient.java:185)
        at com.thortech.xl.client.base.tcAppWindow.internalLogin(tcAppWindow.java:584)
        at com.thortech.xl.client.base.tcAppWindow.login(tcAppWindow.java:504)
        at com.thortech.xl.client.base.tcAppWindow.<init>(tcAppWindow.java:118)
        at com.thortech.xl.client.base.tcAppWindow.main(tcAppWindow.java:173)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at oracle.iam.platform.OIMClient.getServiceDelegate(OIMClient.java:278)
        ... 8 more
Caused by: oracle.iam.platform.utils.NoSuchServiceException: javax.naming.NameNotFoundException: While trying to lookup 'ejb.stateless.ClientLoginSessionService#oracle.iam.platformservice.api.ClientLoginSessionServiceRemote' didn't find subcontext 'stateless'. Resolved 'ejb' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'ejb.stateless.ClientLoginSessionService#oracle.iam.platformservice.api.ClientLoginSessionServiceRemote' didn't find subcontext 'stateless'. Resolved 'ejb']; remaining name 'stateless/ClientLoginSessionService#oracle/iam/platformservice/api/ClientLoginSessionServiceRemote'
        at oracle.iam.platformservice.api.ClientLoginSessionServiceDelegate.<init>(Unknown Source)
        ... 13 more
Caused by: javax.naming.NameNotFoundException: While trying to lookup 'ejb.stateless.ClientLoginSessionService#oracle.iam.platformservice.api.ClientLoginSessionServiceRemote' didn't find subcontext 'stateless'. Resolved 'ejb' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'ejb.stateless.ClientLoginSessionService#oracle.iam.platformservice.api.ClientLoginSessionServiceRemote' didn't find subcontext 'stateless'. Resolved 'ejb']; remaining name 'stateless/ClientLoginSessionService#oracle/iam/platformservice/api/ClientLoginSessionServiceRemote'
        at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:237)
        at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
        at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
        at weblogic.jndi.internal.ServerNamingNode_1036_WLStub.lookup(Unknown Source)
        at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:424)
        at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:412)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
        at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:179)
        ... 14 more
Caused by: javax.naming.NameNotFoundException: While trying to lookup 'ejb.stateless.ClientLoginSessionService#oracle.iam.platformservice.api.ClientLoginSessionServiceRemote' didn't find subcontext 'stateless'. Resolved 'ejb'
        at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1148)
        at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:253)
        at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:220)
        at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
        at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:667)
        at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
        at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
        at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
        at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

Aug 17, 2018 6:31:37 PM com.thortech.util.logging.Logger error
SEVERE: Class/Method: tcDataBaseClient/bindToInstance encounter some problems: java.lang.reflect.InvocationTargetException
oracle.iam.platform.utils.NoSuchServiceException: java.lang.reflect.InvocationTargetException
        at oracle.iam.platform.OIMClient.getServiceDelegate(OIMClient.java:282)
        at oracle.iam.platform.OIMClient.getService(OIMClient.java:259)
        at com.thortech.xl.dataaccess.tcDataBaseClient.bindToInstance(tcDataBaseClient.java:151)
        at com.thortech.xl.dataaccess.tcDataBaseClient.<init>(tcDataBaseClient.java:75)
        at com.thortech.xl.server.tcDataBaseClient.<init>(tcDataBaseClient.java:33)
        at com.thortech.xl.client.dataobj.tcDataBaseClient.<init>(tcDataBaseClient.java:67)
        at com.thortech.xl.client.base.tcAppWindow.internalLogin(tcAppWindow.java:589)
        at com.thortech.xl.client.base.tcAppWindow.login(tcAppWindow.java:504)
        at com.thortech.xl.client.base.tcAppWindow.<init>(tcAppWindow.java:118)
        at com.thortech.xl.client.base.tcAppWindow.main(tcAppWindow.java:173)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at oracle.iam.platform.OIMClient.getServiceDelegate(OIMClient.java:278)
        ... 9 more
Caused by: oracle.iam.platform.utils.NoSuchServiceException: javax.naming.NameNotFoundException: While trying to lookup 'ejb.stateful.tcDataBase#com.thortech.xl.ejb.interfaces.tcDataBaseRemote' didn't find subcontext 'stateful'. Resolved 'ejb' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'ejb.stateful.tcDataBase#com.thortech.xl.ejb.interfaces.tcDataBaseRemote' didn't find subcontext 'stateful'. Resolved 'ejb']; remaining name 'stateful/tcDataBase#com/thortech/xl/ejb/interfaces/tcDataBaseRemote'
        at com.thortech.xl.ejb.interfaces.tcDataBaseDelegate.<init>(Unknown Source)
        ... 14 more
Caused by: javax.naming.NameNotFoundException: While trying to lookup 'ejb.stateful.tcDataBase#com.thortech.xl.ejb.interfaces.tcDataBaseRemote' didn't find subcontext 'stateful'. Resolved 'ejb' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'ejb.stateful.tcDataBase#com.thortech.xl.ejb.interfaces.tcDataBaseRemote' didn't find subcontext 'stateful'. Resolved 'ejb']; remaining name 'stateful/tcDataBase#com/thortech/xl/ejb/interfaces/tcDataBaseRemote'
        at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:237)
        at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
        at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
        at weblogic.jndi.internal.ServerNamingNode_1036_WLStub.lookup(Unknown Source)
        at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:424)
        at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:412)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
        at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:179)
        ... 15 more
Caused by: javax.naming.NameNotFoundException: While trying to lookup 'ejb.stateful.tcDataBase#com.thortech.xl.ejb.interfaces.tcDataBaseRemote' didn't find subcontext 'stateful'. Resolved 'ejb'
        at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1148)
        at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:253)
        at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:220)
        at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
        at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:667)
        at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
        at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
        at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
        at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)



Solution:

By reviewing the xlconfg.xml as mentioned in the previous post, there is a java.naming.provider.url parameter on line 33 that needed to be changed from port 7001 to port 14000



I hope this helps - Happy coding,
Thiago Leoncio

Monday, August 14, 2017

Common OIM errors during development

Some common errors and fixes for OIM Development I would like to share today

=========

ERROR:---

=========

getOIMConnection() : Start

Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jrf/PortabilityLayerException

at TestConnection.getOIMConnection(TestConnection.java:52)

at TestConnection.main(TestConnection.java:67)

Caused by: java.lang.ClassNotFoundException: oracle.jrf.PortabilityLayerException

at java.net.URLClassLoader.findClass(URLClassLoader.java:382)

at java.lang.ClassLoader.loadClass(ClassLoader.java:418)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)

at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

... 2 more


  FIX:

  ADD TO THE PROJECT LIBRARY:

  scp oracle@thiagoserver.com:/u00/ora/middleware/oracle_common/modules/oracle.jrf_11.1.1/jrf-api.jar .

=========

ERROR:---

=========

  Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/jndi/JndiTemplate

  at oracle.iam.platform.OIMClient.<init>(OIMClient.java:104)

  at TestConnection.getOIMConnection(TestConnection.java:52)

  at TestConnection.main(TestConnection.java:67)

  Caused by: java.lang.ClassNotFoundException: org.springframework.jndi.JndiTemplate

  at java.net.URLClassLoader.findClass(URLClassLoader.java:382)

  at java.lang.ClassLoader.loadClass(ClassLoader.java:418)

  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)

  at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

  ... 3 more


FIX: ADD TO THE PROJECT LIBRARY :

spring.jar

=========

ERROR:---

=========

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

at org.springframework.jndi.JndiTemplate.<init>(JndiTemplate.java:44)

at oracle.iam.platform.OIMClient.<init>(OIMClient.java:104)

at TestConnection.getOIMConnection(TestConnection.java:52)

at TestConnection.main(TestConnection.java:67)

Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

at java.net.URLClassLoader.findClass(URLClassLoader.java:382)

at java.lang.ClassLoader.loadClass(ClassLoader.java:418)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)

at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

... 4 more

FIX: ADD TO THE PROJECT LIBRARY :

commons-logging.jar from design console ext folder.


/u01/app/oracle/middleware/Oracle_OIM1/designconsole/ext/commons-logging.jar


I hope these fixes help everybody and happy coding!

Thiago Leoncio.

Saturday, August 12, 2017

How to use RabbitMQ


What is RabbitMQ?

RabbitMQ is an Erlang-based message broker that natively speaks AMQP 0.9.1. It implements all the AMQP 0.9.1 concepts of messages, queues, exchanges, bindings, virtual hosts, producers and consumers within the broker application.

In the diagram below, "P" is our producer and "C" is our consumer. The box in the middle is a queue - a message buffer that RabbitMQ keeps on behalf of the consumer.

In short, a broker can be divided up into virtual hosts (mainly for administrative simplicity). Each one of these virtual hosts can have some queues and exchanges associated with it and bindings can be used to attach a transfer to a queue or queues. Those transactions can be direct exchanges (passing a message on to a bound queue determined by a routing key), fanout exchanges (sending all messages onto all bound queues) or header exchanges (sending messages onwards based on matching fields in the header).

The developers have added their own set of extensions to the RabbitMQ mix though. Exchanges can be bound to other trades to create richer routing, improved mechanisms for tracking message delivery, time-to-live settings for queues and messages and more, with a focus on being an efficient, balanced messaging platform. Add to that the RabbitMQ implementation which gives you control of the performance/reliability ratio, clustering with high availability queues, a web-based Admin UI and a plugin extension system for protocols and other functionality.

What is Compose RabbitMQ?

We've taken RabbitMQ and created a Compose deployment of it which delivers the best of RabbitMQ for most users. Using three nodes, clustered together and operating in a high availability mode as a single logical broker; each node mirrors the cluster's configuration. Access to the cluster is, as with all Compose offerings, managed through a pair of haproxy TCP portals which are whitelisting and SSL supported. With Compose RabbitMQ you can move your interapplication connection infrastructure to the cloud where your applications live without having to add it to the services you directly manage and maintain.


If you want to check it out now and don't have a Compose account just sign up for a Compose account and select RabbitMQ as your first service. If you already have a Compose account, go to the Compose Console and choose "Create Deployment" and RabbitMQ to get your RabbitMQ on Compose.

Connecting to Compose for RabbitMQ

You can connect to your service using the credentials that are created along with the service, or with the connection strings and command line that are provided in the Overview tab of your service dashboard.

Connecting a Docker application to Compose for RabbitMQ

To connect a Docker container application to your service, use the credentials that are created along with the service. You can find information on how to connect a Docker container application to a Compose for RabbitMQ service in Connecting to Docker Application.

Connecting to Compose for RabbitMQ from outside the container

If you want to connect to Compose for RabbitMQ from outside of the container, you can use the provided connection strings or command line. You can find information on how to connect in Connecting an external application.

Example of Docker compose for RabbitMQ:
frontend:
  build: ./example-docker-services-frontend
  ports:
    - "4321:4321"
  links:
    - rabbitmq
    - postgres
  environment:
    - AMPQ_ADDRESS=amqp://rabbitmq:4561
    - DATABASE_URL=postgres://postgres:mysecretpassword@postgres:4321
  volumes:
    - ./example-docker-services-frontend/:/app
grader:
  build: ./example-docker-services-grader
  links:
    - rabbitmq
  environment:
    - AMPQ_ADDRESS=amqp://rabbitmq:4561
  volumes:
    - ./example-docker-services-grader/:/app

postgres:
image: postgres:latest
ports:
- 4321

rabbitmq:
  image: rabbitmq
  ports:
    - 4561

  environment:
    - POSTGRES_PASSWORD=mysecretpassword
    - POSTGRES_USER=postgres




I hope this helps and Happy coding,

Thiago Leoncio.