Welcome!

Java IoT Authors: Elizabeth White, Liz McMillan, Pat Romanski, Yeshim Deniz, Mehdi Daoudi

Related Topics: Java IoT

Java IoT: Blog Feed Post

ADF and WLS JNDI Configuration Errors

Don't get your JNDIs wrong

Another blog under the theme "let's document it so we don't get caught out again", which can also be tagged as "let's document it so others don't get caught out too".

In our Oracle JDeveloper 11g ADF applications at runtime, on occasion we encountered one of the following errors when running our applications under Oracle's WebLogic Server 10.3.2. I've included the beginning stack trace to assist Google searches into this page:

<Utils><buildFacesMessage> ADF: Adding the following JSF error message: JNDI failure. Unable to lookup Data Source at context jdbc/SomeJndi
oracle.jbo.DMLException: JBO-27200: JNDI failure. Unable to lookup Data Source at context jdbc/SomeJndi
at oracle.jbo.server.DBTransactionImpl.lookupDataSource(DBTransactionImpl.java:1414)
at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:309)
at oracle.jbo.common.ampool.DefaultConnectionStrategy.connect(DefaultConnectionStrategy.java:203)
at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolConnect(ApplicationPoolMessageHandler.java:553)
at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:409)
at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:8534)
at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4392)
at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2388)
at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2204)
at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3088)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:460)
at oracle.jbo.http.HttpSessionCookieImpl.useApplicationModule(HttpSessionCookieImpl.java:234)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:431)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:426)
at oracle.adf.model.bc4j.DCJboDataControl.initializeApplicationModule(DCJboDataControl.java:513)
at oracle.adf.model.bc4j.DCJboDataControl.getApplicationModule(DCJboDataControl.java:856)

..or..

Caused by: javax.naming.NameNotFoundException: Unable to resolve 'jdbc.SomeJndi'. Resolved 'jdbc'; remaining name 'SomeJndi'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:252)
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:214)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:393)
at javax.naming.InitialContext.lookup(InitialContext.java:392)

..or..

<Utils><buildFacesMessage> ADF: Adding the following JSF error message: Unable to resolve 'jdbc.SomeJndi'. Resolved 'jdbc'
javax.naming.NameNotFoundException: Unable to resolve 'jdbc.SomeJndi'. Resolved 'jdbc'; remaining name 'SomeJndi'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:252)
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:214)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:393)
at javax.naming.InitialContext.lookup(InitialContext.java:392)

All of these errors occur because of a misconfiguration of a JNDI in one or more of the following locations:

1) the datasource within your WebLogic Server
2) an Application Module's JDBC Data Source within your main ADF application
3) an Application Module's JDBC Data Source within a Bounded Task Flow added to your application via an ADF Library
4) an Application Module's property jbo.server.internal_connection within your main application
5) an Application Module's property jbo.server.internal_connection within a Bounded Task Flow added to your application via an ADF Library

As readers know the JNDI typically takes the form "jdbc/SomeJndi".

Essentially the JNDI for the data source in #1 must be consistent with #2 and #3 otherwise the JNDI lookup fails. In addition if you make use of the jbo.server.internal_connection Application Module property, you'll require a second datasource for #1 that is consistent with that specified in #4 and #5.

This may seem simple, but during a recent development we suffered repeated mistakes where the JNDI was misconfigured causing us large amounts of grief when we thought we had it "sorted". Take the following error message, see if you can spot the issue:

Caused by: javax.naming.NameNotFoundException: Unable to resolve 'jdbc.SomeJndi '. Resolved 'jdbc'; remaining name 'SomeJndi '


Somewhat oddly this error message converts the JNDI such that the forward slashes are replaced with a fullstop. However that's a red herring. Can you see the real error?

If you've looked closely you'll note the JNDI name has an additional space character at the end, something very difficult to visually detect. This resulted in the error above.

For us this particular misconfiguration happened in the worst of places too. Rather than a JNDI used by our main ADF application which would have fallen over straight away, it was used by a secondary ADF Library Bounded Task Flow Application Module's jbo.server.internal_connection setting. As such the application when running under no stress would work fine, but only when the specific Bounded Task Flow was called, and only when the specific Bounded Task Flow was under stress and needed to passivate to the ps_txn table did we see ADF throw the above errors. Before we realized what was going on, a large flapping red herring was that the application would occasionally throw:

