vahidhedayati / grails-wschat-plugin

Grails websocket chat Plugin provides a multi-chat room add-on to an existing grails based site. provides: Private Messaging/WebRTC/Offline PM + room booking/reservations. Websocket TicTactoe. Add Live Chat to your Grails application
http://grails.org/plugin/wschat
Apache License 2.0
22 stars 10 forks source link

Can not run the application ... Gives the compiler error like below JRE 1.7.0_75 Grails 2.3.5 #5

Closed samism91 closed 9 years ago

samism91 commented 9 years ago

Compilation error: startup failed: C:\Users\admin\Documents\workspace-sts-3.6.4.RELEASE\GrailProject\grails-app\controllers\grails\plugin\wschat\WsChatController.groovy: 4: unable to resolve class org.grails.plugins.web.taglib.ApplicationTagLib @ line 4, column 1. import org.grails.plugins.web.taglib.ApplicationTagLib ^ C:\Users\admin\Documents\workspace-sts-3.6.4.RELEASE\GrailProject\grails-app\services\grails\plugin\wschat\WsChatConfService.groovy: 4: unable to resolve class grails.core.GrailsApplication @ line 4, column 1. import grails.core.GrailsApplication ^ C:\Users\admin\Documents\workspace-sts-3.6.4.RELEASE\GrailProject\grails-app\services\grails\plugin\wschat\WsChatConfService.groovy: 5: unable to resolve class grails.core.support.GrailsApplicationAware @ line 5, column 1. import grails.core.support.GrailsApplicationAware ^ C:\Users\admin\Documents\workspace-sts-3.6.4.RELEASE\GrailProject\grails-app\services\grails\plugin\wschat\client\WsChatClientService.groovy: 8: unable to resolve class org.grails.web.json.JSONObject @ line 8, column 1. import org.grails.web.json.JSONObject ^ C:\Users\admin\Documents\workspace-sts-3.6.4.RELEASE\GrailProject\grails-app\services\grails\plugin\wschat\client\WsClientProcessService.groovy: 6: unable to resolve class org.grails.web.json.JSONObject @ line 6, column 1. import org.grails.web.json.JSONObject ^ C:\Users\admin\Documents\workspace-sts-3.6.4.RELEASE\GrailProject\grails-app\services\grails\plugin\wschat\client\WsClientProcessService.groovy: 5: unable to resolve class org.grails.web.json.JSONArray @ line 5, column 1. import org.grails.web.json.JSONArray ^ C:\Users\admin\Documents\workspace-sts-3.6.4.RELEASE\GrailProject\grails-app\services\grails\plugin\wschat\users\WsChatBookingService.groovy: 14: unable to resolve class org.grails.plugins.web.taglib.ApplicationTagLib @ line 14, column 1. import org.grails.plugins.web.taglib.ApplicationTagLib ^ 7 errors

BuildConfig.groovy class

dependencies {
    // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
     runtime 'mysql:mysql-connector-java:5.1.27'
     compile "org.grails.plugins:wschat:1.18"
    // runtime 'org.postgresql:postgresql:9.3-1100-jdbc41'
}

plugins {
    // plugins for the build system only
    build ":tomcat:7.0.50"

    // plugins for the compile step
    compile ":scaffolding:2.0.1"
    compile ':cache:1.1.1'
    compile ':wschat:1.18'

    // plugins needed at runtime but not for compilation
    runtime ":hibernate:3.6.10.7" // or ":hibernate4:4.1.11.6"
    runtime ":database-migration:1.3.8"
    runtime ":jquery:1.10.2.2"
    runtime ":resources:1.2.1"
    // Uncomment these (or add new ones) to enable additional resources capabilities
    //runtime ":zipped-resources:1.0.1"
    //runtime ":cached-resources:1.1"
    //runtime ":yui-minify-resources:0.1.5"
}
vahidhedayati commented 9 years ago

That all looks like the imports for the grails 3 plugin Grails 3: https://github.com/vahidhedayati/grails-wschat-plugin/blob/master/grails-app/controllers/grails/plugin/wschat/WsChatController.groovy#L4

Grails 2: https://github.com/vahidhedayati/grails-wschat-plugin/blob/grails2/grails-app/controllers/grails/plugin/wschat/WsChatController.groovy#L9

I will take a look into it later this evening are you sure you not been doing stuff locally on grails 3 and now gone back to grails 2 ? looks rather strange try doing a grails clean and as I said I will take a look later at this.

Personally I can't see how I could have compiled/packaged/published a grails 2 plugin with grails 3 imports....

If you been doing other strange stuff such as cloning and runing as an inline then try

git clone -b grails2 https://github.com/vahidhedayati/grails-wschat-plugin
vahidhedayati commented 9 years ago

Have you sorted it ?. It is definitely something on your local machine, those errors relate to grails 3 imports.

In regards to your BuildConfig

// plugins for the build system only
    build ":tomcat:7.0.50"

This needs to change to:

// plugins for the build system only
    build ":tomcat:7.0.55"

