Estou tentando criar uma webservice com firebird. Fiz os códigos com base em uma videoaula de MySQL e fui tentando alterar para funcionar no firebird. Mas obviamente não deu certo. Vamos aos códigos:
Classe ConectaFirebird
:
package br.com.realsysten.SigadmWS;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConectaFirebird {
private static final String URL = "jdbc:firebird://localhost/SIGADM.FDB";
private static final String USER = "SYSDBA";
private static final String SENHA = "masterkey";
public static Connection obtemConexao() throws SQLException{
try {
Class.forName("com.firebird.jdbc.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return DriverManager.getConnection(URL, USER, SENHA);
}
}
Ele cai no ClassNotFoundException
.
no console aparece isto:
[INFO] Clustering has been disabled [WARN] Unable to instantiate deployer org.apache.axis2.deployment.ServiceDeployer; see debug logs for more details mai 20, 2016 12:01:19 PM org.apache.catalina.core.ApplicationContext log GRAVE: StandardWrapper.Throwable java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/resolver/URIResolver at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:128) at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:149) at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:585) at org.apache.axis2.deployment.RepositoryListener.init(RepositoryListener.java:264) at org.apache.axis2.deployment.RepositoryListener.init2(RepositoryListener.java:66) at org.apache.axis2.deployment.RepositoryListener.(RepositoryListener.java:61) at org.apache.axis2.deployment.DeploymentEngine.loadRepository(DeploymentEngine.java:152) at org.apache.axis2.deployment.WarBasedAxisConfigurator.getAxisConfiguration(WarBasedAxisConfigurator.java:233) at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64) at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:620) at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:471) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:828) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.apache.ws.commons.schema.resolver.URIResolver at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139) ... 30 more
mai 20, 2016 12:01:19 PM org.apache.catalina.core.StandardWrapperValve invoke GRAVE: Allocate exception for servlet AxisServlet java.lang.ClassNotFoundException: org.apache.ws.commons.schema.resolver.URIResolver at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139) at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:128) at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:149) at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:585) at org.apache.axis2.deployment.RepositoryListener.init(RepositoryListener.java:264) at org.apache.axis2.deployment.RepositoryListener.init2(RepositoryListener.java:66) at org.apache.axis2.deployment.RepositoryListener.(RepositoryListener.java:61) at org.apache.axis2.deployment.DeploymentEngine.loadRepository(DeploymentEngine.java:152) at org.apache.axis2.deployment.WarBasedAxisConfigurator.getAxisConfiguration(WarBasedAxisConfigurator.java:233) at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64) at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:620) at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:471) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:828) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source)
eu tinha baixado esta pasta deste link naquele dia que fiz esta pergunta, devo adicionar todos os JAR dentro da pasta lib?
ou tenho que baixar outra coisa neste site do axis2? quando inicio o tomcat e abro o localhost aparece isto:
quando clico em services ocorre o seguinte erro:
Deu certo, baixar o JAR org.apache.servicemix.bundles.xmlschema-1.4.3_1
porem quando clico em services aparece isto agora:
e se clico no primeiro link aparece isto:
[ERROR] The service cannot be found for the endpoint reference (EPR) /SigadmWS/services org.apache.axis2.AxisFault: The service cannot be found for the endpoint reference (EPR) /SigadmWS/services at org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:79) at org.apache.axis2.engine.Phase.invoke(Phase.java:324) at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:250) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:156) at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:242) at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:184) at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:869) at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:290) at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source)
é outro jar?
não sei onde fica o endpoits mas as classes que tenho aqui são:
ConectaFireBird:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConectaFirebird {
private static final String URL = "jdbc:firebird://localhost/SIGADM.FDB";
private static final String User= "SYSDBA";
private static final String Senha = "masterkey";
public static Connection obtemConexao() throws SQLException{
try {
Class.forName("org.firebirdsql.jdbc.FBDriver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return DriverManager.getConnection(URL, User, Senha);
}
}
classe Mesa:
import java.sql.Date;
public class Mesa {
private int id;
private String barras;
private String tipo;
private Date data;
private int lugares;
private String situacao;
private String descricao;
private double credito;
public Mesa(){
}
public Mesa(int id, String barras, String tipo, Date data, int lugares, String situacao, String descricao,
double credito) {
super();
this.id = id;
this.barras = barras;
this.tipo = tipo;
this.data = data;
this.lugares = lugares;
this.situacao = situacao;
this.descricao = descricao;
this.credito = credito;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getBarras() {
return barras;
}
public void setBarras(String barras) {
this.barras = barras;
}
public String getTipo() {
return tipo;
}
public void setTipo(String tipo) {
this.tipo = tipo;
}
public Date getData() {
return data;
}
public void setData(Date data) {
this.data = data;
}
public int getLugares() {
return lugares;
}
public void setLugares(int lugares) {
this.lugares = lugares;
}
public String getSituacao() {
return situacao;
}
public void setSituacao(String situacao) {
this.situacao = situacao;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public double getCredito() {
return credito;
}
public void setCredito(double credito) {
this.credito = credito;
}
}
Classe MesaDAO:
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
public class MesaDAO {
public ArrayList<Mesa> buscarTodos(){
ArrayList<Mesa> lista = new ArrayList<Mesa>();
try {
Connection conn = ConectaFirebird.obtemConexao();
String querry = "SELECT * FROM CONTROLE";
PreparedStatement stmt = conn.prepareStatement(querry);
ResultSet rSet = stmt.executeQuery();
while(rSet.next()){
Mesa mesa = new Mesa();
mesa.setId(rSet.getInt(1));
mesa.setBarras(rSet.getString(2));
mesa.setTipo(rSet.getString(3));
mesa.setData(rSet.getDate(4));
mesa.setLugares(rSet.getInt(5));
mesa.setSituacao(rSet.getString(6));
mesa.setDescricao(rSet.getString(7));
mesa.setCredito(rSet.getDouble(8));
lista.add(mesa);
}
conn.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return lista;
}
}