smartgwt + gwt-rpc or REST + spring - spring

Hi
I am currently working on a project and basing my design proposal on a SOA architecture and am including GWT components for UI . I am new to GWT and after reading through a week of posts of GWT and SmartGWT and trying out samples i would like to introduce SmartGWT into my organization w/o the server-side integration. That is because we already have spring services and would like them to remain re-usable through the organization. So my main interest is in the ui components of Smart GWT and in some fashion (either gwt-rpc or REST ) connect to the backend exposed services.
I am developing on SmartGWT 2.4 and gwt2.2+ . I have gone through the posts on GWT-rpc and tried using the sample api presented. However i ran into a couple issues .
Running the ListGridSample 'as is' i get the following ERROR although the application runs.
Am using the sample from here
23:31:37.101 [ERROR] [listgridtest] 23:31:37.088:RDQ5:WARN:ResultSet:isc_ResultSet_0 (created by: isc_OID_1):get: invalid index -1
com.smartgwt.client.core.JsObject$SGWT_WARN: 23:31:37.088:RDQ5:WARN:ResultSet:isc_ResultSet_0 (created by: isc_OID_1):get: invalid index -1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:619)
I next wanted to remove all the redundant jars present in the example project and update the smartgwt jars and gwt-servlet jar to see if it is still compatible. I received this
23:37:06.584 [ERROR] [listgridtest] Unable to load module entry point class mytest.client.YourEntryPoint (see associated exception for details)
com.google.gwt.core.client.JavaScriptException: (TypeError): Object [object Object] has no method 'getNextGlobalIDForClass'
stack: TypeError: Object [object Object] has no method 'getNextGlobalIDForClass'
at unknown source
at __gwt_jsInvoke (ttp://127.0.0.1:8888/listgridtest/hosted.html?listgridtest:76:35)
at ttp://127.0.0.1:8888/listgridtest/hosted.html?listgridtest:280:16
at z (ttp://127.0.0.1:8888/listgridtest/listgridtest.nocache.js:2:144)
at ttp://127.0.0.1:8888/listgridtest/listgridtest.nocache.js:8:589
arguments: getNextGlobalIDForClass,[object Object]
type: undefined_method
__gwt_ObjectId: 2
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:129)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.smartgwt.client.util.SC.generateID(SC.java)
at com.smartgwt.client.widgets.BaseWidget.<init>(BaseWidget.java:102)
at com.smartgwt.client.widgets.Canvas.<init>(Canvas.java:75)
at mytest.client.YourEntryPoint.onModuleLoad(YourEntryPoint.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:183)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:619)
I read somewhere on the smartclient forums not to mix the smartgwtee and smartgwt jars so i double checked (because i was evaluating the ee edition b4this but that required a learning in the datasource concept ). So i am using gwt2.2+ and smart-gwt2.4.
I have read through the quick start pdf (quickly) and decided that although the server side integration may have benefits for a quick introduction within my organization it would not work.
So from an system standpoint if i understand correctly you could define your datasource for your partricular widgets and then use the GenericGwtService to pass on to your business services before or after you send back the DSresponse.
Can you kindly point me to a quick sample which actually does this in the latest version or a document which specifies exactly how to do it ? or an api or a forum post which addresses this for the latest versions.
Hopefully that would help me springify the sample miniapp.. which would help me POC.
Any input appreciated.
Thanks,

Answered something similar here - Smartgwt DataSource with gwt requestfactory etc
You can also look at JSON datasources
http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/data/XJSONDataSource.html

Related

Is it currently possible to swap pulsar in for Kafka in spring-cloud-streams

