Can't deploy a war project on glassfish - java

I'm sorry so when I deploy the project in the local galssfish of netbeans ( start glassfish from netbeans I got the result that i want , the web service can got the data from mysql ( here is the url : http://localhost:8085/ServerSide/webresources/credit) but when I start glassfish from the comand line and deploy the .war of the project to see if the project can work in another local , with the same link (8085/ServerSide/webresources/credit) i got this error
root cause
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean
root cause
javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No database selected
Error Code: 1046
Call: SELECT id_Credit, AGENCE FROM credit
Query: ReadAllQuery(referenceClass=Credit sql="SELECT id_Credit, AGENCE FROM credit")
root cause
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No database selected
Error Code: 1046
Call: SELECT id_Credit, AGENCE FROM credit
Query: ReadAllQuery(referenceClass=Credit sql="SELECT id_Credit, AGENCE FROM credit")
root cause
java.sql.SQLException: No database selected
At first time when when i want to deploy the .war in glassfish i have this error
Error occurred during deployment: Exception while preparing the app : Invalid resource : bd__pm. Please see server.log for more details
but I resolve this when I create a new jdbc connection pool and a jdbc ressource with the same name in my glassfish-resources.xml

I have resolved it this problem, here is the method :
first delete the jdbc resources and jdbc connection pool that i have create manually and i deploy the project.war with the comman line and add the glassfish-resources.xml like this:
cd C:\Program Files\glassfish\glassfish\bin
asadmin> start-domain
asadmin> deploy ...\project.war
asadmin> add-resources ...\glassfish-resources.xml
asadmin> restart-domain

Related

java.sql.SQLException: Cannot load JDBC driver class 'oracle.jdbc.OracleDriver'

We have deployed our application on tomcat server.
Java version - 1.8
Sometime our application is impacted with the error :
SEVERE [main] org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans Exception processing Global JNDI Resources
javax.naming.NamingException: Unexpected exception resolving reference [Root exception is java.sql.SQLException: Cannot load JDBC driver class 'oracle.jdbc.OracleDriver']
But whenever we restart the server, it will resolved.
We get this issue once in two days.
Any help in this is appreciated .

Where is the cause of: Error Connecting to Glassfish Server?

I'm running into the following error when trying to deploy to Glassfish from IntellIJ IDEA, but I can't work out where to look first to find the issue.
Error running 'Glassfish Dev'
Error Connecting to Glassfish Server.
Exception occurred : java.lang.NullPointerException
Exception message : null
This is Glassfish 3.1, the configuration used to work but has recently stopped, I can't work out if the issue should be investigated within the Glassfish server or the local project + config.

SQLException stack trace

So I got sort of strange situation. I have Spring webapp and in it I have JNDI datasource that I have defined in tomcat's server.xml to connect to mysql database
I have mysql-connector-java 5.1.2 in my Maven pom.
Application works when I start it from localhost, but when I deploy it to remote tomcat it is not getting the call to the database.
This Exception occurs :
Couldnt execute sql CALL shareholders_company_list(?)
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Unable to create correct SQLException class instance, error class/codes may be incorrect. Reason:
** BEGIN NESTED EXCEPTION **
java.sql.SQLException
MESSAGE: Can't instantiate required class due to java.lang.ClassNotFoundException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException
STACKTRACE:
java.sql.SQLException: Can't instantiate required class due to java.lang.ClassNotFoundException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException
Is there away to avoid this ClassNotFoundException, so that I can get full stack trace, since it seems that explicit error why this happens is in MySQLNonTransientConnectionException, and I can't seem to reach it.
import required version(if you don't have any preference go for latest) of mysql-connector-java-latestVersion.jar under tomcat\lib

Deploying java project to remote glassfish server

We have a project made in netbeans 7.3 and are about to deploying this to a remote glassfish server, everything is configured and set up properly and the connection pools for our project are also generated in glassfish.
Currently we are getting this error when deploying to the remote server:
deploy?DEFAULT=D:\SVN\PTS62\Applicaties\Rekeningrijderwebsite\RekeningRijder\dist\RekeningRijder.war&name=RekeningRijder&contextroot=/RekeningRijder&force=true
failed on GlassFish Server 3+
Error occurred during deployment: Exception while preparing the app :
Exception [EclipseLink-4002] (Eclipse Persistence Services -
2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a
connection. Cause: Class name is wrong or classpath is not set for :
com.mysql.jdbc.jdbc2.optional.MysqlDataSource
Error Code: 0. Please see server.log for more details.
And the message the server generates:
Caused by: javax.resource.ResourceException: Class name is wrong or
classpath is not set for :
com.mysql.jdbc.jdbc2.optional.MysqlDataSource
at com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:292)
at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:114)
at com.sun.gjc.spi.ManagedConnectionFactory.getDataSource(ManagedConnectionFactory.java:1307)
at com.sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.java:163)
at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:102)
at com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:87)
... 62 more
Google wasn't very helpfull before, so hopefully you guys/girls can help me
Thanks in advance!
You may need a mysql / java connector.
You can find it there. Extract the mysql-connector-java .jar from the archive. Then place it into the glassfish external lib directory {INSTALL DIR}/glassfish/domains/domain1/lib/ext.
Restart your glassfish server.
There are more details on this answer. If that's not what you are looking for, or if it doesn't work, tell us. #+
Right, you just lack mysql lib, just find and download mysql-connector-java-5.x.x-bin.jar copy to E:\Projects\glassfish3.1.1\glassfish\lib then restart server and enjoy !!!

Error with jdbc mysql connections with jasper server

I am using jasper server CP 5.0.0. I have configured the data source properties like this
Set Data Source Type and Properties
Driver (required):com.mysql.jdbc.Driver
URL (required):jdbc:mysql://localhost:3306/jasperserver
The connection is failed when clicked on test connection
When I am running the report I am getting a error
Error Message
com.jaspersoft.jasperserver.api.JSExceptionWrapper: com.mysql.jdbc.Driver
Error Message
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Error Trace
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at
I have been searching this for a long time with no success.
You should add mysql drivers jar file to the build path of your project.

Categories

Resources