It does say in bold on the README that it works with tomcat 7.0.54+

You also need Config.groovy entries

wschat.add.appName='yes'
wschat.dbsupport='yes'
wschat.defaultperm='admin'
wschat.rooms = ['room1','room2','room3']
wschat.showtitle="no"
wschat.hostname='localhost:8080'
stunServers { iceServers=[ [url: 'stun:stun.l.google.com:19302'] ] }
wschat.send.leftroom='yes'
wschat.send.joinroom='yes'
config.frontenduser='_frontend'
config.storeForFrontEnd=false
wschat.dbstore=true
wschat.dbstore_pm_messages=true
wschat.dbstore_room_messages=true
wschat.debug=true
wschat.timeout=0
wschat.camtimeout=0

Besides that try clearing out your cache/ do a

clean all

Which removes all plugins and downloads them again.. You may have to clear out .grails and .m2 folders..

If that don't work I suggest you try it from another user profile on that machine or another machine..

samism91 commented 9 years ago

Changed it to: // plugins for the build system only build ":tomcat:7.0.55"

Added code in Config.groovy also

Remove .m2 and .grails ....

Still not working...

Trying to do something other things also....

vahidhedayati commented 9 years ago

Well its still an issue on you rmachine, it took me under 5 minutes to create an app add the config and get it up and running, I logged in fine into the chat room using a browser too.

https://github.com/vahidhedayati/testwschat237

This is a demo site created under Linux with Java 1.7 and Grails 2.3.5

Configure your Environment variables for java and grails. so that in your dos command prompt, you can

git clone https://github.com/vahidhedayati/testwschat237
cd testwschat237
grails run-app

I would highly recommend stepping away from your STS since from the errors above, it was some caching in your STS pulling in the wrong imports. I still think there is a lot more you have done that has caused the above issues but you haven't gone into. Or that you have some strange configuration in your STS.

samism91 commented 9 years ago

Thanks its working now perfectly with your test app demo.... But finding some issues like can not send messages and etc.. But that's it ..

samism91 commented 9 years ago

I ll appreciate you if you can just help me how to integrate it in my grails application exactly..... Like whats the configuration and how to connect my user database what is proper format... In simple, its like guidelines to implement in my application.... If you can help me to sort this out.....

vahidhedayati commented 9 years ago

Firstly in regards to issues sending messages ? was this something as a one off ? or can you not send messages in the room or to a person. If its a real issue you have spotted, then please write the steps to reproduce it.

In regards to integration into your own app, A little unsure on what would be best practise. I ended up creating a separate app for the chat and running two instances on the same host. tomcat1 serving main app and tomcat2 running chat app.

https://github.com/vahidhedayati/kchat (should help you sort it out, is the app as it was when I was running it. There are extra bits in regards to permissions on the main page which can be ignored if all its going to do is serve chat.

This way what ever DB etc is created is all in a contained app and does not impact actual application.

In regards to domain Classes created, I suggest you take a look here:

https://github.com/vahidhedayati/grails-wschat-plugin/tree/master/grails-app/domain/grails/plugin/wschat

Everything starts with a table of chat_ besides off_line_messages.

samism91 commented 9 years ago

Hii, Vahid ... Thanks for your reply.. What I simply do is: Just clone your app in my eclipse (STS) and then just run the app http://localhost:8080/testwschat237/wsChat/chat And send the message and got the : Error.... Tiktok disconnecting from server... Nothing is working properly... Do I need some preconfiguration?

samism91 commented 9 years ago

"I ended up creating a separate app for the chat and running two instances on the same host. tomcat1 serving main app and tomcat2 running chat app." Why you should need to run two different tomcat... Can't you initialize your chat app in main application ? Isn't it possible. I just want to use it....

vahidhedayati commented 9 years ago

Looks like I hard coded my ip: https://github.com/vahidhedayati/testwschat237/blob/master/grails-app/conf/Config.groovy#L121

wschat.hostname='192.168.1.196:8080'

change above in your config and it should all work

I ended up doing something one way which worked best for the scenario, its entirely up to you how you wish to do things. Whether its all in one app, in two wars running in one tomcat or two separate wars in separate JVM's.

samism91 commented 9 years ago

Yes, that's working. What I want to make actually is just simple messaging chat application with file transfer functionality for my grail app. Can I use your? Is it possible to make it done by changing your code? If yes, is it possible to fetch users from my database...?

vahidhedayati commented 9 years ago

Well yes quite simple really. Look at the tag lib and where it loads in templates. You or any one els using plug in can override those templates. Just follow the attrs required to load in this templates and load in chat via tagliatelle and override templates

https://github.com/vahidhedayati/grails-wschat-plugin/wiki/Custom-calls

Then using actual plug in template take that and modify to be and look like what you want it to be.

Sorry in the phone can't really expand further

Yes, that's working. What I want to make actually is just simple messaging chat application with file transfer functionality for my grail app. Can I use your? Is it possible to make it done by changing your code? If yes, is it possible to fetch users from my database...?

