spring Grails插件返回无效的流标头错误

ntjbwcob  于 2023-03-11  发布在  Spring
关注(0)|答案(1)|浏览(100)

我有一个Grails应用程序,它使用了我自己创建的插件,两者都使用Spring-security-core插件。
我的插件有一个域类,控制器和视图。要显示的数据是从Map上画的线中选择的。返回的数据显示在浏览器窗口底部的列表中。我在其中一个字段上创建了一个链接,该字段应该显示所选的记录。
但是,当我单击此链接时,出现以下错误:

| Error 2014-05-27 16:14:11,415 [http-bio-8082-exec-6] ERROR errors.GrailsExceptionResolver  - StreamCorruptedException occurred when processing request: [GET] /test/bridge/show/661
invalid stream header: 8401FE00. Stacktrace follows:
Message: invalid stream header: 8401FE00
Line | Method
->>  802 | readStreamHeader in java.io.ObjectInputStream
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    299 | <init>           in     ''
|     55 | show . . . . . . in RIMS.bridge.BridgeController
|    195 | doFilter         in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter . . . . in grails.plugin.cache.web.filter.AbstractFilter
|     53 | doFilter         in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
|     49 | doFilter . . . . in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
|     82 | doFilter         in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
|   1145 | runWorker . . .  in java.util.concurrent.ThreadPoolExecutor
|    615 | run              in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . . . .  in java.lang.Thread

失败的代码是我尝试在以下操作中获取具有ID的数据的代码:

@Secured(["hasRole('ROLE_MAP_USER')"])
def show(Long id) {
    println "ID: ${id}"
    def princObj = springSecurityService?.principal
    log.debug "User: ${princObj}"
    def bridgeInstance = RIMS.bridge.Bridge.get(id)
    if (!bridgeInstance) {
        flash.message = message(code: 'default.not.found.message', args: [message(code: 'bridge.label', default: 'Bridge'), id])
        redirect(action: "list")
        return
    }

    render(plugin: "nhvr", view:"show", model: [bridgeInstance: bridgeInstance])
}

返回的用户在log.debug“用户:${princObj}”正确且具有所需角色。
我不知道该怎么做。有人能建议我试试吗?

下面是Bridge类的代码:

package RIMS.bridge

class Bridge {

        String bridgeNo
        String roadNo
        BigDecimal linkNo
        BigDecimal chng
        String travelDirectionCode
        BigDecimal northing
        BigDecimal easting
        String overUnderCode
        Date dateActive
        Date dateArchived
        String tranUser
        Date tranDateTime
        String tranType
        Serializable obj
        String cwayCode
        String constructed

        static hasMany = [
                          bridgeClearances: BridgeClearance,
                          bridgeCulverts: BridgeCulvert,
                          bridgeDimensions: BridgeDimension,
                          bridgeDrawings: BridgeDrawing,
                          bridgeDucts: BridgeDuct,
                          bridgeHydraulics: BridgeHydraulic,
                          bridgeMaintenances: BridgeMaintenance,
                          bridgeMiscellaneouses: BridgeMiscellaneous,
                          bridgeParts: BridgePart,
                          bridgeServices: BridgeService,
                          bridgeSpans: BridgeSpan,
                          bridgeSubstructures: BridgeSubstructure,
                          bridgeSuperstructures: BridgeSuperstructure]

        static mapping = {      
                    id generator: "assigned"
            version false
        }

        static constraints = {
            bridgeNo maxSize: 10
            roadNo nullable: true, maxSize: 5
            linkNo nullable: true
            chng nullable: true
            travelDirectionCode maxSize: 10
            northing nullable: true
            easting nullable: true
            overUnderCode maxSize: 10
            dateArchived nullable: true
            tranUser maxSize: 30
            tranType maxSize: 6
            obj nullable: true
            cwayCode nullable: true, maxSize: 4
            constructed nullable: true, maxSize: 3
        }

     def locateByBridgeNo(String bridgeNo){
         println "locating by no: ${bridgeNo}"
         withCriteria{
             eq('bridgeNo', bridgeNo)
         }
     }
     static listActiveBridges(){
         withCriteria(){
             isNull('dateArchived')
         }
     }   

     static listBridgesByBridgeNo(String bridgeNo){
         withCriteria(){
             eq('bridgeNo', bridgeNo)
         }
     }

    String toString(){
        return "${bridgeNo} Road: ${roadNo}, Link: ${linkNo}, chainage: ${chng}"
    }    
}
8cdiaqws

8cdiaqws1#

对于我来说,当我将java.time.Instant作为类的成员字段,同时尝试使用不支持Instant序列化的Hibernate 3.6从数据库中获取它时,会出现此错误消息。
然而,这不是解决您的问题的方法,但我还是添加了它,以防万一它可能会帮助那些最终在这里搜索相同错误消息的人。

相关问题