Ich bin sehr neu zu Java-EE in der Schule und nach dem Versuch, mein Projekt, die perfekt funktioniert mit Datenbank-Verbindung in Netbeans IDE funktioniert. Ich habe versucht, die * .war Datei auf dem lokalen Host-Server ohne das Öffnen von Netbeans IDE (Server gestartet mit Befehl als Admin Start-Domain Domain1 und die * .war Datei ist in der Anwendungsliste) und nach I starte das Projekt im localhost: 8080, die Datenbankverbindung ist fehlgeschlagen und meine Web-App würde nicht funktionieren.Nach der Bereitstellung von WAR-Datei, Verbindung mit Datenbank in Glassfish
Hat jemand eine Idee, wie man es löst? Exception picture
Server Log:
[2016-04-11T16:24:50.888+0800] [Payara 4.1] [SEVERE] [] [] [tid: _ThreadID=40 _ThreadName=admin-listener(3)] [timeMillis: 1460363090888] [levelValue: 1000] [[
Mon Apr 11 16:24:50 SGT 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.]]
[2016-04-11T16:36:55.713+0800] [Payara 4.1] [SEVERE] [] [] [tid: _ThreadID=40 _ThreadName=admin-listener(3)] [timeMillis: 1460363815713] [levelValue: 1000] [[
Mon Apr 11 16:36:55 SGT 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.]]
[2016-04-11T16:50:35.840+0800] [Payara 4.1] [INFO] [] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors] [tid: _ThreadID=27 _ThreadName=http-listener-1(5)] [timeMillis: 1460364635840] [levelValue: 800] [[
RAR7099: The mcf being used to allocate the connection and the MCF in the pool are not equal.]]
[2016-04-11T16:50:35.844+0800] [Payara 4.1] [WARNING] [] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource.allocator] [tid: _ThreadID=27 _ThreadName=http-listener-1(5)] [timeMillis: 1460364635844] [levelValue: 900] [[
RAR5038:Unexpected exception while creating resource for pool foodPool. Exception : javax.resource.spi.SecurityException: No password credential found]]
[2016-04-11T16:50:35.845+0800] [Payara 4.1] [WARNING] [] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors] [tid: _ThreadID=27 _ThreadName=http-listener-1(5)] [timeMillis: 1460364635845] [levelValue: 900] [[
RAR5117 : Failed to obtain/create connection from connection pool [ foodPool ]. Reason : com.sun.appserv.connectors.internal.api.PoolingException: No password credential found]]
[2016-04-11T16:50:35.846+0800] [Payara 4.1] [WARNING] [] [javax.enterprise.resource.resourceadapter.com.sun.gjc.spi] [tid: _ThreadID=27 _ThreadName=http-listener-1(5)] [timeMillis: 1460364635846] [levelValue: 900] [[
RAR5114 : Error allocating connection : [No password credential found]]]
[2016-04-11T16:50:35.848+0800] [Payara 4.1] [INFO] [] [] [tid: _ThreadID=27 _ThreadName=http-listener-1(5)] [timeMillis: 1460364635848] [levelValue: 800] [[
No password credential found]]
[2016-04-11T16:50:35.849+0800] [Payara 4.1] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=27 _ThreadName=http-listener-1(5)] [timeMillis: 1460364635849] [levelValue: 900] [[
StandardWrapperValve[login]: Servlet.service() for servlet login threw exception
java.lang.NullPointerException
at servlet.login.doPost(login.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Unknown Source)
]]
Verbindung Servlet:
package object;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Richard
*/
public class connection {
private InitialContext ctx;
public InitialContext getCtx() {
return ctx;
}
public void setCtx(InitialContext ctx) {
this.ctx = ctx;
}
public DataSource getDs() {
return ds;
}
public void setDs(DataSource ds) {
this.ds = ds;
}
public Connection getConn() {
return conn;
}
public void setConn(Connection conn) {
this.conn = conn;
}
public Statement getStmt() {
return stmt;
}
public void setStmt(Statement stmt) {
this.stmt = stmt;
}
public ResultSet getRs() {
return rs;
}
public void setRs(ResultSet rs) {
this.rs = rs;
}
private DataSource ds;
private Connection conn;
private Statement stmt;
private ResultSet rs;
public connection(){
try{
ctx = new InitialContext();
ds = (DataSource)ctx.lookup("jdbc/fastfood");
}catch(NamingException ex)
{
}
}
public DataSource getDataSource(){
return ds;
}
}
injizieren bitte zeige deine Ausnahme hier –
@AhmedGamal hinzugefügt die Ausnahme Bild – user3469300
Nullzeiger Ausnahme, warum Sie sicherstellen, dass die Fehler mit DB-Verbindung, laden Sie das Serverprotokoll bitte –