— Reply to this email directly or view it on GitHub https://github.com/vahidhedayati/grails-wschat-plugin/issues/5#issuecomment-117447060 .

vahidhedayati commented 9 years ago

Your after wschat.js where ever that gets called so in your own template declare new js file in your app that follows wschat.js and look at how the use menu is being generated. Change those to match what your requirements are

https://github.com/vahidhedayati/grails-wschat-plugin/blob/master/grails-app/taglib/grails/plugin/wschat/WsChatTagLib.groovy#L63

if (template) { out << g.render(template:template, model:model) }else{ out << g.render(contextPath: pluginContextPath, template : "/${CHATVIEW}/chat", model: model) }

Calls _chat template by default, so use the tablib or initial link given to call your own template:

Copy this template: https://github.com/vahidhedayati/grails-wschat-plugin/blob/grails2/grails-app/views/wsChat/_chat.gsp

And load this in https://github.com/vahidhedayati/grails-wschat-plugin/blob/grails2/grails-app/views/wsChat/_chat.gsp#L9

This renders at the top

Change this or leave this as it is. if left copy this to your root views folder:

https://github.com/vahidhedayati/grails-wschat-plugin/blob/grails2/grails-app/views/_resources.gsp

change this to wschat2.js:

https://github.com/vahidhedayati/grails-wschat-plugin/blob/grails2/grails-app/views/_resources.gsp#L14

copy this https://github.com/vahidhedayati/grails-wschat-plugin/blob/grails2/web-app/js/wschat.js

to your web-app/js folder as wschat2.js

You need to ammend this:

https://github.com/vahidhedayati/grails-wschat-plugin/blob/grails2/web-app/js/wschat.js#L195-L615

To do what you want it to do.

Beyond this I would have to write it for you since this is a step by step guide

On 1 Jul 2015 07:37, "Vahid Hedayati" vahid.hedayati@gmail.com wrote:

Well yes quite simple really. Look at the tag lib and where it loads in templates. You or any one els using plug in can override those templates. Just follow the attrs required to load in this templates and load in chat via tagliatelle and override templates

https://github.com/vahidhedayati/grails-wschat-plugin/wiki/Custom-calls

Then using actual plug in template take that and modify to be and look like what you want it to be.

Sorry in the phone can't really expand further

Yes, that's working. What I want to make actually is just simple messaging chat application with file transfer functionality for my grail app. Can I use your? Is it possible to make it done by changing your code? If yes, is it possible to fetch users from my database...?

— Reply to this email directly or view it on GitHub https://github.com/vahidhedayati/grails-wschat-plugin/issues/5#issuecomment-117447060 .

vahidhedayati commented 9 years ago

So you had me thinking, this should be all a lot easier.

I have released 1.18-SNAPSHOT1

This is done in grails 2.4.4 so follow the same guide but rather than assets/javascript it will be web-apps/js (that you place your custom js file in you app)

https://github.com/vahidhedayati/testwschat/blob/master/grails-app/views/test/index.gsp#L23

 <chat:connect 
 chatuser="testuser3"
 profile="[email: 'test2@example.com']" 
 usermenujs="mymenu.js"
 />

Same thing https://github.com/vahidhedayati/testwschat/blob/master/grails-app/views/test/index2.gsp but a different user.

I split wschat.js to two parts in the main plugin there is wschatjs and usermenujs

usermenujs is actually processMessage of websockets. Most of it is the user menu:

This is my custom one above.

https://github.com/vahidhedayati/testwschat/blob/master/grails-app/assets/javascripts/mymenu.js

Which does exactly what you want user add remove and only feature is to send file - no cam etc..

This is the actual file the plugin uses.

https://github.com/vahidhedayati/grails-wschat-plugin/blob/grails2/web-app/js/usermenu.js

So copy this over and call it something else then call it in like above and change what you like so far as the users see when they view the chat options such as add / remove pm webcam etc etc..

If you wanted to override the core wschat.js

 <chat:connect 
 chatuser="testuser3"
 profile="[email: 'test2@example.com']" 
 wschatjs="mywschat.js"
 usermenujs="mymenu.js"
 />

This is probably and by far the easiest way of customising chat to be what you want.

samism91 commented 9 years ago

Thanks a lot.......I ll look at it and will use it as soon as I become aware of it,,,,,,,,,

vahidhedayati commented 9 years ago

I was testing this under resources and there appeared to be some issues. (even under assets based sites), so quite a few bugs fixed including removal of duplicate js css files added by plugin..

https://github.com/vahidhedayati/testwschat235

compile "wschat:1.18-SNAPSHOT2"

This is now doing what you want it to do . If there are other menu options you wish to add / or remove further options simply edit mymenu.js inside that site and with usermenu.js within the plugin.

I want to do a major tidyup on the plugin but don't have the time at the moment. For now this is what you were after and should work with future releases.

vahidhedayati commented 8 years ago

Hey sorry if you are still usingn it

Take a look at the new release and the new usermenu.js which has il8n.gsp, you can now call menu options what you like. Most importantly the way usermenu works is a lot more cleaner and easier to manage.