会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 128777个问题

我父项目的POM文件如下:

<>
    <>4.0.0</>

    <>
        <>org.springframework.boot</>
        <>spring-boot-starter-parent</>
        <>2.2.6.RELEASE</>
        </> </>

    <>com.cerana</>
    <>open-his</>
    <>1.0</>
    <>pom</>
    <>门诊管理系统</>

    <>
        <>1.8</>
        <>1.5.3</>
        <>1.1.21</>
        <>3.3.1.tmp</>
        <>1.26.7</>
        <>3.2.3</>
        <>1.2.62</>
        <>5.1.1</>
        <>1.19</>
        <>2.7.5</>
    </>

    <>
        <>
            <>
                <>com.alibaba</>
                <>druid-spring-boot-starter</>
                <>${druid.version}</>
            </>
            <>
                <>com.baomidou</>
                <>mybatis-plus-boot-starter</>
                <>${mybatis-plus.version}</>
            </>
            <>
                <>org.apache.shiro</>
                <>shiro-spring-boot-web-starter</>
                <>${shiro-boot.version}</>
            </>
            <>
                <>com.github.tobato</>
                <>fastdfs-client</>
                <>${fastdfs.version}</>
            </>
            <>
                <>org.crazycake</>
                <>shiro-redis</>
                <>${shiro-redis.version}</>
            </>

            <>
                <>com.alibaba</>
                <>fastjson</>
                <>${fastjson.version}</>
            </>

            <>
                <>cn.hutool</>
                <>hutool-all</>
                <>${hutool.version}</>
            </>
            <>
                <>eu.bitwalker</>
                <>UserAgentUtils</>
                <>${bitwalker.version}</>
            </>

            <>
                <>org.apache.dubbo</>
                <>dubbo-spring-boot-starter</>
                <>${dubbo.version}</>
            </>
            <>
                <>org.apache.dubbo</>
                <>dubbo-dependencies-zookeeper</>
                <>${dubbo.version}</>
                <>pom</>
                <>
                    <>
                        <>org.slf4j</>
                        <>slf4j-log4j12</>
                    </>
                </>
            </>
        </>
    </>

</>


结果发现好多包导不进来:

image.png

导不进来的包具体有:

druid-spring-boot-starter

mybatis-plus-boot-starter

shiro-spring-boot-web-starter

fastdfs-client

shiro-redis

hutool-all

dubbo-dependencies-zookeeper


我使用的IDEA版本:2019 2.2

我使用的maven版本3.6.0,且已做了如下的阿里云镜像

<mirror>

<id>nexus-aliyun</id>

<mirrorOf>*</mirrorOf>

<name>Nexus aliyun</name>

<url>http://maven.aliyun.com/nexus/content/groups/public</url>

</mirror>


请问:

  1.  可能是什么原因导致包到不进来?

  2. 要如何解决?

JAVA 全系列/第二十一阶段:分布式医疗云平台/项目环境搭建(旧) 166楼
JAVA 全系列/第二十一阶段:分布式医疗云平台/看病就诊前后端开发(旧) 167楼

zookeeper连接不成功,什么原因造成的?已经修改过超时连接的时间。

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-02-15 23:32:05.730 ERROR 15944 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: zookeeper not connected
    at org.apache.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.<init>(CuratorZookeeperClient.java:83) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.remoting.zookeeper.curator.CuratorZookeeperTransporter.createZookeeperClient(CuratorZookeeperTransporter.java:26) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.remoting.zookeeper.support.AbstractZookeeperTransporter.connect(AbstractZookeeperTransporter.java:68) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.remoting.zookeeper.ZookeeperTransporter$Adaptive.connect(ZookeeperTransporter$Adaptive.java) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.<init>(ZookeeperRegistry.java:85) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.registry.zookeeper.ZookeeperRegistryFactory.createRegistry(ZookeeperRegistryFactory.java:42) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.registry.support.AbstractRegistryFactory.getRegistry(AbstractRegistryFactory.java:121) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.registry.RegistryFactoryWrapper.getRegistry(RegistryFactoryWrapper.java:34) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.registry.RegistryFactory$Adaptive.getRegistry(RegistryFactory$Adaptive.java) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.registry.integration.RegistryProtocol.getRegistry(RegistryProtocol.java:298) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.registry.integration.RegistryProtocol.export(RegistryProtocol.java:204) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.export(ProtocolListenerWrapper.java:60) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.qos.protocol.QosProtocolWrapper.export(QosProtocolWrapper.java:64) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper.export(ProtocolFilterWrapper.java:143) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.rpc.Protocol$Adaptive.export(Protocol$Adaptive.java) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:470) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:315) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:287) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:205) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.config.bootstrap.DubboBootstrap.lambda$exportServices$13(DubboBootstrap.java:873) ~[dubbo-2.7.5.jar:2.7.5]
    at java.base/java.util.HashMap$Values.forEach(HashMap.java:981) ~[na:na]
    at org.apache.dubbo.config.bootstrap.DubboBootstrap.exportServices(DubboBootstrap.java:861) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.config.bootstrap.DubboBootstrap.start(DubboBootstrap.java:703) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onContextRefreshedEvent(DubboBootstrapApplicationListener.java:52) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onApplicationContextEvent(DubboBootstrapApplicationListener.java:45) ~[dubbo-2.7.5.jar:2.7.5]
    at org.apache.dubbo.config.spring.context.OneTimeExecutionApplicationContextEventListener.onApplicationEvent(OneTimeExecutionApplicationContextEventListener.java:40) ~[dubbo-2.7.5.jar:2.7.5]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:897) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
    at com.bjsxt.ErpApplication.main(ErpApplication.java:16) [classes/:na]
Caused by: java.lang.IllegalStateException: zookeeper not connected
    at org.apache.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.<init>(CuratorZookeeperClient.java:80) ~[dubbo-2.7.5.jar:2.7.5]
    ... 38 common frames omitted


JAVA 全系列/第二十一阶段:分布式医疗云平台/进销存系统前后端开发(旧) 168楼
JAVA 全系列/第二十一阶段:分布式医疗云平台/系统管理前后端开发(旧) 169楼
JAVA 全系列/第二十一阶段:分布式医疗云平台/系统管理前后端开发(旧) 170楼
JAVA 全系列/第二十一阶段:分布式医疗云平台/系统管理前后端开发(旧) 171楼
JAVA 全系列/第二十一阶段:分布式医疗云平台/系统管理前后端开发(旧) 174楼
JAVA 全系列/第二十一阶段:分布式医疗云平台/系统管理前后端开发(旧) 175楼
JAVA 全系列/第二十一阶段:分布式医疗云平台/系统管理前后端开发(旧) 177楼

这个里面提示没有方法,这个方法应该在那里创建呢?

图片.png

图片.png

图片.png

图片.png

package com.bjsxt.config.shiro;
import com.bjsxt.domain.User;
import com.bjsxt.service.UserService;
import com.bjsxt.vo.ActiverUser;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.ByteSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
/**
 * @Author: GHP
 * 自定义 realm 去匹配用户名和密码
 */
public class UserRealm extends AuthorizingRealm {
    @Autowired
    @Lazy
    private UserService userService;
    @Override
    public String getName() {
        return this.getClass().getSimpleName();
    }
    /**
     * 做认证 --就是登陆
     * @param token
     * @return
    45
     * @throws AuthenticationException
     */
    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws
            AuthenticationException {
//得到用户登陆名
        String phone=token.getPrincipal().toString();
//根据电话查询用户是否存在
        User user = userService.queryUserByPhone(phone);
        if(null!=user){//说明用户存在,但是密码可能不正确
//组装存放到 reids 里面的对象
            ActiverUser activerUser=new ActiverUser();
            activerUser.setUser(user);
//匹配密码
            SimpleAuthenticationInfo info=new SimpleAuthenticationInfo(
                    activerUser,user.getPassword(),
                    ByteSource.Util.bytes(user.getSalt()),this.getName()
            );
            return info;
        }else{
            return null;//代表用户不存在
        }
    }
    /**
     * 做授权 --登陆成功之后判断用户是否有某个菜单或按钮的权限
     * @param principals
     * @return
     */
    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
        ActiverUser activerUser= (ActiverUser) principals.getPrimaryPrincipal();//身份得到的就是上一个方法的返回值的值 第一个参数 activerUser
        SimpleAuthorizationInfo info=new SimpleAuthorizationInfo();
        return info;
    }
}


JAVA 全系列/第二十一阶段:分布式医疗云平台/系统管理前后端开发(旧) 179楼
JAVA 全系列/第二十一阶段:分布式医疗云平台/项目环境搭建(旧) 180楼

百战程序员微信公众号

百战程序员微信小程序

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