简体   繁体   English

在WSO2 Application Server中部署Spring MVC

[英]Deploy Spring MVC in WSO2 Application Server

I am trying to deploy my Spring MVC application on WSO2 Application Server by going to Main > Manage > Applications > Add > Web Applications and upload my Spring MVC's WAR file. 我试图在WSO2 Application Server上部署我的Spring MVC应用程序,方法是转到Main> Manage> Applications> Add> Web Applications并上传我的Spring MVC的WAR文件。 The upload completed successfully, but I still can't run the web app itself. 上传成功完成,但我仍然无法运行Web应用程序本身。 The error message just basically complaining it doesn't have org.springframework. 错误消息只是抱怨它没有org.springframework。

The same WAR file can be run on Apache Tomcat with no problem at all. 可以在Apache Tomcat上运行相同的WAR文件,完全没有问题。 All I did is dropping the same WAR file to \\webapps, and it works. 我所做的只是将相同的WAR文件丢弃到\\ webapps,它的工作原理。

Is there a special setting that needs to be configured to get Spring MVC run on WSO2 Application Server? 是否有需要配置的特殊设置才能在WSO2 Application Server上运行Spring MVC? I would assume WSO2 Application is also using Apache Tomcat, so why it won't run by just uploading the WAR file? 我假设WSO2应用程序也在使用Apache Tomcat,那么为什么它不能仅通过上传WAR文件来运行?

Thanks! 谢谢!

What is your WSO2 AS version ? 你的WSO2 AS版本是什么? please make sure to use latest AS 5.1.0 version. 请确保使用最新的AS 5.1.0版本。 We have tested large number of Spring (including SpringMVC) based applications on AS 5.1.0, basically if something working on Tomcat it should be work on WSO2 AS too. 我们已经在AS 5.1.0上测试了大量基于Spring(包括SpringMVC)的应用程序,基本上如果在Tomcat上工作的东西也应该在WSO2 AS上运行。 If you still have issues on AS 5.1.0 please let me know. 如果您仍然在AS 5.1.0上遇到问题,请告诉我。

I solved this issue by: 我解决了这个问题:

  1. Upgrading WSO2 AS to latest version (5.1.0) as mentioned by Sagara Gunathunga. 将Sago Gunathunga提到的WSO2 AS升级到最新版本(5.1.0)。 For some reasons, previous WSO2 AS doesn't take my JSTL templating (something like $ {blabla}). 由于某些原因,以前的WSO2 AS没有采用我的JSTL模板(类似$ {blabla})。 Only in 5.1.0 did the issue resolved. 只有在5.1.0才能解决问题。 I start to wonder what this WSO2 is doing with its half-baked product. 我开始想知道这个WSO2用它的半生不熟的产品做了什么。

  2. Modify Maven POM file, specifically slf4j-api dependency. 修改Maven POM文件,特别是slf4j-api依赖项。 WSO2 has its own slf4j-api library and I have to set the scope of slf4j-api in my app to "provided" before deploying to WSO2. WSO2有自己的slf4j-api库,我必须在部署到WSO2之前将我的应用程序中的slf4j-api的范围设置为“提供”。 This solve the issue with unable to load all JavaScript files. 这解决了无法加载所有JavaScript文件的问题。 Downside for this is you will need the scope of slf4j-api to be "compiled" when you run this locally under regular Tomcat. 缺点是,当您在常规Tomcat下本地运行时,您将需要“编译”slf4j-api的范围。 Setting it to "provided" will not work under Tomcat. 将其设置为“提供”将无法在Tomcat下运行。 But in WSO2, the scope will need to be "provided" to run. 但是在WSO2中,范围需要“提供”才能运行。 So, there is manual work to change before deploying the application. 因此,在部署应用程序之前需要手动更改工作。 I did try to match the slf4j-api version to match what WSO2 and set the scope to "compile", but it still won't work. 我确实尝试匹配slf4j-api版本以匹配WSO2并将范围设置为“编译”,但它仍然无法工作。 WSO2, for some bad reasons, can't use my app's compiled slf4j-api. 由于一些不好的原因,WSO2无法使用我的应用程序编译的slf4j-api。

yes there is a separate workaround to deploy a spring service to wso2 appserver. 是的,有一个单独的解决方法来将spring服务部署到wso2 appserver。 Please follow [1] for instructions. 请按[1]说明。

[1]. [1]。 http://docs.wso2.org/wiki/display/AS510/Spring+Services http://docs.wso2.org/wiki/display/AS510/Spring+Services

Thank you, Dharshana 谢谢你,Dharshana

@stack247, @ stack247,
Well I'm from WSO2 and it's nice to hear that your JSTL issue is solved by now. 好吧,我来自WSO2,很高兴听到你的JSTL问题现在已经解决了。 But I completely disagree with " I start to wonder what this WSO2 is doing with its half-baked product" statement. 但我完全不同意“我开始怀疑这个WSO2用其半生不熟的产品做了什么”声明。 You may know that spec like Servelt , JSP and JSTL having different versions and update it's version with time. 您可能知道像Servelt,JSP和JSTL这样的规范有不同的版本,并随着时间更新它的版本。 Previous version of application server does not supported for latest JSP 2.0 and JSTL 1.2 specs hence you can't use application which depends on JSP 2.0 or JSTL 1.2 that was a known limitation but can't consider it as half-baked product due to that. 最新的JSP 2.0和JSTL 1.2规范不支持以前版本的应用程序服务器,因此您不能使用依赖于JSP 2.0或JSTL 1.2的应用程序,这是已知限制但不能将其视为半生不熟的产品。 This is very common nature with any software product and that's why we are actively developing, fixing issues, upgrading dependencies and frequently releasing new versions, also we are responding to community issues like this. 这是任何软件产品的常见性质,这就是我们积极开发,修复问题,升级依赖关系以及经常发布新版本的原因,我们也在回应这样的社区问题。

With Latest AS 5.1.0 release we officially support for Servelt 3.0, JSP 2.0 and JSTL 1.2 and any dependent applications too. 在最新的AS 5.1.0版本中,我们正式支持Servelt 3.0,JSP 2.0和JSTL 1.2以及任何相关的应用程序。 When it come to logging case most of the application server having their own logging mechanisms and some cases it's required remove logging dependencies from applications. 当涉及到日志记录案例时,大多数应用程序服务器都有自己的日志记录机制,有些情况下需要从应用程序中删除日志记录依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM