cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with datasource

Former Member
0 Kudos

hi,

i am using hibernate in my netweaver with maxdb but it is giving below exception

Initial SessionFactory creation failed.org.hibernate.HibernateException: Could not find datasource

java.lang.NullPointerException

please helpme (if posible tell me the procedure)

my xmls.

1)Message.hbm.xml

<hibernate-mapping>

<class name="in.Message" table="TMP_MSGS">

<id name="id" type="long" column="ID" >

<generator class="assigned"/>

</id>

<property name="fname">

<column name="FIRSTNAME" />

</property>

<property name="lname">

<column name="LASTNAME"/>

</property>

<property name="email">

<column name="EMAIL"/>

</property>

</class>

</hibernate-mapping>

2)hibernate.cfg.xml

<hibernate-configuration>

<session-factory>

<property name="hibernate.connection.driver_class">com.sap.dbtech.jdbc.DriverSapDB</property>

<property name="hibernate.connection.url">jdbc:sapdb://10.10.0.201:50000/SAPJ2EDB</property>

<property name="hibernate.connection.username">SAPJ2EDB</property>

<property name="hibernate.connection.password">admin</property>

<property name="connection.datasource">J2E/SAPJ2EDB</property>

<property name="dialect">org.hibernate.dialect.SAPDBDialect</property>

<property name="show_sql">false</property>

<!-- Mapping files -->

<mapping resource="Message.hbm.xml"/>

</session-factory>

</hibernate-configuration>

Thanqqqq

Guru

Accepted Solutions (0)

Answers (2)

Answers (2)

kishorg
Advisor
Advisor
0 Kudos

Hi Guru ,

Replace

<property name="connection.datasource">J2E/SAPJ2EDB</property>

with

<property name="connection.datasource">jdbc/SAPJ2EDB</property>

here the datasource name u have to look up with

this way <b>jdbc/SAPJ2EDB</b>

i think this is the problem.

SAPJ2EDB , is the default DataSource name for Max DB .

HI Guru ,

what u have to do here is ,(Main things to note)

1)Create the hibernate.cfg.xml file with ur custom configuration. just keep this within your WEB-INF/classes

of your Web Module project.(Related with this sample application).

2) create ur Message class .(code in example).

3)Create Message.hbm.xml with prefered configuration and put it in the same folder of your class.

Regards

Kishor Gopinthan

Former Member
0 Kudos