I have web application Project having RPC call.
one RPC async is working fine. but Another gives a error
Mar 21, 2012 1:34:51 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
SEVERE: javax.servlet.ServletContext log: ObjectStore: An IncompatibleRemoteServiceException was thrown while processing this call.
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: This application is out of date, please click the refresh button on your browser. ( Blocked attempt to access interface 'com.client.RepositoryInterface', which is not implemented by 'com.server.ObjectStore'; this is either misconfiguration or a hack attempt )
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:252)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:206)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
Working RPC
public interface ConnectionInterface extends RemoteService{
String connection(String[] authentication);
}
public interface ConnectionInterfaceAsync {
void connection(String[] authentication, AsyncCallback<String> callback);
}
public class ConnectionService implements ConnectionInterfaceAsync {
ConnectionInterfaceAsync service = (ConnectionInterfaceAsync)GWT.create(ConnectionInterface.class);
ServiceDefTarget endpoint = (ServiceDefTarget) service;
public ConnectionService() {
endpoint.setServiceEntryPoint(GWT.getModuleBaseURL() + "rpc");
}
public void connectionCMIS(String[] authentication,
AsyncCallback<String> callbackConnection) {
service.connectionCMIS(authentication, callbackConnection);
}
// client Call
public class Login extends Composite {
private ConnectionService connectionService = new ConnectionService();
// more code
public void onClick(ClickEvent event) {
AsyncCallback<String> callbackConnection = new AsyncCallback<String>() {
public void onSuccess(String result) {
// print Succuss
}
}
connectionService.connection(authentication, callbackConnection );
}
}
}
Not Workink RPC
public interface RepositoryInterface extends RemoteService {
public FolderCollection getRepositories();
}
public interface RepositoryInterfaceAsync {
void getRepositories(AsyncCallback<FolderCollection> repositoryCallback);
}
public class RepositoryService implements RepositoryInterfaceAsync{
RepositoryInterfaceAsync async = (RepositoryInterfaceAsync)GWT.create(RepositoryInterface.class);
ServiceDefTarget endpoint = (ServiceDefTarget) async;
public CmisRepositoryService() {
endpoint.setServiceEntryPoint(GWT.getModuleBaseURL() + "repository");
}
public void getRepositories(
AsyncCallback<FolderCollection> repositoryCallback) {
async.getRepositories(repositoryCallback);
}
}
client call
public class Workplace {
private RepositoryService service = new RepositoryService();
// some more code
void doRepo(){
AsyncCallback<FolderCollection> repositoryCallback = new AsyncCallback<FolderCollection>() {
public void onSuccess(FolderCollection result) {
}
public void onFailure(Throwable caught) {
}
};
service.getRepositories(repositoryCallback);
}
}
XML Code
<servlet>
<servlet-name>ConnectionServlet</servlet-name>
<servlet-class>com.server.ConnectionServiceImpl</servlet-class>
</servlet>
<servlet>
<servlet-name>ObjectStore</servlet-name>
<servlet-class>com.server.ObjectStore</servlet-class>
<servlet-mapping>
<servlet-name>ConnectionServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ObjectStore</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Both RPC is designed in similar patter still it gives me an error.
If any one can tell me why will be of great Help
thanks.
Your URL-mapping is off, you need to map your RPC RemoteServiceServlets to a better url-pattern. You map both servlets to /*. There is no guarantee which Servlet is executed when two or more a mapped to the exact same url-pattern. So my guess is, everytime you execute your not working service, the call is mapped to the other service.
A way to work this out would be to use a web.xml like
<servlet-mapping>
<servlet-name>ConnectionServlet</servlet-name>
<url-pattern>/ConnectionService.rpc</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ObjectStore</servlet-name>
<url-pattern>/ObjectStoreService.rpc</url-pattern>
</servlet-mapping>
Of course you also have to change your client-side services to use the correct serviceEntryPoint , so
endpoint.setServiceEntryPoint(GWT.getModuleBaseURL() + "rpc");
would have to change to something like
endpoint.setServiceEntryPoint(GWT.getHostPageBaseURL() + "ConnectionService.rpc");
to get to the right servlet.
EDIT: Error of change:
ERROR
#ftr `com.google.appengine.tools.development.ApiProxyLocalImpl log
SEVERE: javax.servlet.ServletContext log: ConnectionServlet: An IncompatibleRemoteServiceException was thrown while processing this call.
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: This application is out of date, please click the refresh button on your browser. ( Blocked attempt to access interface 'com.client.RepositoryInterface', which is not implemented by 'com.server.ConnectionServiceImpl'; this is either misconfiguration or a hack attempt )
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:252)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:206)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
So if you look closely, the error is different:
Blocked attempt to access interface 'com.client.RepositoryInterface', which is not implemented by 'com.server.ConnectionServiceImplObjectStore'
instead of
Blocked attempt to access interface 'com.client.RepositoryInterface', which is not implemented by 'com.server.ObjectStore'
This means your configuration is still wrong, you have to point your client-side RepositoryInterfaceAsync to a RemoteServiceServlet that implements RepositoryInterface.
It might be misconfiguration of gwt-servlet.jar version on your web-container.Check your development gwt-servlet.jar version and web container gwt-servlet.jar version. n For reference
Misconfiguration or hack attempt
Related
I've taken an Example from https://sparktutorials.github.io/2015/11/08/spark-websocket-chat.html and want to deploy it as war to Tomcat to run it on web server. I've found several examples with basic request (like get, for Ex.) but such way doesn't work with web sockets.
public class Chat implements SparkApplication{
static Map<Session, String> userUsernameMap = new HashMap<>();
static int nextUserNumber = 1; //Used for creating the next username
public static void main(String[] args) {
new Chat().init();
}
//Sends a message from one user to all users, along with a list of current usernames
public static void broadcastMessage(String sender, String message) {
userUsernameMap.keySet().stream().filter(Session::isOpen).forEach(session -> {
try {
session.getRemote().sendString(String.valueOf(new JSONObject()
.put("userMessage", createHtmlMessageFromSender(sender, message))
.put("userlist", userUsernameMap.values())
));
} catch (Exception e) {
e.printStackTrace();
}
});
}
//Builds a HTML element with a sender-name, a message, and a timestamp,
private static String createHtmlMessageFromSender(String sender, String message) {
return article().with(
b(sender + " says:"),
p(message),
span().withClass("timestamp").withText(new SimpleDateFormat("HH:mm:ss").format(new Date()))
).render();
}
#Override
public void init() {
String route = "/chat";
webSocket(route, ChatWebSocketHandler.class);
}
}
When I run it I get
org.apache.catalina.core.StandardContext.filterStart Exception starting filter SparkFilter
java.lang.IllegalStateException: WebSockets are only supported in the embedded server
at line webSocket(route, ChatWebSocketHandler.class); in void init() method.
If smth depends on my web.xml (i've not changed it), the list is here:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Messenger</display-name>
<filter>
<filter-name>SparkFilter</filter-name>
<filter-class>spark.servlet.SparkFilter</filter-class>
<init-param>
<param-name>applicationClass</param-name>
<param-value>com.barbarian.messenger.Chat</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SparkFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
If I put new SparkFilter(); before that line (just tried) I got
org.apache.catalina.core.StandardContext.filterStart Exception starting filter SparkFilter
java.lang.IllegalStateException: WebSockets are only supported in the embedded server
at the same line.
Does anybody have ideas of valid running it?
Based on the documentation (at least the current one):
WebSockets only works with the embedded Jetty server, and must be defined before regular HTTP routes......
http://sparkjava.com/documentation.html#websockets
Which is why you do not see any servlet config in web.xml in the sample code (https://github.com/tipsy/spark-websocket) since the embedded Jetty container can be run directly in the main method. Also it uses the org.eclipse.jetty.websocket.api.* package for websocket implementation.
If you need websocket to be run on Tomcat, you might want to consider using WebSocketServlet implementation in catalina package. I've found sample codes here (even though I haven't tested it yet): https://gist.github.com/chitan/3063774. Hope this helps.
My original HttpSessionListener code:
public class SessionListener implements HttpSessionListener {
#Override
public void sessionDestroyed(HttpSessionEvent event) {
final Object user = event.getSession().getAttribute("user");
if (user != null && user insteaceof User) {
UserUtils.deleteUser((User) user);
}
}
}
and my web.xml
<filter>
<filter-name>ObjectifyFilter</filter-name>
<filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ObjectifyFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
When a session timeout event happens it throws:
WARNING: Problem scavenging sessions
java.lang.IllegalStateException: You have not started an Objectify context. You are probably missing the ObjectifyFilter. If you are not running in the context of an http request, see the ObjectifyService.run() method.
at com.googlecode.objectify.ObjectifyService.ofy(ObjectifyService.java:44)
at com.learnkeeper.server.OfyService.ofy(OfyService.java:61)
at com.learnkeeper.server.UserUtils.deleteUser(UserUtils.java:28)
at com.learnkeeper.server.SessionListener.sessionDestroyed(SessionListener.java:36)
at org.mortbay.jetty.servlet.AbstractSessionManager.removeSession(AbstractSessionManager.java:669)
at org.mortbay.jetty.servlet.AbstractSessionManager$Session.timeout(AbstractSessionManager.java:926)
at org.mortbay.jetty.servlet.HashSessionManager.scavenge(HashSessionManager.java:285)
at org.mortbay.jetty.servlet.HashSessionManager.access$000(HashSessionManager.java:44)
at org.mortbay.jetty.servlet.HashSessionManager$2.run(HashSessionManager.java:219)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
I tried that (from this post How to resolve "You have not started an Objectify context" in JUnit?):
public class SessionListener implements HttpSessionListener {
private Closeable closeable;
#Override
public void sessionDestroyed(HttpSessionEvent event) {
final Object user = event.getSession().getAttribute("user");
if (user != null && user instanceof User) {
closeable = OfyService.begin();
UserUtils.deleteUser((User) user);
closeable.close();
}
}
}
And here is my OfyService class:
class OfyService {
static {
// Register all my Entities classes
ObjectifyService.register(User.class);
...
}
public static Closeable begin() {
return ObjectifyService.begin();
}
public static ObjectifyFactory factory() {
return ObjectifyService.factory();
}
public static Objectify ofy() {
return ObjectifyService.ofy();
}
}
but same stacktrace :(
So what did I miss?
thx
EDIT
to follow-up with #stickfigure
So I cleaned my project and re-run my use case and I get this stacktrace now:
WARNING: Problem scavenging sessions
java.lang.NullPointerException: No API environment is registered for this thread.
at com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:132)
at com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppIdNamespace(DatastoreApiHelper.java:148)
at com.google.appengine.api.datastore.Key.(Key.java:96)
at com.google.appengine.api.datastore.Key.(Key.java:78)
at com.google.appengine.api.datastore.KeyFactory.createKey(KeyFactory.java:54)
at com.google.appengine.api.datastore.KeyFactory.createKey(KeyFactory.java:47)
at com.googlecode.objectify.util.DatastoreUtils.createKey(DatastoreUtils.java:86)
at com.googlecode.objectify.impl.KeyMetadata.getRawKey(KeyMetadata.java:187)
at com.googlecode.objectify.impl.Keys.rawKeyOf(Keys.java:36)
at com.googlecode.objectify.impl.Keys.keyOf(Keys.java:29)
at com.googlecode.objectify.impl.LoaderImpl.entity(LoaderImpl.java:121)
at com.learnkeeper.server.UserUtils.deleteUser(UserUtils.java:28)
at com.learnkeeper.server.SessionListener.sessionDestroyed(SessionListener.java:40)
at org.mortbay.jetty.servlet.AbstractSessionManager.removeSession(AbstractSessionManager.java:669)
at org.mortbay.jetty.servlet.AbstractSessionManager$Session.timeout(AbstractSessionManager.java:926)
at org.mortbay.jetty.servlet.HashSessionManager.scavenge(HashSessionManager.java:285)
at org.mortbay.jetty.servlet.HashSessionManager.access$000(HashSessionManager.java:44)
at org.mortbay.jetty.servlet.HashSessionManager$2.run(HashSessionManager.java:219)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
I don't see any reason why that code should fail, although it can be written more elegantly:
public class SessionListener implements HttpSessionListener {
#Override
public void sessionDestroyed(HttpSessionEvent event) {
final Object user = event.getSession().getAttribute("user");
if (user != null && user instanceof User) {
try (Closable closable = OfyService.begin()) {
UserUtils.deleteUser((User) user);
}
}
}
I have many variations of this code in my applications and there are examples in the test cases - actually, all of Objectify's test cases rely on this pattern.
I would like to see the exact stacktrace generated when you run this code. It should be quite impossible to get that stacktrace if you have called begin() properly. You can look at the code in ObjectifyService.ofy() - it is quite simple. Doublecheck that the code you have deployed is the code you think you have deployed.
UPDATE: The new stacktrace is quite different, and indicates that GAE is not set up to perform API calls from that listener callback. It has nothing to do with Objectify; this is now a question for Google. I suggest writing a new question that focuses on that aspect and tagging it with GAE-related tags.
That said, my general advice is to avoid relying on this callback. Aside from technical issues like this, I would not trust it to be executed consistently in a distributed environment like GAE. If you want to expire an object, put a datestamp on it and cull anything older than a week (or whatever is reasonable).
Google App Engine Doesn't support session listeners. Session listeners may get invoke in local, but No API environment is registered for this thread. In production listeners will not even invoke.
Source #Ramesh V
https://stackoverflow.com/a/11152125/421563
Anyway thx #stickfigure
I tried to integrate a servletcontextlistener in my axis2 app in Apache Tomcat 7.
I followed all instructions, but when I start tomcat, I get the following error:
java.lang.ClassNotFoundException: ch.pmm.cpsserver.coolarts.daemon.CoolArtsListener
... error.
This is my class:
public class CoolArtsListener implements ServletContextListener {
//protected Log logger = LogFactory.getLog(getClass());
private ServletContext m_oApplication = null;
#Override
public void contextInitialized(ServletContextEvent oEvent)
{
this.m_oApplication = oEvent.getServletContext();
System.out.println("the CA - Listener is called");
}
#Override
public void contextDestroyed(ServletContextEvent arg0)
{
System.out.println("The CA - Listener is destroyed");
}
}
and published the class in the web.xml of the axis2 app.
<listener>
<listener-class>ch.pmm.cpsserver.coolarts.daemon.CoolArtsListener</listener-class>
</listener>
Is a missing lib the reason for this behaviour?
If so, what libs are required for this functionality? Or is there another reason?
I'm working on an application that uses Websockets (Java EE 7) to send messages to all the connected clients asynchronously. The server (Websocket endpoint) should send these messages whenever a new article (an engagement modal in my app) is created.
Everytime a connection is established to the websocket endpoint, I'm adding the corresponding session to a list, which I could be able to access outside.
But the problem I had is, when I'm accessing this created websocket endpoint to which all the clients connected from outside (any other business class), I've get the existing instance (like a singleton).
So, can you please suggest me a way I can get an existing instance of the websocket endpoint, as I can't create it as new MyWebsocketEndPoint() coz it'll be created by the websocket internal mechanism whenever the request from a client is received.
For a ref:
private static WebSocketEndPoint INSTANCE = null;
public static WebSocketEndPoint getInstance() {
if(INSTANCE == null) {
// Instead of creating a new instance, I need an existing one
INSTANCE = new WebSocketEndPoint ();
}
return INSTANCE;
}
Thanks in advance.
The container creates a separate instance of the endpoint for every client connection, so you can't do what you're trying to do. But I think what you're trying to do is send a message to all the active client connections when an event occurs, which is fairly straightforward.
The javax.websocket.Session class has the getBasicRemote method to retrieve a RemoteEndpoint.Basic instance that represents the endpoint associated with that session.
You can retrieve all the open sessions by calling Session.getOpenSessions(), then iterate through them. The loop will send each client connection a message. Here's a simple example:
#ServerEndpoint("/myendpoint")
public class MyEndpoint {
#OnMessage
public void onMessage(Session session, String message) {
try {
for (Session s : session.getOpenSessions()) {
if (s.isOpen()) {
s.getBasicRemote().sendText(message);
}
} catch (IOException ex) { ... }
}
}
But in your case, you probably want to use CDI events to trigger the update to all the clients. In that case, you'd create a CDI event that a method in your Websocket endpoint class observes:
#ServerEndpoint("/myendpoint")
public class MyEndpoint {
// EJB that fires an event when a new article appears
#EJB
ArticleBean articleBean;
// a collection containing all the sessions
private static final Set<Session> sessions =
Collections.synchronizedSet(new HashSet<Session>());
#OnOpen
public void onOpen(final Session session) {
// add the new session to the set
sessions.add(session);
...
}
#OnClose
public void onClose(final Session session) {
// remove the session from the set
sessions.remove(session);
}
public void broadcastArticle(#Observes #NewArticleEvent ArticleEvent articleEvent) {
synchronized(sessions) {
for (Session s : sessions) {
if (s.isOpen()) {
try {
// send the article summary to all the connected clients
s.getBasicRemote().sendText("New article up:" + articleEvent.getArticle().getSummary());
} catch (IOException ex) { ... }
}
}
}
}
}
The EJB in the above example would do something like:
...
#Inject
Event<ArticleEvent> newArticleEvent;
public void publishArticle(Article article) {
...
newArticleEvent.fire(new ArticleEvent(article));
...
}
See the Java EE 7 Tutorial chapters on WebSockets and CDI Events.
Edit: Modified the #Observer method to use an event as a parameter.
Edit 2: wrapped the loop in broadcastArticle in synchronized, per #gcvt.
Edit 3: Updated links to Java EE 7 Tutorial. Nice job, Oracle. Sheesh.
Actually, WebSocket API provides a way how you can control endpoint instantiation. See https://tyrus.java.net/apidocs/1.2.1/javax/websocket/server/ServerEndpointConfig.Configurator.html
simple sample (taken from Tyrus - WebSocket RI test):
public static class MyServerConfigurator extends ServerEndpointConfig.Configurator {
public static final MyEndpointAnnotated testEndpoint1 = new MyEndpointAnnotated();
public static final MyEndpointProgrammatic testEndpoint2 = new MyEndpointProgrammatic();
#Override
public <T> T getEndpointInstance(Class<T> endpointClass) throws InstantiationException {
if (endpointClass.equals(MyEndpointAnnotated.class)) {
return (T) testEndpoint1;
} else if (endpointClass.equals(MyEndpointProgrammatic.class)) {
return (T) testEndpoint2;
}
throw new InstantiationException();
}
}
You need to register this to an endpoint:
#ServerEndpoint(value = "/echoAnnotated", configurator = MyServerConfigurator.class)
public static class MyEndpointAnnotated {
#OnMessage
public String onMessage(String message) {
assertEquals(MyServerConfigurator.testEndpoint1, this);
return message;
}
}
or you can use it with programmatic endpoints as well:
public static class MyApplication implements ServerApplicationConfig {
#Override
public Set<ServerEndpointConfig> getEndpointConfigs(Set<Class<? extends Endpoint>> endpointClasses) {
return new HashSet<ServerEndpointConfig>
(Arrays.asList(ServerEndpointConfig.Builder
.create(MyEndpointProgrammatic.class, "/echoProgrammatic")
.configurator(new MyServerConfigurator())
.build()));
}
#Override
public Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> scanned) {
return new HashSet<Class<?>>(Arrays.asList(MyEndpointAnnotated.class));
}
Of course it is up to you if you will have one configurator used for all endpoints (ugly ifs as in presented snippet) or if you'll create separate configurator for each endpoint.
Please do not copy presented code as it is - this is only part of Tyrus tests and it does violate some of the basic OOM paradigms.
See https://github.com/tyrus-project/tyrus/blob/1.2.1/tests/e2e/src/test/java/org/glassfish/tyrus/test/e2e/GetEndpointInstanceTest.java for complete test.
i am giving code.
Client
package a.b.client;
public class Trail implements EntryPoint{
Button b=new Button("Click");
FlowPanel fs=new FlowPanel();
int i=0;
private final TrailInterfaceAsync obj = GWT
.create(TrailInterface.class);
#Override
public void onModuleLoad() {
RootPanel.get().add(b);
RootPanel.get().add(fs);
b.addClickHandler(new ClickHandler(){
#Override
public void onClick(ClickEvent event) {
obj.getDetails(new AsyncCallback<ArrayList<String>>(){
#Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
#Override
public void onSuccess(ArrayList<String> result) {
try{
System.out.println("size:"+result.size());
for(i=1;i<=result.size()-1;i++)
{
HTML l=new HTML(result.get(i).toString());
fs.add(l);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}});
}});
}
}
Server
package a.b.server;
import a.b.client.TrailInterface;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
public class TrailImpl extends RemoteServiceServlet implements TrailInterface {
/**
*
*/
private static final long serialVersionUID = 1L;
#Override
public ArrayList<String> getDetails() {
Connection con;
Statement stmt;
ResultSet resultSet;
ArrayList<String> details=new ArrayList<String>();
try
{
System.setSecurityManager(null);
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager
.getConnection("jdbc:mysql://69.162.121.114:3306/AyushCareDB?"
+ "user=xxxxx&password=yyyyyy");
if(con!=null)
System.out.println("success!");
else
System.out.println("fail!");
stmt = con.createStatement();
// Result set get the result of the SQL query
resultSet = stmt.executeQuery("select * from LocationTable");
while(resultSet.next())
{
details.add(resultSet.getString(1));
}
}
catch(Exception e)
{
e.printStackTrace();
}
return details;
}
}
web.xml
<!-- Servlets -->
<servlet>
<servlet-name>TrailImpl</servlet-name>
<servlet-class>a.b.server.TrailImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TrailImpl</servlet-name>
<url-pattern>/trailpath/trail</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>Trail.html</welcome-file>
when i did Run As-Web Application
it showing error like this:
Jul 18, 2013 5:02:09 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: /%3C%=request.getContextPath()%%3E/trailpath/trailpath.nocache.js: java.lang.NumberFormatException: =r
i couldn't understand this where it come from? please help me.
as well as i tried to deploy this simple GWT project in Tomcat while it is working before(suddenly it showing above error).i didn't change any thing now. but getting above error. while it is working, i got fallowing error which is in post. but where i have to use GWT.getHostPageBaseURL() or GWT.getHostPageBaseURL() method in my code. i dont have any redirection to other pages hear. i couldn't found any solution for this.
POST:how to deploy GWT app to tomcat
At first sight, I'd say that you're referencing the trailing.nocache.js files from your Trail.html page using JSP syntax, but Trail.html is not evaluated as a JSP by the server (by default, only *.jsp files are treated as JSP).
The NumberFormatException: =r comes from the server when evaluating the URL (%3C%=request) where it expects %=r (from %=request) to evaluate as a URL escape. The NumberFormatException thus comes from trying to parse =r as an hexadecimal number.
Solution: remove the JSP syntax from your Trail.html page, or change that page to be evaluated as JSP (e.g. rename it to Trail.jsp)