Posts

Showing posts with the label glassfish

Configuring Oracle XE connection pool in Glassfish and Using JPA

To setup an Oracle Datasource in Glassfish, follow these steps: 1. Download and copy the Oracle JDBC driver (ojdbc14.jar ) to /glassfish/domains/domain1/lib/ext directory. 2. Start Glassfish. 3. Login to the admin interface and create a JDBC Connection Pool.     Delete all properties, and add following properties:     * user - set this to Oracle userid     * password - set this to Oracle password     * URL - set this to the URL, example jdbc:oracle:thin:@localhost:1521:xe.     * xa-driver-does-not-support-non-tx-operations - set this to true. Test the connection pool using ping. 4. Create a JDBC DataSource using the Connection Pool. If in case of Oracle major version error : javax.persistence.PersistenceException: org.hibernate.HibernateException: unknown Oracle major version [11] The fix for the error is add <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/...

Reading properties file at glassfish starttime

Goto JVM options (server-config) and add this line -Dproperty.file.path=......filepath/einvoice.properties einvoice.properties: smtp.address = localhost ipcommerce.url = http://someipcommerceurl.com/ email.body = Plese check the attachment for invoice. email.subject = Invoice file.create.location = /home/shakeelstha/Interac\ Liferay\ Repo/invoice file.upload.location = /home/shakeelstha/Interac\ Liferay\ Repo/upload jasper.location = smtp.mail.password = smtp.mail.username = root mail.sender.address = Interac<shakeelshrestha@lftechnology.com> ContextListener.java package com.lftech.interac.listener; import com.lftech.interac.dto.EInvoiceProperty; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; /**  *  * @author shakeelstha  */ public class ContextListener implements ServletContextListener {   ...