JBO-28030: Could not insert row into table PS_TXN, collection id 24,026, persistent id 1" followed by "JBO-27200: JNDI failure. Unable to lookup Data Source at context jdbc/SomeJndi "

...followed by one of the JNDI connections above. But we could see that records were inserted into the ps_txn table regardless of the previous error, and via our own testing, logging into the associated database account specified for the jbo.server.internal_connection, the db user had all the correct database privileges for working with the ps_txn table. Eventually we tracked it back to the misconfigured JNDI, such that the main application with the correct JNDI was happily inserting into PS_TXN, but the secondary Bounded Task Flow JNDI was intermittently causing this issue.

Lesson learned. Don't get your JNDIs wrong.

Read the original blog entry...

More Stories By Chris Muir

Chris Muir, an Oracle ACE Director, senior developer and trainer, and frequent blogger at http://one-size-doesnt-fit-all.blogspot.com, has been hacking away as an Oracle consultant with Australia's SAGE Computing Services for too many years. Taking a pragmatic approach to all things Oracle, Chris has more recently earned battle scars with JDeveloper, Apex, OID and web services, and has some very old war-wounds from a dark and dim past with Forms, Reports and even Designer 100% generation. He is a frequent presenter and contributor to the local Australian Oracle User Group scene, as well as a contributor to international user group magazines such as the IOUG and UKOUG.

IoT & Smart Cities Stories
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
Druva is the global leader in Cloud Data Protection and Management, delivering the industry's first data management-as-a-service solution that aggregates data from endpoints, servers and cloud applications and leverages the public cloud to offer a single pane of glass to enable data protection, governance and intelligence-dramatically increasing the availability and visibility of business critical information, while reducing the risk, cost and complexity of managing and protecting it. Druva's...
BMC has unmatched experience in IT management, supporting 92 of the Forbes Global 100, and earning recognition as an ITSM Gartner Magic Quadrant Leader for five years running. Our solutions offer speed, agility, and efficiency to tackle business challenges in the areas of service management, automation, operations, and the mainframe.
The Jevons Paradox suggests that when technological advances increase efficiency of a resource, it results in an overall increase in consumption. Writing on the increased use of coal as a result of technological improvements, 19th-century economist William Stanley Jevons found that these improvements led to the development of new ways to utilize coal. In his session at 19th Cloud Expo, Mark Thiele, Chief Strategy Officer for Apcera, compared the Jevons Paradox to modern-day enterprise IT, examin...
With 10 simultaneous tracks, keynotes, general sessions and targeted breakout classes, @CloudEXPO and DXWorldEXPO are two of the most important technology events of the year. Since its launch over eight years ago, @CloudEXPO and DXWorldEXPO have presented a rock star faculty as well as showcased hundreds of sponsors and exhibitors! In this blog post, we provide 7 tips on how, as part of our world-class faculty, you can deliver one of the most popular sessions at our events. But before reading...
DSR is a supplier of project management, consultancy services and IT solutions that increase effectiveness of a company's operations in the production sector. The company combines in-depth knowledge of international companies with expert knowledge utilising IT tools that support manufacturing and distribution processes. DSR ensures optimization and integration of internal processes which is necessary for companies to grow rapidly. The rapid growth is possible thanks, to specialized services an...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
There are many examples of disruption in consumer space – Uber disrupting the cab industry, Airbnb disrupting the hospitality industry and so on; but have you wondered who is disrupting support and operations? AISERA helps make businesses and customers successful by offering consumer-like user experience for support and operations. We have built the world’s first AI-driven IT / HR / Cloud / Customer Support and Operations solution.
Codete accelerates their clients growth through technological expertise and experience. Codite team works with organizations to meet the challenges that digitalization presents. Their clients include digital start-ups as well as established enterprises in the IT industry. To stay competitive in a highly innovative IT industry, strong R&D departments and bold spin-off initiatives is a must. Codete Data Science and Software Architects teams help corporate clients to stay up to date with the mod...
Scala Hosting is trusted by 50 000 customers from 120 countries and hosting 700 000+ websites. The company has local presence in the United States and Europe and runs an internal R&D department which focuses on changing the status quo in the web hosting industry. Imagine every website owner running their online business on a fully managed cloud VPS platform at an affordable price that's very close to the price of shared hosting. The efforts of the R&D department in the last 3 years made that pos...