History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: AMQ-1098
Type: Bug Bug
Status: Reopened Reopened
Priority: Minor Minor
Assignee: Unassigned
Reporter: Hernan Otero
Votes: 1
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
ActiveMQ

Use of https transport throws ClassCastException

Created: 13/Dec/06 09:30 AM   Updated: 21/Jul/08 11:08 AM
Component/s: Transport
Affects Version/s: incubation
Fix Version/s: 5.1.0

Time Tracking:
Not Specified

File Attachments:
  Size
Zip Archive Licensed for inclusion in ASF works amq-1098potentialpatch.zip 2008-04-10 12:52 PM John Silva 2 kb
Text File Licensed for inclusion in ASF works HttpsTransportFactory.txt 2008-05-26 08:45 AM Joe Fernandez 0.7 kb
Environment: Ubuntu Linux & Mac OS X


 Description  « Hide
Trying to run the sample producer out of the main trunk using an https url throws a ClassCastException. I've tracked this down in the code to the fact that HttpTransportFactory.java expects to find an HttpClientTransport but HttpsTransportFactory does not override createTransport() to create an HttpsClientTransport instead (HttpsClientTransport does not exist as a class).

Thanks,

Hernan

$ ant producer
Buildfile: build.xml

init:

compile:

producer:
[echo] Running producer against server at $url = https://my.example.com:2222 for subject $subject = TEST.FOO
[java] Connecting to URL: https://my.example.com:7043
[java] Publishing a Message with size 1000 to topic: TEST.FOO
[java] Using non-persistent messages
[java] Sleeping between publish 0 ms
[java] javax.jms.JMSException: Could not create Transport. Reason: java.lang.ClassCastException: org.apache.activemq.transport.https.HttpsTransport
[java] Caught: javax.jms.JMSException: Could not create Transport. Reason: java.lang.ClassCastException: org.apache.activemq.transport.https.HttpsTransport
[java] at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:33)
[java] at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:229)
[java] at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:242)
[java] at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:211)
[java] at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:158)
[java] at ProducerTool.run(Unknown Source)
[java] at ProducerTool.main(Unknown Source)
[java] Caused by: java.lang.ClassCastException: org.apache.activemq.transport.https.HttpsTransport
[java] at org.apache.activemq.transport.http.HttpTransportFactory.compositeConfigure(HttpTransportFactory.java:62)
[java] at org.apache.activemq.transport.TransportFactory.configure(TransportFactory.java:213)
[java] at org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:117)
[java] at org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:43)
[java] at org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:77)
[java] at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:227)
[java] ... 5 more

BUILD SUCCESSFUL
Total time: 2 seconds



 All   Comments   Work Log   Change History   Subversion Commits   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
John Silva - 10/Apr/08 12:52 PM - edited
Attached in amq-1098potentialpatch.zip are a few fixed files that appear to address the classcastexception...basically made an httpsclienttransport which just extends the existing HttpClientTransport. Because the underlying HttpClient works with http and https, there are no further changes needed. Then in the HttpsTransportFactory I return the newly created httpsclienttransport...since it extends the httpclienttransport there is no longer the classcastexception. Tested and seems to work for my purposes, patch against v4.1.1.

Hiram Chirino - 24/Apr/08 10:40 AM
patch applied in rev 651320.. Thanks!

Joe Fernandez - 26/May/08 08:41 AM
HttpsTransportFactory does not override doBind(URI location); therefore, HttpTransportFactory's doBind(URI location) is referenced instead. So a 'https://' transportConnector ends up using a HttpTransportServer instead of HttpsTransportServer object.

John Silva - 21/Jul/08 11:08 AM
Original patch resolves issue for 4.1.1, additionally applying Joe's patch seems to resolve issues in 5.1.0