Solved

Dwr cannot find the path

Posted on 2009-07-14
9
383 Views
Last Modified: 2012-05-07
Why dwr cannot find util.js, my Ajax class and interface.js ?. Actually it works fine in my local enviorment but when i deployed the app in our dev box (Which uses an IP address as a URL) it does not recognize anything.

For local machine i did this and worked like a charm.
/projectname/dwr/interface/USER.js
/projectname/dwr/util.js

But when i am deploying it in the test enviorment it does not work. Anyhow i tried this also but still no luck

<% String base = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() ;
%>

and i did this :-

<script type="text/javascript" src='<%=base%>/dwr/interface/USER.js"></script>
0
Comment
Question by:Micheal_Male
  • 6
  • 3
9 Comments
 
LVL 92

Expert Comment

by:objects
ID: 24855573
whats the url of the page?  Does it include context name?
0
 

Author Comment

by:Micheal_Male
ID: 24855633
It does not include context name. Actually the URL is hidden because of the usage of frames. So in otherwords user will never see the exact path of the URL where the addUser.htm sits.

0
 

Author Comment

by:Micheal_Male
ID: 24855641
I tried so many senarios but still no luck. I even tried :-

<% String context = request.getContextPath %> and i do not get any value out of it.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 92

Expert Comment

by:objects
ID: 24855644
do you kknow what the url to the js should be?
where is the js in your webapp?
0
 

Author Comment

by:Micheal_Male
ID: 24855663
Exactly that is the whole point. How can i get the util.js, engine.js file ?. When i tested the app in my local machine i never had those files. As mentioned in the docs i just did :-

/projectname/dwr/util.js

and it worked fine. I extracted the dwr.jar file tryng to find those 2 files but unfortunately could'nt find those.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 50 total points
ID: 24855698
the files need to added to your webapp so they are available to be requested.
0
 

Author Comment

by:Micheal_Male
ID: 24855732
Thanks for your answers. I downloaded the DWR 1.0 war file from :-

http://directwebremoting.org/dwr/download.html

Extracted in eclipse and still not able to find the util.js or interface in the dwr package. It's very wiered that JS error on my application is that it cannot find my USER class where i already have specified in dwr.xml and applicationContext.xml for calling my service layer.

0
 

Author Comment

by:Micheal_Male
ID: 24856184
We are using SUn Solaris. This is the path where we deploy our application (WAR file).
/home/usr/appartment.web.com/document/

Under document foler i extracted the Appartment.WAR. So now i have all the contents of my Appartment WAR file which contains WEB-INF folder, jsp packages, etc.
Under /home/usr/appartment.web.com/document/WEB-INF
i have my applicationContext.xml and my *servlet.xml and dwr.xml. This is how my dwr.xml looks like :-

dwr.xml
<!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
 "http://www.getahead.ltd.uk/dwr/dwr10.dtd">
 <dwr>
 <allow>
 <create creator="spring" javascript="USER">
 <param name="beanName" value="userHandler"></param>
 </create>
 </allow>
 </dwr>
 
This is the refrence to my applicationContext.xml
      <bean id="userService" class="user.service.impl.UserServiceImpl">
      <property name="userDao"><ref local="userDao"/></property>
      </bean>
<bean id="userHandler" class="user.controller.USERHandler">
      <property name="userService"> <ref local="userService"/></property>
      </bean>
<bean id="userDao" class="user.dao.impl.UserDaoImpl">
      <property name="dataSource"><ref bean="dataSource"/></property>
      </bean>

As per you i created a seperated folder dwr under :-
/home/usr/appartment.web.com/document/
and extracted the contents of the dwr.war file in
/home/usr/appartment.web.com/document/dwr

This is what i have in my addUser.jsp

<script type="text/javascript" src="<%= basePath %>/dwr/interface/USER.js"></script>
<script type="text/javascript" src="<%= basePath %>/dwr/engine.js"></script>
.

I get an error stating that dwr.invoker.servlet cannot find a class by the name of USER.
0
 

Accepted Solution

by:
Micheal_Male earned 0 total points
ID: 24856709
I found the problem. Actually the problem lies that i did not had the dwr.xml path in the config parameter in web.xml. After adding the config path to my dwr.xml and setting the load-on-startup everything work great. There is no need of deploying the DWR package or anything like that.

That iswhy you had the dwr.jar file to take care of it instead of unzipping it. Hope this helps other people. Thanks for your support,
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
allswap challenge 6 99
Cipher Configuration on Apache HTTPD 4 62
tomcat startup error 5 65
spring jars download 1 27
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question