Erro ao executar CAST

Galera estou tentando fazer o seguinte cast:

acdAddress = (ACDAddress)address;

Causando o seguinte erro:

java.lang.ClassCastException:

Estou declarando aqui:

Address address = null;
ACDAddress acdAddress = null;
Provider provider = null;

E usando aqui:

                   provider = jtapiPeer.getProvider(providerString);
                   address = provider.getAddress(ramal);
		    agentTerminal = (AgentTerminal) provider.getTerminal(ramal);
		    acdAddress = (ACDAddress)address;
		    if (agentTerminal != null) {
		    	agent = agentTerminal.addAgent(address, acdAddress, Agent.LOG_IN,ramal,""); 		    }

Address address = null;

Ou seja address não faz referência a nenhum objeto Address e vc esta tentando usado. Não pode.

Flw

Mas não está null, ali é somente a criação do objeto.

Uso ele aqui:

provider = jtapiPeer.getProvider(providerString);
address = provider.getAddress(ramal);
agentTerminal = (AgentTerminal) provider.getTerminal(ramal);
acdAddress = (ACDAddress)address;

Esta retornando corretamente, o problema é no cast mesmo.

coloca pra imprimir address depois de

address = provider.getAddress(ramal);

syso(address);

pra saber o tipo dele.

Imprime isso:

address com.avaya.jtapi.tsapi.xo@1bb9a58

estranho… era pra imprimir ao com o nome da classe no inicio… qual a relacao entre essas duas classes Address e ACDAddress? Quem herda de quem?
Aparentemente Address é superclasse, entao ACDAddress É UMA Address, mas não o inverso como você ta fazendo.

Quanto a classe o proprio Eclipse sugere esse tipo de cast.

Não aquele nome foi eu que coloquei, imprime assim:

com.avaya.jtapi.tsapi.xo@1236cd5

Segue a documentação:

Interface javax.telephony.callcenter.ACDAddress

public interface ACDAddress
extends CallCenterAddress
Introduction
Automated Call Distribution (ACD) is a Call Center feature that provides a mechanism for receiving calls, queueing them, and distributing them to
agent extensions within ACD Groups. An ACD Group comprises zero or more agent extensions, which are dynamically associated with ACD
Groups through a login/logout process. The ACDAddress interface models an ACD Group for ACD systems.
A call placed to an ACDAddress represents a call which is being routed to an available agent logged into the ACD Group. In the case where no
agent is available, the ACDAddress is queued for a group of agents who are logged in to that ACD Group, but unavailable to service that call.
Calls are distributed to the agents in that group based on their availability and other factors determined by the implementation.
Calls may placed directly to an ACDAddress or the ACD machanism can be relied upon to select a destination ACDAddress by placing the call
to an ACDManagerAddress.
The ACDAddress extends CallCenterAddress with the methods necessary to obtain ACD-specific information such as the Agent objects
associated with the ACDAddress and a variety of call queue methods to get information on calls queued at this address.
ACDAddresses differ from Addresses
Some important differences between ACDAddress and Address are:
An ACDAddress cannot have Terminal objects associated with it. 1.
An ACDAddress is not a logical endpoint of a call in the same sense as an Address Rather, it models a queuing process whereby the
selection of a logical endpoint is deferred.
2.
ACDConnections to an ACDAddress do not enter into a CONNECTED state. 3.
It is not returned on Provider.getAddresses(), but is available through CallCenterProvider.getACDAddresses() 4.
ACDAddresses and ACDConnections
A call presented to an ACDAddress is modeled by an ACDConnection. That ACDConnection may be between a Call object and the
ACDAddress or it may exist between a ACDManagerConnection and the ACDAddress, depending on whether the call was placed directly
to the ACDAddress or whether it arrived indirectly through the distribution mechanism from an ACDManagerAddress.
Observation at an ACDAddress
All events pertaining to the ACDAddress interface are reported via the AddressObserver.addressChangedEvent() method. In order
to observe Agent state changes for Agents associated with an ACDAddress, an application must implement an ACDAddressObserver
interface and associate it with the ACDAddress using the addObserver() method on an ACDAddress object.
See Also:
ACDConnection, CallCenterAddress, ACDAddressObserver, Address

Do cast eu resolvi de outro jeito

acdAddress = ( (CallCenterProvider) provider).getACDAddresses();

Mas agora quando vou obter esse acdAddress me retorna essa exception

//codigo

if (agentTerminal != null) {
agent = agentTerminal.addAgent(address,acdAddress[0],Agent.LOG_IN,ramal,"");
}	    

//exception


com.avaya.jtapi.tsapi.TsapiPlatformException: Security DataBase is turned off, No List will be returned but any administered ACD addresses can be accessed.
	at com.avaya.jtapi.tsapi.xf.db(Unknown Source)
	at com.avaya.jtapi.tsapi.qc.getACDAddresses(Unknown Source)
	at br.com.xx.business.Telefonia.ready(Telefonia.java:441)
	at br.com.xx.business.Telefonia.main(Telefonia.java:115)

Alguém sugere algo?, ou usa JTAPI com CTI Avaya aqui?