[Dúvida] Tentando acessar dbase via java
"Jonny Marques" <[email protected]>
| Newsgroups | gmane.comp.db.bancosdedados |
|---|---|
| Message-ID | <[email protected]> |
Olá pessoal,
Estou tentando acessar .dbf via java só que encontro alguns problemas.
Estou usando o xbasej (porque é free) mas tem dados alguns problemas.
Um deles é essa mensagem:
log4j:WARN No appenders could be found for logger
(org.ajax4jsf.application.DebugLifecycleFactory).
log4j:WARN Please initialize the log4j system properly.
no site http://xbasej.sourceforge.net/ tem o seguinte:
xBaseJ.Properties
Properties may be set in one of two ways. First, with the
xBaseJ.properties file. Contents of which are the standard properties
file used by Java. ignoreDBFLengthCheck=true
ignoreMissingMDXFile=false < Second by using the
xBaseJ.Util.setxBaseJProperty method passing the name value pair as
two parameters. import xBaseJ.util; ...
setxBaseJProperty("ignoreDBFLengthCheck", "true"); <
Só não estou conseguindo saber implementar em minha classe o 'Second
by using'.
Outro problema é quando tento inserir um registro usando:
public void insertData(CadastroObj obj) throws xBaseJException,
IOException {
DBF dbf = new DBF(arquivoDbf);
dbf.getField("matricula").put(obj.getMatricula());
dbf.getField("nome").put(obj.getNome());
dbf.getField("endereco").put(obj.getEndereco());
dbf.getField("status").put(obj.getStatus());
dbf.write();
try {
dbf.finalize();
} catch (Throwable e) {
e.printStackTrace();
}
}
Ele dá o seguinte erro:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED!
Unable to parse document
'jar:file:/C:/Developer/workjboss/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/Cadastro/WEB-INF/lib/jsf-facelets.jar!/META-INF/faces-config.xml':
org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be
cast to org.apache.xerces.xni.parser.XMLParserConfiguration
Caused by: com.sun.faces.config.ConfigurationException: Unable to
parse document
'jar:file:/C:/Developer/workjboss/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/Cadastro/WEB-INF/lib/jsf-facelets.jar!/META-INF/faces-config.xml':
org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be
cast to org.apache.xerces.xni.parser.XMLParserConfiguration
Logo em seguida o seguinte:
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
at
javax.faces.context.FacesContext.setCurrentInstance(FacesContext.java:419)
Sei que no primeiro caso é uma questão de typecast (mas como resolver?)
Sei que a solução deve ser uma simples questão de configuração, mas
como implementar isso?
Grato antecipadamente pela ajuda.
Att. Jonny Marques
Vetor Informática
PS: Se conhecer algum 'pacote' que acesse o dbase via java de maneira
fácil, (que seja free) pode sugerir.