I've been trying to do some searching (Google, Slack, Stack) and have yet to find an answer. We have some applications that are written using Spring Cloud Streams and were interested in swapping the back end from Kafka to Pulsar. Spring currently doesn't have any native support for Kafka, however it appears that pulsar provides the ability to use the Kafka API to communicate with pulsar directly (https://pulsar.apache.org/docs/en/adaptors-kafka).
I'm wondering if anybody has gone down the route of trying to use this replacement for the Kafka-clients library in the context of Spring cloud messaging.
An alternative valid approach, of course, is to just re-write the code - but I wanted to turn to the community to see if anybody has gone down this road as of yet.
Thanks
While not exactly what you're asking for, I've tried to integrate Pulsar with Spring-Kafka using the shaded library org.apache.pulsar:pulsar-client-kafka:2.5.0 and it blows-up with this stack trace:
Caused by: java.lang.UnsupportedOperationException: null
at org.apache.kafka.clients.consumer.KafkaConsumer.partitionsFor(KafkaConsumer.java:650) ~[pulsar-client-kafka-2.5.0.jar:2.5.0]
at org.springframework.kafka.listener.AbstractMessageListenerContainer.checkTopics(AbstractMessageListenerContainer.java:312) ~[spring-kafka-2.2.10.RELEASE.jar:2.2.10.RELEASE]
at org.springframework.kafka.listener.ConcurrentMessageListenerContainer.doStart(ConcurrentMessageListenerContainer.java:136) ~[spring-kafka-2.2.10.RELEASE.jar:2.2.10.RELEASE]
at org.springframework.kafka.listener.AbstractMessageListenerContainer.start(AbstractMessageListenerContainer.java:292) ~[spring-kafka-2.2.10.RELEASE.jar:2.2.10.RELEASE]
at org.springframework.kafka.config.KafkaListenerEndpointRegistry.startIfNecessary(KafkaListenerEndpointRegistry.java:311) ~[spring-kafka-2.2.10.RELEASE.jar:2.2.10.RELEASE]
at org.springframework.kafka.config.KafkaListenerEndpointRegistry.start(KafkaListenerEndpointRegistry.java:255) ~[spring-kafka-2.2.10.RELEASE.jar:2.2.10.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.1.10.RELEASE.jar:5.1.10.RELEASE]
This specific error can be bypassed (for these specific library versions) using a custom implementation of AbstractMessageListenerContainer.checkTopics but you'll likely run into more issues.

OSGi ClassNotFoundException while loading Database Driver

I know this is a common problem, but creating a new thread just in case if some one is stuck like me even after trying some of the options already explained in documentions.
I have deployed an osgi bundle (Say Bundle B) which have all the code related to Data layer access. Basically when a service method from this bundle is accessed, it creates a JDBC connection for the very first time only, by loading the driver. The Driver is deployed as another wrapped bundle of sqljdbc 4.0. (Say Bundle C)
Now I have Bundle TestApp (Say Bundle A) which creates an instance the above said service method from Bundle B. So the flow here is Bundle A code creates an instance of Bundle B's exported service which in turn access Bundle C's Driver class.
Caused by: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver not found by DataServices [417]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1556)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1993)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
The individual classloader is making the probelm here, but how to overcome is the situation here for me. I tried adding DynamicImport-Package to bundles A, B, tried creating a Fragment bundle as expained here https://gist.github.com/rotty3000/1291842 but still the same exception. Continues.
If anyone came across such an issue, it would be a great help if you could give me a step by step approach to get rid of this issue.
Thank you in advance and Happy new year of all.
The Driver approach is not working well in OSGi. Instead use a DataSource.
See example at msdn. You can simply create a datasource using new. This avoids any classloading problems.
If you want to decouple from the actual DB provider then you can use the OSGi jdbc spec which defines that db providers should expose a DataSourceFactory that can create a DataSource for you.
Pax-jdbc supports this spec for a big range of db providers. It allows has a pax-jdbc-config module that allows to create a DataSource as an OSGi service using just a config. So in you code you can just inject the service and are done. Additionally pax-jdbc-config also can take care of pooling and making the DataSource XA aware. So it produces a fully production ready DataSource.

Web services deployment in IBM Web sphere

