Play Framework太多打开的文件

时间:2016-12-15 06:06:51

标签: java spring hibernate playframework

我们使用Play!框架2.3与Java。 我们在生产中遇到一个主要问题,即阻止我们的应用程序运行并向客户发送数据。

我们得到了可怕的"太多的打开文件"错误,并用谷歌搜索,但不知道如何解决这个问题!它发生在每两天,这是错误:

2016-12-14 02:18:01.098 [play-akka.actor.default-dispatcher-71619] ERROR application - 

 ! @72c9gl98c - Internal server error, for (GET) [/gettodaysfixturesbycompid/886] ->

play.api.Application$$anon$1: Execution exception[[CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection]]
    at play.api.Application$class.handleError(Application.scala:296) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.10-2.3.4.jar:2.3.4]
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.10-2.3.4.jar:2.3.4]
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.10-2.3.4.jar:2.3.4]
    at scala.Option.map(Option.scala:145) [scala-library.jar:na]
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3.applyOrElse(PlayDefaultUpstreamHandler.scala:320) [play_2.10-2.3.4.jar:2.3.4]
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3.applyOrElse(PlayDefaultUpstreamHandler.scala:316) [play_2.10-2.3.4.jar:2.3.4]
    at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:344) [scala-library.jar:na]
    at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:343) [scala-library.jar:na]
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) [scala-library.jar:na]
    at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:46) [play-iteratees_2.10-2.3.4.jar:2.3.4]
    at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:40) [scala-library.jar:na]
    at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:248) [scala-library.jar:na]
    at scala.concurrent.Promise$class.complete(Promise.scala:55) [scala-library.jar:na]
    at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:153) [scala-library.jar:na]
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:23) [scala-library.jar:na]
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41) [akka-actor_2.10-2.3.4.jar:na]
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393) [akka-actor_2.10-2.3.4.jar:na]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [scala-library.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [scala-library.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [scala-library.jar:na]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [scala-library.jar:na]
Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
    at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:430) ~[spring-orm-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373) ~[spring-tx-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:438) ~[spring-tx-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:261) ~[spring-tx-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) ~[spring-tx-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) ~[spring-aop-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    at com.sun.proxy.$Proxy31.getTodaysFixturesByCompId(Unknown Source) ~[na:na]
    at controllers.APIController.getTodaysFixturesByCompId(APIController.java:1295) ~[classes/:na]
    at Routes$$anonfun$routes$1$$anonfun$applyOrElse$25$$anonfun$apply$231.apply(routes_routing.scala:804) ~[classes/:na]
    at Routes$$anonfun$routes$1$$anonfun$applyOrElse$25$$anonfun$apply$231.apply(routes_routing.scala:804) ~[classes/:na]
    at play.core.Router$HandlerInvokerFactory$$anon$4.resultCall(Router.scala:264) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.core.Router$HandlerInvokerFactory$JavaActionInvokerFactory$$anon$15$$anon$1.invocation(Router.scala:255) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:55) ~[play_2.10-2.3.4.jar:2.3.4]
 at play.GlobalSettings$1.call(GlobalSettings.java:67) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.core.j.JavaAction$$anonfun$11.apply(JavaAction.scala:82) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.core.j.JavaAction$$anonfun$11.apply(JavaAction.scala:82) ~[play_2.10-2.3.4.jar:2.3.4]
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) [scala-library.jar:na]
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) [scala-library.jar:na]
    at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:40) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:46) [play-iteratees_2.10-2.3.4.jar:2.3.4]
    at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:32) ~[play_2.10-2.3.4.jar:2.3.4]
    at scala.concurrent.impl.Future$.apply(Future.scala:31) ~[scala-library.jar:na]
    at scala.concurrent.Future$.apply(Future.scala:485) ~[scala-library.jar:na]
    at play.core.j.JavaAction$class.apply(JavaAction.scala:82) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.core.Router$HandlerInvokerFactory$JavaActionInvokerFactory$$anon$15$$anon$1.apply(Router.scala:252) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.utils.Threads$.withContextClassLoader(Threads.scala:21) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:129) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:128) ~[play_2.10-2.3.4.jar:2.3.4]
    at scala.Option.map(Option.scala:145) [scala-library.jar:na]
    at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:128) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:121) ~[play_2.10-2.3.4.jar:2.3.4]
    at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:483) ~[play-iteratees_2.10-2.3.4.jar:2.3.4]
    at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:483) ~[play-iteratees_2.10-2.3.4.jar:2.3.4]
    at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:519) ~[play-iteratees_2.10-2.3.4.jar:2.3.4]
    at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:519) ~[play-iteratees_2.10-2.3.4.jar:2.3.4]
    at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:496) ~[play-iteratees_2.10-2.3.4.jar:2.3.4]
    at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:496) ~[play-iteratees_2.10-2.3.4.jar:2.3.4]
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) [scala-library.jar:na]
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) [scala-library.jar:na]
    ... 6 common frames omitted
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763) ~[hibernate-entitymanager-4.3.6.Final.jar:4.3.6.Final]
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677) ~[hibernate-entitymanager-4.3.6.Final.jar:4.3.6.Final]
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1771) ~[hibernate-entitymanager-4.3.6.Final.jar:4.3.6.Final]
    at org.hibernate.jpa.internal.TransactionImpl.begin(TransactionImpl.java:64) ~[hibernate-entitymanager-4.3.6.Final.jar:4.3.6.Final]
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.beginTransaction(HibernateJpaDialect.java:159) ~[spring-orm-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:380) ~[spring-orm-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    ... 47 common frames omitted
Caused by: org.hibernate.exception.JDBCConnectionException: Could not open connection
    at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:132) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:235) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:171) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
    at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
    at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:162) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1435) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
    at org.hibernate.jpa.internal.TransactionImpl.begin(TransactionImpl.java:61) ~[hibernate-entitymanager-4.3.6.Final.jar:4.3.6.Final]
    ... 49 common frames omitted
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    at sun.reflect.GeneratedConstructorAccessor87.newInstance(Unknown Source) ~[na:na]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_31]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[na:1.8.0_31]
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:377) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1036) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:338) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2232) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2265) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at sun.reflect.GeneratedConstructorAccessor44.newInstance(Unknown Source) ~[na:na]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_31]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[na:1.8.0_31]
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:377) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:395) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at java.sql.DriverManager.getConnection(DriverManager.java:664) ~[na:1.8.0_31]
    at java.sql.DriverManager.getConnection(DriverManager.java:208) ~[na:1.8.0_31]
    at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:153) ~[spring-jdbc-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:144) ~[spring-jdbc-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:155) ~[spring-jdbc-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:120) ~[spring-jdbc-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:139) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
    at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:380) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:228) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
    ... 54 common frames omitted
