Bug 948185

Summary: API call system.listSystemEvents fails
Product: [Community] Spacewalk Reporter: pierre.casenove
Component: APIAssignee: Tomas Lestach <tlestach>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.9CC: brendan.wood, jpazdziora, tkasparek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-02 13:09:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 991452    

Description pierre.casenove 2013-04-04 09:16:18 UTC
Description of problem:
When calling API call system.listSystemEvents, the method returns an error: 
Fault returned from XML RPC Server, fault code -1: redstone.xmlrpc.XmlRpcFault: unhandled internal exception: [B cannot be cast to java.sql.Blob


Version-Release number of selected component (if applicable): Spacewalk 1.9 on RHEL 5, with PGSQL backend


How reproducible:
Extract from my perl script:

my $systems  = $client->call('systemgroup.listActiveSystemsInGroup', $session, $o_group);
for my $sys (@$systems) {
   $systemName = $client->call('system.getName',$session, $sys)->{name};
   my $eventsList = $client->call('system.listSystemEvents',$session, $sys);
   for my $event (@$eventsList) {
      my $event_date = sprintf("%d-%02d-%02d", unpack('A4A2A2', $event->{completed_date}->value()));
      }
   }
}

Steps to Reproduce:
1. launch above script
  
Actual results: JAVA error received. In catalina.out, we have the following traceback:
2013-04-04 09:09:48,922 [TP-Processor16] ERROR com.redhat.rhn.frontend.xmlrpc.BaseHandler - Caused by:
java.lang.ClassCastException: [B cannot be cast to java.sql.Blob
        at com.redhat.rhn.frontend.xmlrpc.system.SystemHandler.listSystemEvents(SystemHandler.java:2313)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at com.redhat.rhn.frontend.xmlrpc.BaseHandler.invoke(BaseHandler.java:141)
        at redstone.xmlrpc.XmlRpcDispatcher.dispatch(XmlRpcDispatcher.java:123)
        at com.redhat.rhn.frontend.xmlrpc.RhnXmlRpcServer.execute(RhnXmlRpcServer.java:54)
        at com.redhat.rhn.frontend.xmlrpc.XmlRpcServlet.doPost(XmlRpcServlet.java:162)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:142)
        at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:58)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at com.redhat.rhn.frontend.servlets.LocalizedEnvironmentFilter.doFilter(LocalizedEnvironmentFilter.java:67)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at com.redhat.rhn.frontend.servlets.EnvironmentFilter.doFilter(EnvironmentFilter.java:108)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at com.redhat.rhn.frontend.servlets.SessionFilter.doFilter(SessionFilter.java:55)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at com.redhat.rhn.frontend.servlets.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:97)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:542)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:775)
        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:704)
        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:897)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
        at java.lang.Thread.run(Thread.java:679)
Apr 4, 2013 9:09:48 AM redstone.xmlrpc.XmlRpcDispatcher writeError
WARNING: redstone.xmlrpc.XmlRpcFault: unhandled internal exception: [B cannot be cast to java.sql.Blob


Expected results: Actually get the events history of the system.


Additional info:

Comment 1 Jan Pazdziora 2013-04-04 11:40:57 UTC
Is that and external PostgreSQL? What version of the server and what version of the PostgreSQL client libraries?

Comment 2 pierre.casenove 2013-04-04 11:46:59 UTC
Internal PostgreSQL.
I'm using spacewalk 1.9 on rhel 5 Server x64.
Version:
bash-3.2# rpm -qa | grep postgre
postgresql84-libs-8.4.13-1.el5_8
spacewalk-java-postgresql-1.9.84-1.el5
spacewalk-postgresql-1.9.2-1.el5
postgresql84-8.4.13-1.el5_8
postgresql-libs-8.1.23-6.el5_8
postgresql84-contrib-8.4.13-1.el5_8
postgresql84-server-8.4.13-1.el5_8
postgresql-jdbc-8.1.407-1jpp.4
spacewalk-backend-sql-postgresql-1.9.47-1.el5

Are there still more information needed?

Comment 3 Tomas Lestach 2013-04-05 12:29:04 UTC
spacewalk.git: 67c0b675d6131d594c492c215087b3f150a09d35

Comment 4 Tomas Lestach 2013-04-05 12:58:25 UTC
+ fixing checkstyle issues ...

spacewalk.git: 61521af5e98252f0d41b4913a17a00467fea40b5

Comment 5 bjw 2013-05-10 20:37:08 UTC
I, too, am effected by this bug.

If I am understanding things, you patched this in the version for spacewalk-java code for SP 1.10?   Is there a fix forthcoming for 1.9 - or perhaps a workaround?   (I am a little leery of applying the diff to SystemHandler.java and rerolling the srpm - as I don't want to inadvertantly break something else)

Any advice is appreciated!

Thanks!

Comment 6 Tomas Lestach 2013-05-13 08:02:48 UTC
> If I am understanding things, you patched this in the version for
> spacewalk-java code for SP 1.10?

Right, the fix will be present in the upcoming Spacewalk release.

> Is there a fix forthcoming for 1.9 - or perhaps a workaround?

No.

Comment 7 Tomáš Kašpárek 2013-08-02 13:09:39 UTC
Fix for this bug is present in Spacewalk 2.0, closing this bug as CURRENTRELEASE.