Good Morning all,
I have problem while deploying my web app in IBM WAS.
I have spring ws and during the deployment, I get the below error,
Caused by: javax.xml.soap.SOAPException: Unable to create message factory for SOAP: Unable to create SAAJ meta-factorycom.ibm.ws.webservices.engine.soap.SAAJMetaFactoryImpl incompatible with javax.xml.soap.SAAJMetaFactory
at javax.xml.soap.MessageFactory.newInstance(Unknown Source)
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.afterPropertiesSet(SaajSoapMessageFactory.java:145)
I have packaged the saaj-api 1.3 and saaj impl 1.3 jars in my application and i can see them in the lib folder.
I have set the class loading properties in the WAS to parent last.
Any clue or Where am I going wrong?
I'm using WAS version 7.0.0.11
I added this entry to the MANIFEST file to solve this issue,
DisableIBMJAXWSEngine: true
Hope this helps some one.

spring jdbc suddenly throws class not found error on SingleColumnRowMapper

I have been developing a Spring project about 6 months. This project is built with maven and spring. Suddenly today i discovered that jdbc sections of the code throwing the error below. I made some changes to my web services in the project lately but I did not change any maven configurations or spring configurations since the last time the application worked stable. Where should I start to look for the error?
Any comment is appreciated.
Caused by: java.lang.NoClassDefFoundError: org/springframework/jdbc/core/SingleColumnRowMapper
at org.springframework.jdbc.core.JdbcTemplate.getSingleColumnRowMapper(JdbcTemplate.java:1184)
at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:744)
at com.pozitron.bkmtransfer.core.dao.AcsKeyAliasDaoImpl.findRsaPubKeyByBankId(AcsKeyAliasDaoImpl.java:43)
at com.pozitron.bkmtransfer.services.core.CipherActionImpl.verify(CipherActionImpl.java:97)
at com.pozitron.bkmtransfer.services.TransferActionImpl.transferMoney(TransferActionImpl.java:67)
at com.pozitron.bkmtransfer.ws.endpoints.TransferEndPoint.transferMoney(TransferEndPoint.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
At first make sure that you have this class (jar) on your classpath. If you do then make sure that you have only one version of this class in your classpath. It might be that new jar was included if you changed/added some dependencies.
Also, if you're starting your app from the eclipse then the only thing you might be needing is to do project->clean
P.S. Are you getting this error at compile time or runtime?

500 Server Error based on HardDeadlineExceededError

I have a simple spring web application that only has spring mvc and spring roo setup. For some reason on all of my old app instances, when I uploaded this sample application, it always gets a "hanging/exceeded time" error in the logs. Even in the case of basic spring mvc setup. The logs I've seen are below. I am a bit confused since the same application was working previously until today, and now even the simple deployments to google app engine are returning a 500 error. Any help would be appreciated, but I just want to see if this is an issue people are seeing with spring mvc specifically or with the latest google app engin sdk?:
Uncaught exception from servlet
com.google.apphosting.runtime.HardDeadlineExceededError: This request (c22ac44effde64c8) started at 2012/03/13 15:39:52.285 UTC and was still executing at 2012/03/13 15:40:54.889 UTC.
at com.google.appengine.runtime.Request.process-c22ac44effde64c8(Request.java)
at java.util.zip.ZipFile.read(Native Method)
at java.util.zip.ZipFile.access$1200(ZipFile.java:57)
at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:476)
at java.util.zip.ZipFile$1.fill(ZipFile.java:259)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
at sun.misc.Resource.getBytes(Resource.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:273)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at org.springframework.web.servlet.view.tiles2.SpringTilesApplicationContextFactory.createApplicationContext(SpringTilesApplicationContextFactory.java:55)
Try using warmup requests.
This is a localized problem - app engine seems to be having problems system wide, especially badly for M/S applications. See https://groups.google.com/forum/?fromgroups#!topic/google-appengine/js5CeRWLQZ0

Resources