0

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! :)

geekmlle
  • 3
  • 2
  • This sounds similar to http://stackoverflow.com/questions/23284260/oauth-callback-in-the-glass-quick-starter-java-app. Same sorts of questions for you - are you running it as the ROOT webapp? If not, what is the name you're running it as? – Prisoner May 06 '14 at 00:37
  • Yes, I did look at that question, but changing the line "In this case, around line 53, oauth2callback is mapped to the com.google.glassware.AuthServlet class." didn't help. I have a war file called "glass.war" and I placed that in the tomcat7/webapps directory. That deploys the war file but when running the file, (even if the web.xml is changed and the line in the AuthServlet class) I still get redirected to http://aws-ec2blahblah.com/oauth2callback, and it can't be shown. Which is why I think it's a mapping problem but I am not sure how to move forward. – geekmlle May 06 '14 at 03:20

1 Answers1

0

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.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • Thank you so much! BTW, to anyone wondering... I did have to add this address to the Google Console but what was wrong was the url-pattern of the Filters( authFilter /glass/* ) , not only the servlets. Now I get a different error but I'm on track! Thanks again. – geekmlle May 07 '14 at 05:51