Swagger-UI 提示Unable to infer base url.

错误信息为:

Unable to infer base url. 
This is common when using dynamic servlet registration or when the API is behind an API Gateway. 
The base url is the root of where all the swagger resources are served. For e.g. if the api is available at http://example.org/api/v2/api-docs then the base url is http://example.org/api/. 
Please enter the location manually: 

出现了这个错误的原因很多,有的人说是版本的原因,但我试了这个方法,发现并没有解决。

最终,我发现是我的项目SpringApplication中加上了@ComponentScan注解,我去掉这个注解后,就可以正常访问了。

还有种可能就是在pom.xml中加入了

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId> 
    <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
</plugin> 


阅读更多

Unable to connect. Invalid URL.

05-28

整合了三大框架,对数据库操作的时候出错,很多天不知道哪里问题,请高人指教,拜托了,错误信息如下:rnrn严重: Servlet.service() for servlet default threw exceptionrnjava.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect. Invalid URL.rn at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)rn at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)rn at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)rn at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)rn at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)rn at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)rn at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)rn at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)rn at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)rn at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)rn at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)rn at org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:145)rn at org.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:107)rn at org.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:68)rn at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)rn at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)rn at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdatern由于帖子长度限制,只贴出了最开始的异常,spring配置文件aplicatonContext.xml信息如下,rnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnorg.hibernate.dialect.SQLServerDialectrntruernrnrnrnrnrntest/bean/User.hbm.xmlrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrn我不明白为什么url会不可用,求求大家了,帮帮忙吧!

没有更多推荐了,返回首页