我正在使用digitalocean并尝试在ubuntu上安装和启动tomcat但不幸的是我不能这样做.(创造了新的水滴并尝试了10次)
1GB Ram 30GB SSD Disk Amsterdam 2 Ubuntu 14.04 x64
当我启动tomcat时,它说"Tomcat启动".但我无法从浏览器访问页面.和./shutdown.sh返回错误.
可能是什么问题?
我现在注意到了什么.在我写这个问题时,会显示tomcat页面.显示页面花了28分钟
catalina.out说:INFO:使用[SHA1PRNG]为会话ID生成创建SecureRandom实例花了[1,718,769]毫秒.
以下是我的安装步骤(这些步骤适用于不同的vps,但不适用于digitalocean飞沫):
安装oracle jdk
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default
java -version
java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)
Run Code Online (Sandbox Code Playgroud)
设置java路径
sudo nano /etc/environment
JAVA_HOME="/usr/lib/jvm/java-7-oracle"
source /etc/environment
wget http://ftp.itu.edu.tr/Mirror/Apache/tomcat/tomcat-7/v7.0.56/bin/apache-tomcat-7.0.56.tar.gz
tar xvzf apache-tomcat-7.0.56.tar.gz
mv apache-tomcat-7.0.56/ apache-tomcat-7.0.56-server-1/
Run Code Online (Sandbox Code Playgroud)
启动Tomcat
./startup.sh
Using CATALINA_BASE: /usr/local/apache-tomcat-7.0.56-server-1
Using CATALINA_HOME: /usr/local/apache-tomcat-7.0.56-server-1 …Run Code Online (Sandbox Code Playgroud) 在我的场景中,集合中有作者,每个作者都有,作者的messages每个消息都可以events.每个演员只允许执行一次动作.
db.people.ensureIndex({messages.messageEvents.eventName: 1, messages.messageEvents.actorId: 1}, {unique: true});
Run Code Online (Sandbox Code Playgroud)
我添加了索引,但没有效果.正如你看到下面,我的文档有哪些具备三个要素"eventName":"vote",并"actorId":"1234"应该是对我的约束.
如何messageEvents根据eventName和actorId字段确保数组中的唯一项?
实际上,我需要在没有第二次搜索和更新事件的情况下更新现有项目,而不是拒绝它.
{
"_id": "1234567",
"authorPoint": 0,
"messages": [
{
"messageId": "112",
"messageType": "Q",
"messagePoint": 0,
"messageEvents": [
{
"eventName": "Add",
"actorId": "1234",
"detail": ""
},
{
"eventName": "Vote",
"actorId": "1234",
"detail": "up"
},
{
"eventName": "Vote",
"actorId": "1234",
"detail": "down"
},
{
"eventName": "Vote",
"actorId": "1234",
"detail": "cork"
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud) 这是SpringMVC Controller代码片段:
@RequestMapping(value = "/getCityList", method = RequestMethod.POST)
public @ResponseBody LinkedHashMap<String, String> getCityList(@RequestParam(value = "countryCode") String countryCode, HttpServletRequest request) throws Exception {
//gets ordered city list of country [sorted by city name]
LinkedHashMap<String, String> cityList = uiOperationsService.getCityList(countryCode);
for (String s : cityList.values()) {
System.out.println(s); //prints sorted list [sorted by name]
}
return cityList;
}
Run Code Online (Sandbox Code Playgroud)
这是ajax调用:
function fillCityList(countryCode) {
$.ajax({
type: "POST",
url: '/getCityList',
data: {countryCode:countryCode},
beforeSend:function(){
$('#city').html("<option value=''>-- SELECT --</option>" );
}
}).done(function (data) {
console.log(data); // UNSORTED JSON STRING …Run Code Online (Sandbox Code Playgroud)