Caused by: java.net.SocketException: Too many open files
    at java.net.Socket.createImpl(Socket.java:460) ~[na:1.8.0_31]
    at java.net.Socket.getImpl(Socket.java:520) ~[na:1.8.0_31]
    at java.net.Socket.setTcpNoDelay(Socket.java:980) ~[na:1.8.0_31]
    at com.mysql.jdbc.StandardSocketFactory.configureSocket(StandardSocketFactory.java:134) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:205) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:297) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    ... 74 common frames omitted

这导致数据库连接失败,并且它从那里开始失控。

当我跑步时:

lsof | grep <play_java_pid>

我得到了很多这些:

java       88655  88792       root  txt   unknown                           /proc/88655/task/88792/exe (readlink: Permission denied)
java       88655  88792       root NOFD                                     /proc/88655/task/88792/fd (opendir: Permission denied)
java       88655  88793       root  cwd   unknown                           /proc/88655/task/88793/cwd (readlink: Permission denied)
java       88655  88793       root  rtd   unknown                           /proc/88655/task/88793/root (readlink: Permission denied)
java       88655  88793       root  txt   unknown                           /proc/88655/task/88793/exe (readlink: Permission denied)
java       88655  88793       root NOFD                                     /proc/88655/task/88793/fd (opendir: Permission denied)
java       88655  88794       root  cwd   unknown                           /proc/88655/task/88794/cwd (readlink: Permission denied)
java       88655  88794       root  rtd   unknown                           /proc/88655/task/88794/root (readlink: Permission denied)
java       88655  88794       root  txt   unknown                           /proc/88655/task/88794/exe (readlink: Permission denied)
java       88655  88794       root NOFD                                     /proc/88655/task/88794/fd (opendir: Permission denied)

以下是尝试执行的实际API调用:

public Result getTodaysFixturesByCompId(Long compId) throws JSONException, ParseException {
    Logger.debug("Get Todays Fixtures by compId: " + compId);
    List<Object[]> fixtures = fixturesService.getTodaysFixturesByCompId(compId);

    // Loop through fixtures and create JSONObject response
    ArrayList<JSONObject> fixList = new ArrayList<JSONObject>();

    for (int i = 0; i < fixtures.size(); i++) {

        JSONObject fixture = new JSONObject();
        fixture.put("id", fixtures.get(i)[0]);
        fixture.put("fixture_date", fixtures.get(i)[1]);

        String fixtureDate = "" + fixtures.get(i)[1];
        String fixtureTime = "" + fixtures.get(i)[2];

        Logger.debug("fixtureDateTime: " + fixtureDate + " " + fixtureTime);

        SimpleDateFormat sdf =  new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        sdf.setTimeZone(TimeZone.getTimeZone("Europe/London"));
        Date date = sdf.parse(fixtureDate + " " + fixtureTime);

        Logger.debug("Parsed date: " + date);

        Time timeValue = new Time(date.getTime()); 

        fixture.put("fixture_time", timeValue);
        fixture.put("venue", fixtures.get(i)[3]);
        fixture.put("country", fixtures.get(i)[4]);
        fixture.put("team_id_1", fixtures.get(i)[5]);
        fixture.put("team_id_2", fixtures.get(i)[6]);
        fixture.put("competition_id", fixtures.get(i)[7]);
        fixture.put("sheets_processed", fixtures.get(i)[8]);
        fixture.put("team_name_1", fixtures.get(i)[9]);
        fixture.put("team_name_2", fixtures.get(i)[10]);

        fixList.add(fixture);
    }

    setAllowAccessOrigin();

    return play.mvc.Controller.ok(fixList.toString());
}

然后是我的DataConfig类:

public class DataConfig {

@SuppressWarnings("serial")
@Bean
public EntityManagerFactory entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setShowSql(false);
    vendorAdapter.setGenerateDdl(true);
    LocalContainerEntityManagerFactoryBean entityManagerFactory = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactory.setPackagesToScan("models");
    entityManagerFactory.setJpaVendorAdapter(vendorAdapter); 
    entityManagerFactory.setDataSource(dataSource());
    entityManagerFactory.afterPropertiesSet();      
    return entityManagerFactory.getObject();
}

@Bean
public PlatformTransactionManager transactionManager() {
    JpaTransactionManager transactionManager = new JpaTransactionManager(entityManagerFactory());

    return transactionManager;
}

@Bean
public DataSource dataSource() {
    final DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(Play.application().configuration().getString("db.default.driver"));
    dataSource.setUrl(Play.application().configuration().getString("db.default.url"));
    dataSource.setUsername(Play.application().configuration().getString("db.default.user"));
    dataSource.setPassword(Play.application().configuration().getString("db.default.password"));
    return dataSource;
}

}

错误似乎出现在我的控制器的这一行:

List<Object[]> fixtures = fixturesService.getTodaysFixturesByCompId(compId);

fixturesService方法:

public List<Object[]> getTodaysFixturesByCompId(Long compId) {
    String jpql = "select *,(SELECT name FROM teams WHERE id=team_id_1) AS teamname1,(SELECT name FROM teams WHERE id=team_id_2) AS teamname2 from fixtures WHERE (DATE(fixture_date)=DATE(NOW()) AND (competition_id='" + compId + "')) ORDER BY fixture_date,fixture_time";
    javax.persistence.Query query = em.createNativeQuery(jpql);
    List<Object[]> results = query.getResultList();
    return results;
}

请帮帮忙?

1 个答案:

答案 0 :(得分:0)

泄漏数据库连接。它不在您描述的代码中,尝试查看您打开与DB的连接以及关闭它的位置。