0

我正在使用 HSQLDB + Glassfish + JPA + SpringMVC。我已经完成了 JNDI 映射,创建了连接池并将我的 HSQLDB.jar(2.2.4) 放在 Glassfish lib 文件夹中。

我能够成功部署应用程序。当我使用“localhost:8080/site”访问应用程序时,它会在 find 方法(Hibernate)上引发以下错误,如下所示。

请帮助解决这个问题。

INFO: [ERROR] 12:23:21 Ejb3Configuration - Container is providing a null PersistenceUnitRootUrl: discovery impossible

INFO: [ WARN] 12:23:21 Ejb3Configuration - hibernate.connection.autocommit = false break the EJB3 specification

INFO: PWC1412: WebModule[null] ServletContext.log():Initializing Spring FrameworkServlet 'mycompany'
INFO: [ WARN] 12:23:24 RuntimeEnvironmentPropertiesConfigurer - Unable to determine runtime environment, using default environment 'development'

INFO: WEB0671: Loading application [com.mycompany_site_war_1.0] at [/site]
INFO: com.mycompany_site_war_1.0 was successfully deployed in 206,384 milliseconds.
WARNING: StandardWrapperValve[mycompany]: PWC1406: Servlet.service() for servlet mycompany threw exception
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1952)
    at java.lang.String.substring(String.java:1925)
    at org.*******.core.catalog.dao.ProductDaoImpl.findProductByURI(ProductDaoImpl.java:392)
    at org.*******.core.catalog.service.CatalogServiceImpl.findProductByURI(CatalogServiceImpl.java:268)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

这是一个持久性问题还是其他......?

如果是持久性问题,需要检查什么......?

4

1 回答 1

0

它看起来像ProductDaoImpl.findProductByURI()直接调用String.substring()索引为-1. 因此,您应该详细查看您的代码以检查其根本原因。

于 2012-09-05T12:01:27.270 回答