会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 133791个问题
WEB前端全系列/第九阶段:HTML5新特性模块/HTML5新特性 35701楼

webdemo.zip

老师,我登录输入正确的密码也提示用户名或者密码错误;麻烦帮我看看问题,我没找出原因,谢谢!

JAVA 全系列/第六阶段:JavaWeb开发/Web实战案例 35703楼
JAVA 全系列/第十五阶段:海量数据存储与查询/MyCat(旧) 35704楼

1.报错

com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Missing type id when trying to resolve subtype of [simple type, class org.springframework.session.data.mongo.MongoSession]: missing type id property '@class'

 at [Source: (String)"{"_id": "43386047-6d40-40fa-84e9-01b01ee00df5", "created": {"$date": "2021-05-15T13:44:27.095Z"}, "accessed": {"$date": "2021-05-15T13:44:27.096Z"}, "interval": "PT30M", "principal": null, "expireAt": {"$date": "2021-05-15T14:14:27.096Z"}, "attr": {"$binary": {"base64": "rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAB3CAAAABAAAAAAeA==", "subType": "00"}}}"; line: 1, column: 405]

image.png

image.png

session_mongodb.rar



2.运行老师的源码也报错:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2021-05-15 22:01:11.579 ERROR 15992 --- [           main] o.s.boot.SpringApplication               : Application run failed


org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat


JAVA 全系列/第十五阶段:Spring Session会话管理/Spring Session MongoDB 35705楼
WEB前端全系列/第十九阶段:Vue3企业级项目/Vue3企业级项目 35708楼

from threading import Thread,Event
from time import sleep
'''
几分钟一辆车
人上车和车辆可以上人是要同时进行的,车辆不在站内和人等待车也是同时进行的
'''

def car():
    num=0
    #global count,有event就不用count了
    while True:
        if event.is_set():      #count%5!=0:
            print('车已到站,可以上车')
            sleep(1)
            #count+=1   #就是上了四个人后开走了
            num+=1
            if num%5==0:
                event.clear()       #上了五个人开走了
        else:
            print("车开走了....")
            sleep(6)
            #count=1        
            #过了六秒后又开来了
            event.set()     #重新变成真的
def person():
    while True:
        #if count%5!=0:
        if event.is_set():
            print('上车!!')
            sleep(1)
        else:
            print('等待车!!!') #用count的时候,等待一直在刷,程序没有停下来
            event.wait()        #阻塞线程
            #sleep(1)
if __name__=="__main__":
    event=Event()
    count=1
    t1=Thread(target=car)
    t2=Thread(target=person)
    t1.start()
    t2.start()

老师,这个event是在车方法里面变成True的,怎么在人方法里面也是True了,两个方法不是一个栈帧里面的,他们的调用event方法也能共用?

Python 全系列/第三阶段:Python 网络与并发编程/并发编程 35711楼
Python 全系列/第八阶段:轻量级Web开发利器-Flask框架/Flask数据库 35715楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637