Boa tarde, pessoal!
Eu tenho um projeto em java que fazia tempo que não dava manutenção(mais de ano).
Esses dias fui tentar executar ele e estou tendo problemas.
Ao executar o projeto, quando vai comunicar com o webservice ocorre este erro abaixo:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/istack/localization/Localizable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:208)
at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:119)
at javax.xml.ws.Service.<init>(Service.java:77)
at javax.xml.ws.Service.create(Service.java:707)
at br.com.backupsafe.conexaows.ConexaoWs.registraVersao(ConexaoWs.java:203)
at br.com.backupsafe.main.MainBackupSafe.<init>(MainBackupSafe.java:51)
at br.com.backupsafe.main.MainBackupSafe.main(MainBackupSafe.java:25)
Caused by: java.lang.ClassNotFoundException: com.sun.istack.localization.Localizable
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 31 more
A classe que está dando erro é essa:
package br.com.backupsafe.conexaows;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import javax.xml.ws.Service;
import org.jdom2.JDOMException;
import br.com.backupsafe.config.HistoricoBackupVo;
import br.com.backupsafe.config.RetornoBackupVo;
import br.com.backupsafe.config.XmlUtilsClient;
import br.com.backupsafe.controller.configuracao.ConfiguracaoBackupController;
import br.com.backupsafe.exception.APIException;
import br.com.backupsafe.generic.config.Config;
import br.com.backupsafe.generic.debug.Debug;
import br.com.backupsafe.generic.exception.NoXmlConfigException;
import br.com.backupsafe.generic.framework.utils.DateUtils;
import br.com.backupsafe.model.configuracao.ConfiguracaoBackup;
import br.com.backupsafe.model.pessoa.Empresa;
import br.com.backupsafe.webservice.IWebServiceIntegracao;
public class ConexaoWs {
private static ConexaoWs conexaoWs;
public ConexaoWs(){
}
public static ConexaoWs getInstance() {
if (conexaoWs == null) {
conexaoWs = new ConexaoWs();
}
return conexaoWs;
}
/**
* @return URL WebServiceIntegracaoImpl
* @throws APIException
* @throws ServiceException
* @throws IOException
* @throws JDOMException
* @throws Exception
*/
public List<ConfiguracaoBackup> getConfiguracaoBackup() throws Exception {
List<String> listaCnpj = Config.getInstance().getListaCnpj();
List<ConfiguracaoBackup> listaConf = new ArrayList<ConfiguracaoBackup>();
URL url = new URL(Config.getInstance().getWebServiceIntegracaoImpl());
for (String cnpj : listaCnpj) {
Debug.imprimir(DateUtils.formataDataLog(new Date()) +" - Empresa: "+cnpj);
Debug.imprimir(DateUtils.formataDataLog(new Date()) +" - WSDL: "+ Config.getInstance().getWebServiceIntegracaoImpl());
try {
QName qname = new QName("http://webservice.backupsafe.com.br/","WebServiceIntegracaoImplService");
Service ws = Service.create(url, qname);
IWebServiceIntegracao web = ws.getPort(IWebServiceIntegracao.class);
String ret = web.getConfiguracaoBackup(cnpj);
Debug.imprimir(DateUtils.formataDataLog(new Date()) +" - Xml Retorno: "+ret);
ConfiguracaoBackupController controller = new ConfiguracaoBackupController();
ConfiguracaoBackup configBackup = controller.getEnvioConfiguracaoBackup(ret);
listaConf.add(configBackup);
} catch (MalformedURLException e) {
e.printStackTrace();
throw e;
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
return listaConf;
}
/**
* Envia uma mensagem ao servidor notificando se deu tudo certo.
* @throws APIException
* @throws RemoteException
* @throws ServiceException
*
*/
public boolean EnviaRetornoBackup(HistoricoBackupVo historico) throws RemoteException, ServiceException,Exception {
RetornoBackupVo retorno = new RetornoBackupVo();
retorno.setCnpj(historico.getEmpresa().getCnpjEmp());
retorno.setHistoricoBackupVo(historico);
XmlUtilsClient xml = new XmlUtilsClient();
String strXml = xml.geraXmlRetornoBackup(retorno);
URL url;
try {
url = new URL(Config.getInstance().getWebServiceIntegracaoImpl());
QName qname = new QName("http://webservice.backupsafe.com.br/","WebServiceIntegracaoImplService");
Service ws = Service.create(url, qname);
IWebServiceIntegracao web = ws.getPort(IWebServiceIntegracao.class);
Boolean ret = web.enviaRetornoBackup(strXml);
return ret;
} catch (MalformedURLException e) {
e.printStackTrace();
throw e;
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
/**
* Envia uma mensagem ao servidor notificando se deu tudo certo.
* @throws APIException
* @throws RemoteException
* @throws ServiceException
*
*/
public boolean EnviaConfiguracaoBackup(ConfiguracaoBackup cfgbackup) throws RemoteException, ServiceException,Exception {
XmlUtilsClient xml = new XmlUtilsClient();
String strXml = xml.getXmlConfiguracaoBackup(cfgbackup);
URL url;
try {
url = new URL(Config.getInstance().getWebServiceIntegracaoImpl());
QName qname = new QName("http://webservice.backupsafe.com.br/","WebServiceIntegracaoImplService");
Service ws = Service.create(url, qname);
IWebServiceIntegracao web = ws.getPort(IWebServiceIntegracao.class);
Boolean ret = web.enviaConfiguracaoBackup(strXml);
return ret;
} catch (MalformedURLException e) {
e.printStackTrace();
throw e;
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
/**
* Busca dos dados da empresa no servidor
* @return URL WebServiceIntegracaoImpl
* @throws APIException
* @throws ServiceException
* @throws IOException
* @throws JDOMException
* @throws Exception
*/
public Empresa getDadosEmpresa(String cnpj,String enderecoWebService) throws Exception {
URL url = new URL(enderecoWebService);
Debug.imprimir(DateUtils.formataDataLog(new Date()) +" - Empresa: "+cnpj);
Debug.imprimir(DateUtils.formataDataLog(new Date()) +" - WSDL: "+ enderecoWebService);
Empresa emp;
try {
QName qname = new QName("http://webservice.backupsafe.com.br/","WebServiceIntegracaoImplService");
Service ws = Service.create(url, qname);
IWebServiceIntegracao web = ws.getPort(IWebServiceIntegracao.class);
String ret = web.getDadosEmpresa(cnpj);
Debug.imprimir(DateUtils.formataDataLog(new Date()) +" - Xml Retorno: "+ret);
ConfiguracaoBackupController controller = new ConfiguracaoBackupController();
emp = controller.getDadosEmpresa(ret);
} catch (MalformedURLException e) {
e.printStackTrace();
throw e;
} catch (Exception e) {
e.printStackTrace();
throw e;
}
return emp;
}
public void registraVersao() throws Exception{
URL url;
try {
Debug.imprimir(DateUtils.formataDataLog(new Date()) +" - Notificando atualizacao de versao... "+Config.getInstance().getVersaoSistema());
url = new URL(Config.getInstance().getWebServiceIntegracaoImpl());
QName qname = new QName("http://webservice.backupsafe.com.br/","WebServiceIntegracaoImplService");
Service ws = Service.create(url, qname);
IWebServiceIntegracao web = ws.getPort(IWebServiceIntegracao.class);
List<String> listaCnpj = Config.getInstance().getListaCnpj();
for (String cnpj: listaCnpj) {
web.notificaAtualizacaoVersao(cnpj, Config.getInstance().getVersaoSistema());
}
} catch (MalformedURLException e) {
e.printStackTrace();
new APIException(e);
} catch (Exception e) {
e.printStackTrace();
new APIException(e);
}
}
/**
* Atualiza a
* @param cnpj
* @param emExecucao
* @throws Exception
*/
public void notificaExecucao(String cnpj, Boolean emExecucao,int percentual){
URL url;
try {
url = new URL(Config.getInstance().getWebServiceIntegracaoImpl());
QName qname = new QName("http://webservice.backupsafe.com.br/","WebServiceIntegracaoImplService");
Service ws = Service.create(url, qname);
IWebServiceIntegracao web = ws.getPort(IWebServiceIntegracao.class);
web.atualizaExecucao(cnpj, emExecucao.toString(),percentual);
} catch (MalformedURLException e) {
e.printStackTrace();
new APIException(e);
} catch (Exception e) {
e.printStackTrace();
new APIException(e);
}
}
public static void main(String[] args) throws MalformedURLException, NoXmlConfigException {
ConexaoWs con = new ConexaoWs();
con.notificaExecucao("99999999999999", false,0);
}
}
Esse é meu arquivo pom.xml
4.0.0
br.com.backupsafe
BackupSafeClient
2.2.13 Mysql
BackupSafe
src/main/java
org.apache.maven.plugins
maven-compiler-plugin
3.3
1.7
1.7
org.apache.maven.plugins
maven-jar-plugin
2.4
true
lib/
br.com.backupsafe.main.MainBackupSafe
maven-dependency-plugin
install
copy-dependencies
${project.build.directory}/lib
java.net
http://download.java.net/maven/2/
JBoss repository
https://repository.jboss.com/maven2/
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.3.ga</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-annotations -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-commons-annotations -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>
<!-- Hibernate library dependecy start -->
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<!-- <dependency> <groupId>cglib</groupId> <artifactId>cglib</artifactId>
<version>2.2</version> </dependency> -->
<!-- Hibernate library dependecy end -->
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time-hibernate</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<groupId>org.firebirdsql.jdbc</groupId>
<artifactId>jaybird-jdk17</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>3.5.2-Final</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxrpc</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>br.com.backupsafe</groupId>
<artifactId>BackupSafeGeneric</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>br.com.backupsafe</groupId>
<artifactId>BackupSafeWsInterface</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-s3 -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.11.598</version>
</dependency>
</dependencies>
O que mudou que meu projeto parou de funcionar?
E o que preciso fazer para que meu projeto volte a executar?
Obrigado