Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

Struts2+Spring+Hibernate+Oracle: ORA-12516 (too many connections)

scho

2008-11-24

Replies: Find Java Web Hosting

Author LoginPost Reply

Hey guys,

I'm using Struts2 with a little Spring and Hibernate to persist my object in
my oracle database. (I've followed the explanation in the book "Struts 2 in
action" by Donald Brown)

Normally, accessing my database isn't a problem. Hibernate saves my objects
and executes my queries against the database as well. But here's my problem:
I have to import a huge amount of data into my database via a CSV-File.
There are about 15.000 rows and each row has to be splitted into several
tables. After ~10 rows of processing an error occurs, which says: "Listener
refused the connection with the following error:

ORA-12516, TNS:listener could not find available handler with matching
protocol stack
The Connection descriptor used by the client was:
127.0.0.1:1521/XE

I'm pretty shure, it has something to do with the maximum number of
connections. If I increase this value, my programm processes more lines, but
still not enough.

Here is my applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:tx="http://www.springframework.org/schema/tx"
  xsi:schemaLocation="
  http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

  <bean
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"
/>

 <bean id="batchService" class="model.substances.services.BatchService" />
 <bean id="supplierService"
class="model.substances.services.SupplierService" />
 <bean id="chemicalInformationService"
class="model.substances.services.ChemicalInformationService" />
 <bean id="chemicalInformationNameService"
class="model.substances.services.ChemicalInformationNameService" />
 
   <bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="jpaVendorAdapter">
       <bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
          <property name="database" value="ORACLE" />
          <property name="showSql" value="true" />
       </bean>
    </property>
  </bean>
   
  <bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName"
value="oracle.jdbc.driver.OracleDriver" />
    <property name="url" value="jdbc:oracle:thin:@(protected)" />
    <property name="username" value="user" />
    <property name="password" value="password" />
  </bean>
 
  <bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="entityManagerFactory" ref="entityManagerFactory" />
  </bean>

  <tx:annotation-driven transaction-manager="transactionManager" />
</beans>

And here my Service-Class:

@Transactional
public class ChemicalInformationService implements
ChemicalInformationServiceInterface{
 
 public void save(ChemicalInformation chemicalInformation) {
   if (chemicalInformation.getId() == null) {
       // Create supplier
     entityManager.persist(chemicalInformation);
    } else {
       // Update supplier
     entityManager.merge(chemicalInformation);
    }
 }

 
 public ChemicalInformation find(int id) {
    return entityManager.find(ChemicalInformation.class, id);
  }
 
 public Collection<ChemicalInformation> findAll() {
   Query query = entityManager.createQuery("FROM ChemicalInformation");
   return query.getResultList();
 }
 
 private EntityManager entityManager;
 
 @PersistenceContext
  public void setEntityManager(EntityManager entityManager) {
   this.entityManager = entityManager;
  }
}

So, any idea, what's the reason for my problem? Again: For a limited number
of DB-Accesses, everything works fine.
--
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.