cancel
Showing results for 
Search instead for 
Did you mean: 

JSP and AJAX

Former Member
0 Kudos

Hey

i was trying to create a jsp application using ajax. the ajax framework i am trying to use is dwr from http://getahead.org/dwr.

it all works fine when i deploy my application from eclipse and also start it from there. but when i start the mi client the normal way i get an error.

i added the dwr.jar to listofJars.txt file.

can anybody image where this error might come from?

java.lang.ClassCastException

at org.directwebremoting.impl.StartupUtil.initWebContext(StartupUtil.java:120)

at org.directwebremoting.servlet.DwrServlet.init(DwrServlet.java:75)

at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)

at org.apache.tomcat.core.Handler.init(Handler.java:215)

at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296)

at org.apache.tomcat.core.Handler.service(Handler.java:254)

at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)

at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)

at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)

at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)

at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)

at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)

at java.lang.Thread.run(Thread.java:534)

i am posting here because this error occurs only when starting the mi client, not when starting the application using the debug button in eclipse.

thx Philipp

Accepted Solutions (1)

Accepted Solutions (1)

stefan_schwing
Active Participant
0 Kudos

Hi Philipp,

the DWR site says: "DWR requires JDK 1.3 or later and a servlet engine that supports servlet spec version 2.2 or later"

The MI client JSP on the PDA uses a JVM with the Personal Java Profile (~Java 1.1.8) and Tomcat 3.2.1 Servlet Engine with an older servlet spec, afaik.

So, chances are low you'll be able to get this running on MI / PDA.

cheers stefan

Former Member
0 Kudos

Hi Stefan

Thank you very much, i must have missed this requirements on the dwr page

Philipp

Answers (6)

Answers (6)

Former Member
0 Kudos

i did put the dwr.jar into the folder \mi\lib folder and added \mi\lib\dwr.jar to the listOfJars file on my mobile device, restarted it and tried to start my application. now it does not even find the jar file. what did i do wrong.

is it better to put it into \mi\webapps\myapplication\WEB-INF\lib?

it finds the class then, but cannot load it

this is the error

Error: 500

Location: /HELLOWORLD/dwrInternal Servlet Error:

java.lang.NoClassDefFoundError: uk/ltd/getahead/dwr/DWRServlet

at java.lang.ClassLoader.resolveClass()

at org.apache.tomcat.loader.AdaptiveClassLoader.loadClass()

at org.apache.tomcat.loader.AdaptiveServletLoader.loadClass()

at org.apache.tomcat.core.ServletWrapper.loadServlet()

at org.apache.tomcat.core.ServletWrapper.init()

at org.apache.tomcat.core.Handler.service()

at org.apache.tomcat.core.ServletWrapper.service()

at org.apache.tomcat.core.ContextManager.internalService()

at org.apache.tomcat.core.ContextManager.service()

at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection()

at org.apache.tomcat.service.TcpWorkerThread.runIt()

at org.apache.tomcat.util.ThreadPool$ControlRunnable.run()

at java.lang.Thread.run()

i am confused

Philipp

Former Member
0 Kudos

Hi

You need to edit the CremeListOfJars.txt file on a PDA and not the ListOfJars.txt file.

Best Regards

Sivakumar

Former Member
0 Kudos

Hi Sivakumar

thanks, it worked partly

i am only getting this error now:

Internal Servlet Error:

java.lang.NoClassDefFoundError.

Damn, is there any help or should i just work without ajax?

Philipp

Former Member
0 Kudos

Hi Bruno,

no i did not test my application an a pda yet, but i am sure it wont work

an a pda the mi client ist started using ....StartUp not with FramworkInitializer. i am not sure how i can solve this problem.

Which Ajax Framework do you use? I read in another thread, that you have a jsp application running using ajax.

Greets,

Philipp

Former Member
0 Kudos

Hello Philipp

I hope you very well know the fact the MI uses its own Class Loader on JVM version 1.3, 1.4 and 1.5. If you are using MI on a PDA then the JVM version is 1.1.8 and MI doesnt use its Class Loader but relies on the JVM class loader. For details on MI Class Loader please <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/com.sap.km.cm.docs/library/mobile/mobile%20infrastructure/mobile%20development%20kit%202.5/content/appdev/devonme/me_classloader.html">click here</a>. The reason i mention this here is to emphasise the difference between Startup class and FrameworkInitializer class. It is the Startup class that decides whether to use MI Class Loader of the JVM Class Loader. So might be that MI Class Loader fails to load the classes contained in dwr.jar. If you run you app on a PDA, i am sure it might work without any changes being done (even thought Startup class is called first) since MI relies on the JVM Class Loader. It is not recommended to start MI using the FrameworkInitializer class on either laptop or on PDA. Please try and let me know. In the meanwhile i will check if this can be achieved on laptop as well.

Hope this helps.

Best Regards

Sivakumar

Former Member
0 Kudos

Hi Sivakumar

i will have a look if the application runs fine on my pda. using the frameworkinitializer class was the only way i could use the ajax framework. maybe ill find another way. i will keep on trying and let you know if i can archive it in any way.

Philipp

Former Member
0 Kudos

Hey

from eclipse i am starting this main class = com.sap.ip.me.core.FrameworkInitializer

my client runs with this main class = com.sap.ip.me.core.Startup

after changing from startup to frameworkinitializer it works fine.

but this is only a workaround. what could i do to fix this on every client

Philipp

Former Member
0 Kudos

Hi Philipp,

Did you test your application with DWR in any PDA? Is yes, what JVM?

Regards,

Bruno

Former Member
0 Kudos

hi Sivakumar

as i already wrote,

it works fine when starting from eclipse.

thats why i am a bit confussed.

Philipp

Former Member
0 Kudos

i only have one version installed

Former Member
0 Kudos

Hi

Have you done the steps mentioned http://getahead.org/dwr/getstarted

Best Regards

Sivakumar

Former Member
0 Kudos

Hi Philipp

Kindly check whether the JVM used by Eclipse and by MI Client are of the same version or not. For me this seems to be only problem. I hope you know how to find the same

Best Regards

Sivakumar