Mujahed Ashfaq
Mujahed Ashfaq

Reputation: 23

Connecting to jndi within websphere error

I'm in a little debacle and was looking at any assistance

I have a simple JPA application that is connected to a database and am receiving an error in websphere that I'm failing to understand.

[1/25/16 10:55:46:950 CST] 0000001c SystemOut 0  CalSMTJPA  INFO
[WebContainer : 0] openjpa.Runtime - Starting OpenJPA 1.2.1-SNAPSHOT+OPENJPA-679-Final 
[1/25/16 10:55:46:950 CST] 0000001c SystemOut O 15  CalSMTJPA  INFO   [WebContainer : 0] 
openjpa.jdbc.JDBC - Using dictionary class "com.ibm.ws.persistence.jdbc.sql.SQLServerDictionary" (Microsoft SQL Server 11.00.5058 ,Microsoft SQL Server JDBC Driver 2.0 2.0.1803.100). 
[1/25/16 10:55:46:950 CST] 0000001c servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: 
Uncaught exception created in one of the service methods of the servlet /Home.jsp in application CalSMTEAR. 
Exception created : <openjpa-1.2.1-SNAPSHOT+OPENJPA-679-Final-r422266:746282 nonfatal general error>

****org.apache.openjpa.persistence.PersistenceException: For input string: "JDBC"****

at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:196)
at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
at com.ibm.ws.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:42)
at com.ibm.ws.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:27)
at entities.controller.PlatformsManager.getEntityManager(PlatformsManager.java:43)
at entities.controller.PlatformsManager.getPlatforms(PlatformsManager.java:136)
at com.ibm._jsp._Home._jspService(_Home.java:90)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1461)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:793)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:444)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:234)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.handleRequest(AbstractJSPExtensionProcessor.java:337)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3622)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:927)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1566)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:175)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
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:1527)

Caused by: java.lang.NumberFormatException: For input string: "JDBC"

Upvotes: 1

Views: 234

Answers (1)

F Rowe
F Rowe

Reputation: 2064

The error from OpenJPA appears to be caused by it incorrectly trying to use the dictionary for MS SQLServer to connect to the database you're using. If you're specifying the

<property name="openjpa.jdbc.DBDictionary" value=" org.apache.openjpa.jdbc.sql.SQLServerDictionary "/>

property in your persistence.xml, you need to update that with the correct dictionary for the database and driver you're using, see http://openjpa.apache.org/builds/2.2.1/apache-openjpa/docs/ref_guide_dbsetup_dbsupport.html for details. If you're not specifying the property in your persistence.xml and letting OpenJPA try to auto-detect it, try specifying the property in your persistence.xml and assign it the appropriate value for the database vendor to which you're connecting.

Upvotes: 3

Related Questions