I wrote a small GWT app that includes a websocket servlet. I installed jetty-hightide 7.1.6 on my ubuntu 10.04 server and I cannot access the websocket servlet. However I can access it no problem when running on my local machine for testing. I didn't do any configuration to jetty I simply dropped the war file for the GWT app into the webapps folder and jetty deployed it.
I can access the app itself by going to the expected URL, but I just can't access the servlet via a URL.
the url I use locally is:
ws://127.0.0.1:8888/canvasbattleserver/battleCom
and on the production server:
ws://thelettercliff.com:8080/canvasbattleserver/battleCom
here is the configuration of the servlet in web.xml
<servlet>
<servlet-name>battleServlet</servlet-name>
<servlet-class>com.thelettercliff.project.server.BattleServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>battleServlet</servlet-name>
<url-pattern>/canvasbattleserver/battleCom</url-pattern>
</servlet-mapping>
Any ideas?
See if this works:
Edit this file: /etc/default/jetty
Look for a line that says
JETTY_HOST and change its value to 0.0.0.0
so it should read as:
JETTY_HOST=0.0.0.0
That will make jetty listen to connections on all interfaces.
Related
I have debugged Java codes as JAVA APPLICATION.(its simple)
Now I am working with Maven project, and I am Keen to know comprehensive flow of this MAVEN+SPRING-JERSEY Project.
I guess debugging could help me with that, I have crawled many sites but cant really get how to debug a Maven Project.
Can anyone help me with this babyish doubt.
Or even you can explain me flow from this example.JERSEY+SPRING+MAVEN
Sorry ! I know This might be silly question,Let me know if I should delete it.
Please let me know if I am Correct:
WHAT I HAVE UNDERSTOOD:
1.Request comes from client,Web.xml Handles this request.
It finds the REST class(with URIs) in given Package.
(Also in meantime,Spring registers all Beans with help of Bean Registry)
2.Then from Service It gets URI , Now request is sent to particular URI.
3.At that URI we have beans,(i.e business logic) which gets executed
4.Then this beans send back result to REST and REST send this response message to client.
This is My understanding from #Michael Hoffman answer.
Please Let me know if this is correct.
Maven is simply providing you with build management. For most cases, it has no impact on how you will debug an application.
Based on your question, the best approach for debugging your application would be to use an IDE like Eclipse. You will need to have Tomcat, or a similar web container, in order to debug at runtime. Otherwise, the flow of code at design time is likely as follows:
At runtime, Spring loads any beans that are to be managed into the Spring container (application context). This may include the controller or service that is executed by the REST-ful call.
Web page or other integration makes a call to the rest service. The address depends on the configuration of the service across the web.xml and Spring application context.
A request flows through the configured servlet. Here is an example of servlet configuration in the web.xml of an app:
<web-app>
<servlet>
<servlet-name>MyApplication</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
...
</init-param>
</servlet>
...
<servlet-mapping>
<servlet-name>MyApplication</servlet-name>
<url-pattern>/myApp/*</url-pattern>
</servlet-mapping>
...
</web-app>
Based on the path requested, the request will flow to an implementing class, often times a controller or service class. The class or methods on the class will have annotation like: #Path("/helloWorld")
Coming from a Microsoft background with mostly experience in IIS, I'm having difficulty in understanding some fundamental concepts when it comes to using Glassfish and publishing apps using domain names. I am using Java EE 7, Glassfish 4 and Eclipse Kepler running on Windows Vista.
When I run the Glassfish admin console, I notice under Applications, you can set the "Context root" for the app. So in Eclipse, if my project is called com.mycompany.myapp, the context root would be /com.mycompany.myapp
If I then type in the following url in my browser, I get the html content:
http://localhost:8080/com.mycompany.myapp/default.html
What I really want is to use a domain name. So the url above should look like this:
http://www.mydomain.com/default.html
It isn't clear to me what I have to do to make this happen.
The context root is only the context part of the URL, it can't change the server part of the URL. In general, if you want a public URL to point to some web application, you need something which maps the URL to the real URL of your application server. This has in most cases nothing to do with the backend side but with the configuration of a load-balancer (e.g. Apache) or proxy in front of your application server. This may also be hosted by an external provider.
Anyway, you can change the context root for applications on GlassFish either via the admin GUI or you can add a glassfish-web.xml in your WEB-INF dir which looks like this:
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD
GlassFish Application Server 3.1 Servlet 3.0//EN"
"http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<context-root>/your_desired_context_root</context-root>
</glassfish-web-app>
I am trying to setup a new ATG site. while accessing the Site Administration-->Site assets
from the ATG bussiness control center, it generating a popup
Unable to connect to the server at http://localhost:8180/FlexUI/messagebroker/amf
While checking the server error logs and cmd, It showing
[[MessageBrokerServlet]] Servlet MessageBrokerServlet is currently unavailable.
Can anyone help me to resolve this issue?
Try deleting your cookies and login again. I sometimes get that error when my session has expired, but the Flex interface is not aware of it.
If the problem persists, take a look at your logs, and see if there were any errors during the BCC startup. If so, post them here so I can try and help you.
Which browser are you running. I am hoping JBOSS, if yes. Go to your BCC server under jboss. And In its deploy folder check for
FlexUI.war > WEB-INF > web.xml
by the end of the file you will find
<servlet>
<servlet-name>MessageBrokerServlet</servlet-name>
<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MessageBrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
<load-on-startup>1</load-on-startup>
</servlet-mapping>
Remove <load-on-startup>1</load-on-startup> and restart your BCC. The error should go away.
Hope this helps!
Removing the MessageBrokerServlet load-on-startup works
I want to use a python backend while developing a SmartGWT front end. In order to get the debugging working correctly, I think I need the dev server running in eclipse which means the webserver will be running in eclipse.
My python (Django) backend needs to serve the requests for the data and I'd like it to not be a cross-domain issue, however cross-domain also seems to require the ports match too.
What is the simplest way to work around this? Been thinking about setting up my hosts file with a bogus domain and then have two entries, one for data, one for js. But, this requires setting up a second IP on the machine because the ports have to match too.
If I want anyone else to be able to see the pages I can't use localhost and my external IP since they won't be able to get to my localhost.
Is there some simpler setup?
Is there some simple proxy piece I could drop into the eclipse dev server that would proxy the data requests to a different server?
Other ideas?
I am using a proxy servlet in my gwt setup for this purpose.
I am using a tomcat proxy servlet from jetty util artifact:
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>6.1.22</version>
<scope>runtime</scope>
</dependency>
My web.xml looks like this:
<servlet>
<servlet-name>JettyProxy</servlet-name>
<servlet-class>org.mortbay.servlet.ProxyServlet$Transparent</servlet-class>
<init-param>
<param-name>ProxyTo</param-name>
<param-value>http://yourserver</param-value>
</init-param>
<init-param>
<param-name>Prefix</param-name>
<!-- will be removed from request -->
<param-value>/prefix/</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JettyProxy</servlet-name>
<url-pattern>/prefix/*</url-pattern>
</servlet-mapping>
If you get some weired error about some _context variable, make sure that the jetty-util.jar is in your classpath before the GWT SDK.
Use -noserver for the DevMode. See http://code.google.com/webtoolkit/doc/latest/DevGuideCompilingAndDebugging.html#How_do_I_use_my_own_server_in_development_mode_instead_of_GWT's
The easiest way to do it is if you have both backend and frontend on your development machine.
For my projects I am using GWT on the frontend and cherrypy (python) on the backend.
I set up both projects in eclipse and when developing I start a debugger for the cherrypy backend and one for the GWT frontend. So I can basically debug backend and frontend at the same time. Works really good.
Communication between python backend and gwt frontend is done via RequestBuilder (JSON) and the good thing about this setup is that I can test the backend's data communication directly without GWT.
So the development url is usually something like: http://localhost:8080/?gwt.codesvr=127.0.0.1:9997
Port 8080 is used by my cherrypy backend.
I have few questions about https in Scala Lift:
How can I set for my web application use only https protocol?
Must I rewrite some code for existing application for using https?
Is request response cycle changes or there is no any differents?
Where to find good scala lift open source project using https or just to see advanced use of framework?
Thanks.
HTTPS needs to be enabled in your servlet container, such as Jetty or Tomcat. It doesn't have much to do with your web application. Then you need to tell the servlet container to use HTTPS for some or all pages in the deployment descriptor. This is what your web.xml file will look like:
<web-app>
. . .
<security-constraint>
. . .
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>