Java Google glass starter project mapping in AWS EC2

会有一股神秘感。 提交于 2019-12-23 05:40:11

问题


I am stuck with the Google Glass Java Starter Project. I have succesfully downloaded it and ran it locally using mvn jetty:run. It runs beautifully on localhost in my machine. I deployed it to Google App Engine sucessfully, but I wanted to add more functionality to it, so I decided to use the Java Quartz library to send scheduled notifications to the glassware. Unfortunately, the quartz library works spawning new threads and GAE doesn't allow me to do so. I decided to run it in a separate server (Amazon EC2) and I am able to deploy it, but I have a servlet mapping error.

The error I get is:

    HTTP Status 404 - /oauth2callback
    type Status report

    message /oauth2callback

    description The requested resource (/oauth2callback) is not available.

I have tried to add the "glass" part to each url-pattern but that doesn't work. I am aware this is a servlet mapping issue, but I don't know how to fix it. This is my web.xml

This is the servlets part from my web.xml

    <!-- servlets -->
      <servlet>
        <servlet-name>main</servlet-name>
        <servlet-path>com.google.glassware.MainServlet</servlet-path>
      </servlet>
      <servlet-mapping>
        <servlet-name>main</servlet-name>
        <url-pattern>/glass/main</url-pattern>
      </servlet-mapping>

      <servlet>
        <servlet-name>oauth2callback</servlet-name>
        <servlet-path>com.google.glassware.AuthServlet</servlet-path>
      </servlet>
      <servlet-mapping>
        <servlet-name>oauth2callback</servlet-name>
        <url-pattern>/glass/oauth2callback</url-pattern>
      </servlet-mapping>

      <servlet>
        <servlet-name>notify</servlet-name>
        <servlet-path>com.google.glassware.NotifyServlet</servlet-path>
      </servlet>
      <servlet-mapping>
        <servlet-name>notify</servlet-name>
        <url-pattern>/glass/notify</url-pattern>
      </servlet-mapping>

      <servlet>
        <servlet-name>attachmentproxy</servlet-name>
        <servlet-path>com.google.glassware.AttachmentProxyServlet</servlet-path>
      </servlet>
      <servlet-mapping>
        <servlet-name>attachmentproxy</servlet-name>
        <url-pattern>/glass/attachmentproxy</url-pattern>
      </servlet-mapping>

      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>

Would anyone be so kind as to point me in the right direction? or explain why this isn't working?

UPDATE For people having the same problem I am having, I fixed it. The user Prisoner pointed me in the right direction, but I was having a hard time following the lead. What he means by running the app as "ROOT" is to have the application run in: http://amazon-server.com:8080/

I was trying to run it as "glass"

http://amazon-server.com:8080/glass

and it was messing everything up that I was trying to do. All you have to do is delete the folder ROOT in your webapps folder and upload your precompiled war renamed as "ROOT.war"

The exact command I used was:

    scp -i myamazon.pem /Users/.../.../mirror-api-quickstart/target/glass-java-starter-0.1-SNAPSHOT.war ubuntu@ec2-99-99-99-99.compute-1.amazonaws.com:/var/lib/tomcat7/webapps/ROOT.war

It should run smoothly.

Thanks a lot Prisoner! :)


回答1:


War files get expanded into a directory the same name as the file. This then becomes the name of the webapp. So a file named glass.war is expanded into a webapp named glass and all references to it must include the webapp name as part of the path.

The path for OAuth would be something like https://example.com/glass/oauth2callback. You need to enter this in the developer's console as one of the redirect URLs.



来源:https://stackoverflow.com/questions/23482202/java-google-glass-starter-project-mapping-in-aws-ec2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!