servicecomb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bismy" <bi...@qq.com>
Subject 回复: [Discuss] Do we need to add some reminder logsonSwaggerGeneratorContext selection?
Date Sat, 27 Oct 2018 02:47:04 GMT
"maven met a random error while downloading a certain dependency file" this problems happens
to me several times. This is usually caused by a pool network configuration, such as firewalls
and proxies. 




------------------ 原始邮件 ------------------
发件人: "yhs0092"<yhs0092@163.com>;
发送时间: 2018年10月25日(星期四) 晚上11:53
收件人: "dev@servicecomb.apache.org"<dev@servicecomb.apache.org>;

主题: Re:  [Discuss] Do we need to add some reminder logsonSwaggerGeneratorContext selection?



We've checked the recent modification of the pom.xml file. While the only change is adding
a dependency of dbcp, this dependency has nothing to do about swagger schema generation. So
we think the suspicion of 3rd party dependency and the pom can be excluded.
When the user builds jar file in command line window, the effective maven setting file is
located in .m2 directory of the home directory, while another maven setting file is taken
to use in Eclipse maven build. I think it may be the only difference in terms of maven configuration.
But the user says these two file refer to the same remote maven repo and point to the same
local repo, so it seems not possible to cause this problem either.


I think the most possible cause is that maven met a random error while downloading a certain
dependency file, and could not recovery from it. But the user cleaned his local repo before
we check whether there was some file broken, so we cannot locate the actual root cause now.
It's a pity.


Yours sincerely


Yao Haishi
yhs0092@163.com


On 10/25/2018 11:16,bismy<bismy@qq.com> wrote:
I am curious about why run in windows "the output jar file lacked swagger-generator-springmvc
dependency jar" ?
How this happen? If the maven dependency do not define this GAV?


If maven works correctly, this should not happen. And it's seems awkward to check exceptions
due to lack of components.




------------------ 原始邮件 ------------------
发件人: "willem.jiang"<willem.jiang@gmail.com>;
发送时间: 2018年10月25日(星期四) 上午10:05
收件人: "dev"<dev@servicecomb.apache.org>;

主题: Re: [Discuss] Do we need to add some reminder logs onSwaggerGeneratorContext selection?



+1, we need to let user know how the framework exactly works.

Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Thu, Oct 25, 2018 at 9:36 AM yhs0092 <yhs0092@163.com> wrote:

OK, JIRA issue has been created, https://issues.apache.org/jira/browse/SCB-979
As for pojo mode, I think maybe we can check the annotations on the REST interface class.
If the PojoSwaggerGeneratorContext is selected and @RequestMapping or @Path is found, we can
print some extra reminder log. The log level is INFO, so we don't mean that it must be a problem.


Yours sincerely


Yao Haishi
yhs0092@163.com


On 10/24/2018 21:46,wjm wjm<zzzwjm@gmail.com> wrote:
log the selected mode is necessary
but pojo mode not know what's other mode......

Willem Jiang <willem.jiang@gmail.com> 于2018年10月24日周三 下午8:30写道:

Hi Haishi

It's important to let the user know about if there is some fallback
mechanism is used. In this way we could save user lot of time for the
trouble shooting. We also need to inform the user from log if there
are some important configuration information is loaded.

BTW, Please fill a JIRA to track this issue.

Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Wed, Oct 24, 2018 at 4:14 PM yhs0092 <yhs0092@163.com> wrote:

Hi guys.
Yesterday, a user asked me about a 404 error. He packed his JavaChassis
project into a jar file and ran it on his laptop. But when he invoked the
rest interface by Postman, a 404 error was returned, while if he ran the
project in Eclipse, this problem did not occur.


Finally we found out there was something wrong with maven. On his
laptop, if maven packaging command was run in Windows CMD, the output jar
file lacked swagger-generator-springmvc dependency jar.
As the implementations of SwaggerGeneratorContext are loaded by SPI
mechanism, there is no error when some classes are abscent. When the
expected SpringmvcSwaggerGeneratorContext is abscent, the
PojoSwaggerGeneratorContext will be used as default. As a result, the
@RequestMapping tagged on REST interface class is ignored, and the name of
the class is used as basePath instead of the value specified in
@RequestMapping.


After cleaning local maven repo, the problem disappeared. But in this
case, there is almost no log for helping locate the problem cause.


So do we need to add some log to indicate the potential problem?
Currently I think we can add log to show which SwaggerGeneratorContext
is selected to generate swagger schema. And if PojoSwaggerGeneratorContext
is selected, we can add some extra logic to check whether there is @Path or
@RequestMapping and remind developer to be aware of the dependency jar
files.
Any ideas?




Yours sincerely


Yao Haishi
yhs0092@163.com
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message