• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.lang.Exception: Attempted to use a 5.0 DataSource outside of a 2.3 servlet

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi 2 all

I am using WS RAD 6.0 for struts J2EE Application.In my application I have used JNDI. While executing the application it throws

com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is java.lang.Exception: Attempted to use a 5.0 DataSource outside of a 2.3 servlet]

Although Datasource test was successful in Application server (when i was creating datasource )

in console it display:

[2/24/06 14:08:31:732 IST] 0000002b ConnectionFac E J2CA0106E: A 5.0 DataSource was attempted to be used in a WebModule that was not level 2.3.
[2/24/06 14:08:31:748 IST] 0000002b Helpers W NMSV0605W: A Reference object looked up from the context "localhostNode01Cell/nodes/localhostNode01/servers/server1" with the name "jdbc/mydatasource2" was sent to the JNDI Naming Manager and an exception resulted. Reference data follows:
Reference Factory Class Name: com.ibm.ejs.j2c.ConnectionFactoryBuilderImpl
Reference Factory Class Location URLs: <null>
Reference Class Name: javax.resource.cci.ConnectionFactory
Type: connectorName
Content: Oracle JDBC Driver DataSource
Type: classpath
Content: D:\IBM\Rational\SDP\6.0\runtimes\base_v6/lib/rsadapter.rar;D:\IBM\Rational\SDP\6.0\runtimes\base_v6/lib/rsadapter.rar
Type: FactoryJndiName
Content: jdbc/mydatasource2
Address Type: dd
AddressContents: ffffffac ffffffed 0 5 73 72 0 25 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 52 65 73 6f 75 72 63 65 ...
Address Type: miscProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 14 6a 61 76 61 2e 75 74 69 6c 2e 50 72 6f 70 65 72 74 69 65 73 39 12 ffffffd0 7a ...
Address Type: poolProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 27 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 43 6f 6e 6e 65 63 74 6f ...
Address Type: configProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 23 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 43 6f 6e 6e 65 63 74 6f ...
Address Type: mmProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 14 6a 61 76 61 2e 75 74 69 6c 2e 50 72 6f 70 65 72 74 69 65 73 39 12 ffffffd0 7a ...
Address Type: dsProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 14 6a 61 76 61 2e 75 74 69 6c 2e 50 72 6f 70 65 72 74 69 65 73 39 12 ffffffd0 7a ...
Address Type: mcfProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 2d 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 4d 61 6e 61 67 65 64 43 ...
Address Type: mbeanProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 1a 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 4d 42 65 61 6e 50 72 6f ...

Exception data follows:
java.lang.Exception: Attempted to use a 5.0 DataSource outside of a 2.3 servlet
at com.ibm.ejs.j2c.ConnectionFactoryBuilderImpl.validServlet(ConnectionFactoryBuilderImpl.java:1109)
at com.ibm.ejs.j2c.ConnectionFactoryBuilderImpl.getCMConfigData(ConnectionFactoryBuilderImpl.java:730)
at com.ibm.ejs.j2c.ConnectionFactoryBuilderImpl.getObjectInstance(ConnectionFactoryBuilderImpl.java:330)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:314)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:874)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:681)
at com.ibm.ws.naming.jndicos.CNContextImpl.processResolveResults(CNContextImpl.java:1969)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1824)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1737)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1444)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1324)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:144)
at javax.naming.InitialContext.lookup(InitialContext.java:361)
at org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.java:313)
at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:571)
at com.infra.persist.CastorTransactionFactory.createTransaction(CastorTransactionFactory.java:83)
at com.infra.persist.CastorTransactionFactory.getTransaction(CastorTransactionFactory.java:77)
at com.util.TransactionHandler.openTransaction(TransactionHandler.java:34)
at com.actionmanager.NumberSearchAction.execute(NumberSearchAction.java:58)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2837)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java(Compiled Code))
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java(Compiled Code))
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java(Compiled Code))
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java(Compiled Code))
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))

[2/24/06 14:08:31:763 IST] 0000002b Helpers W NMSV0610I: A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
Context implementation: com.ibm.ws.naming.jndicos.CNContextImpl
Context method: lookupExt
Context name: localhostNode01Cell/nodes/localhostNode01/servers/server1
Target name: jdbc/mydatasource2
Other data: ""
Exception stack trace: com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. Root exception is java.lang.Exception: Attempted to use a 5.0 DataSource outside of a 2.3 servlet
at com.ibm.ejs.j2c.ConnectionFactoryBuilderImpl.validServlet(ConnectionFactoryBuilderImpl.java:1109)
at com.ibm.ejs.j2c.ConnectionFactoryBuilderImpl.getCMConfigData(ConnectionFactoryBuilderImpl.java:730)
at com.ibm.ejs.j2c.ConnectionFactoryBuilderImpl.getObjectInstance(ConnectionFactoryBuilderImpl.java:330)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:314)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:874)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:681)
at com.ibm.ws.naming.jndicos.CNContextImpl.processResolveResults(CNContextImpl.java:1969)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1824)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1737)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1444)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1324)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:144)
at javax.naming.InitialContext.lookup(InitialContext.java:361)
at org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.java:313)
at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:571)
at com.infra.persist.CastorTransactionFactory.createTransaction(CastorTransactionFactory.java:83)
at com.infra.persist.CastorTransactionFactory.getTransaction(CastorTransactionFactory.java:77)
at com.util.TransactionHandler.openTransaction(TransactionHandler.java:34)
at com.actionmanager.NumberSearchAction.execute(NumberSearchAction.java:58)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2837)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java(Compiled Code))
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java(Compiled Code))
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java(Compiled Code))
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java(Compiled Code))
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I've seen the error "Attempted to use a 5.0 DataSource ..." when I've created a version 5 datasource and my web.xml refers to the XML DTD for the Servlet 2.2 deployment descriptor


< !DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">;


I changed this to use the XML DTD for the Servlet 2.3 deployment descriptor.


< !DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">;
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you change all the web.xml files, or just the one under the web-inf directory, not the sub-directories
[ January 04, 2007: Message edited by: Chris Moonan ]
 
Brian Hennessy
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chris
Each Web Application will have its own web.xml under the WEB-INF directory. I'm not sure why multiple web.xml files exist under sub directories for your webapp. Are the sub direcories created by yourself/another developer ?

The change only needs to be made in the web.xml which has a Datasource resource ref added and the datasource in question(identified by JNDI name) has been defined as a version 5 datasource.

Brian
reply
    Bookmark Topic Watch Topic
  • New Topic