Driver of the Firebird

Asked

Viewed 193 times

2

I am trying to create a webservice with Firebird. I made the codes based on a Mysql video class and I was trying to change to work on Firebird. But obviously it didn’t work. Let’s go to the codes:

Class 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);
}

}

He falls in the ClassNotFoundException.

console appears this:

[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.Talina.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)

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)

inserir a descrição da imagem aqui

i had downloaded this link folder that day I asked this question, I should add all JAR inside the lib folder?

inserir a descrição da imagem aqui

or do I have to download something else on this axis2 site? when I start Tomcat and open localhost this appears:

inserir a descrição da imagem aqui

when I click on services the following error occurs:

inserir a descrição da imagem aqui

It worked, download JAR org.apache.servicemix.bundles.xmlschema-1. 4.3_1

but when I click services this now appears:

inserir a descrição da imagem aqui

and if I click on the first link this appears:

inserir a descrição da imagem aqui

[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.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.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)

is another jar?

I don’t know where the endpoits are, but the classes I have here are:

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);
}

}

table class:

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;
}



}

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;



    }



}
  • 1

    You may find the jar that is missing here http://www.findjar.com/class/org/apache/ws/commons/schema/resolver/URIResolver.html

  • down all jar?

  • the download links are broken

  • 1

    Not only will you download what makes sense to your project, it should probably be org.apache.servicemix.bundles.xmlschema-1. 4.3_1.jar. Use this site to findjar just to locate the jars needed for your project, then you can play on google even to download it. http://www.java2s.com/Code/JarDownload/org.apache.servicemix.bundles.xmlschema/org.apache.servicemix.bundles.xmlschema-1.4.2_1.jar.zip

  • worked out by downloading this org.apache.servicemix.bundles.xmlschema-1. 4.3_1.jar, however another problem occurred, I edited the post again with the new error.

  • I found this, but it’s the same thing http://findjar.com/class/org/apache/ws/commons/schema/XmlSchemaForm.html

  • 1

    Now he is able to read the schema but you are having problems configuring your endpoints from your webservice. Aliases Urls are really weird. .

  • I guess I didn’t touch it, I’m new to this part of webservice, can you tell me where I find these endpoints and the service config?

  • I edited the post with all the classes of my project, I don’t know if this is what you wanted

  • 1

    Read this how-to here https://www.ibm.com/developerworks/library/ws-apacheaxis/ you first need to understand what a web service is, endpoints and how to configure them. Then worry about which bank to connect to.

  • this wsdl file is a default file? or should it be created? I’m kind of floating around

Show 6 more comments

2 answers

2


In your stacktrace there’s this:

java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/resolver/URIResolver

That is, your problem is not in Firebird, but in Axis 2 Jars that seem to be missing. You can get them here: http://axis.apache.org/axis2/java/core/download.html

  • I edited the post ._.

1

Download the Firebird driver (http://www.firebirdsql.org/en/jdbc-driver/) and put the corresponding JAR in your classpath when running the application.

And also, instead of "com.firebird.jdbc.Driver", use "org.firebirdsql.jdbc.FBDriver".

  • compared to jar had already downloaded and installed correctly but did not know the path of the driver to put, but still not working

Browser other questions tagged

You are not signed in. Login or sign up in order to post.