Projects tigase _server server-core Issues #801
override the muc module not effect (#801)
来恩 周 opened 8 years ago
Due Date
2017-04-18

Hi, all

When I override the muc DiscoveryModule and configure it not effect?

My class is :


@Bean(name = DiscoveryModule3.ID, parent = MUCComponent.class, active = true)

public class DiscoveryModule3 extends tigase.component.modules.impl.DiscoveryModule {

.

.

.

}


init.properties configure is:


muc (class: tigase.muc.MUCComponent) {

admin (class: tigase.muc.modules.ModeratorModule3) {}

disco (class: tigase.muc.modules.DiscoveryModule3) {}

groupchat (class: tigase.muc.modules.GroupchatMessageModule3) {}

presences (class: tigase.muc.modules.PresenceModuleImpl3) {}

historyProviderPool (class: tigase.muc.history.HistoryProviderMDBean) {

	default (class: tigase.muc.history.HistoryProviderMDBean.HistoryProviderConfigBean) {
  1.  	'data-source' = 'mongoDataSource'
    
     	name = 'mucHistoryProvider' 
    
     	'repo-class' = 'tigase.mongodb.muc.MongoHistoryProvider'
    
     	instance (class: tigase.mongodb.muc.MongoHistoryProvider) {}
    
     }
    

    }

    'muc-dao' (class: tigase.muc.repository.MucDAOMDBean) {

     default (class: tigase.muc.repository.MucDAOMDBean.MucDAOProviderConfigBean) {
    
         instance (class: tigase.mongodb.muc.MongoMucDAO) {}
    
     }
    

    }

}

来恩 周 commented 8 years ago

init.properties configure is:


muc (class: tigase.muc.MUCComponent) {

admin (class: tigase.muc.modules.ModeratorModule3) {}

disco (class: tigase.muc.modules.DiscoveryModule3) {}

groupchat (class: tigase.muc.modules.GroupchatMessageModule3) {}

presences (class: tigase.muc.modules.PresenceModuleImpl3) {}

historyProviderPool (class: tigase.muc.history.HistoryProviderMDBean) {

	default (class: tigase.muc.history.HistoryProviderMDBean.HistoryProviderConfigBean) {

		name = 'mucHistoryProvider' 

    	'repo-class' = 'tigase.mongodb.muc.MongoHistoryProvider'

		instance (class: tigase.mongodb.muc.MongoHistoryProvider) {}

	}

}

'muc-dao' (class: tigase.muc.repository.MucDAOMDBean) {

    default (class: tigase.muc.repository.MucDAOMDBean.MucDAOProviderConfigBean) {

        instance (class: tigase.mongodb.muc.MongoMucDAO) {}

    }

}

}

Andrzej Wójcik (Tigase) commented 8 years ago

It would be good to state build number of Tigase XMPP Server and explain exactly what is not working, ie. what errors do you get?

At first I would suggest you to remove @Bean annotation from your class. It is only needed for automatic registration of beans and it is not needed at all if you are specifying bean class in a config file.

Please attach etc/config.dump file with whole configuration dump which will contain information about registered beans (including beans from automatic registration). Moreover please check logs for any errors and warnings and attach them if there are any.

来恩 周 commented 8 years ago

Sorry, I describe not enough detailed.

When I override the ModeratorModule named of ModeratorModule3, the ModeratorModule3 is copy from ModeratorModule.java file.

then I configure it at the init.properties file.

muc (class: tigase.muc.MUCComponent) {

admin (class: tigase.muc.modules.ModeratorModule3) {}

}

I start the XMPPServer, the muc component use ModeratorModule class still, not is ModeratorModule3 class.

but, if I delete this line 'kernel.registerBean(ModeratorModule.class).exec();' from MUCComponent.java file at 146 line, then muc component use ModeratorModule3 class. when I debug the code can jump into my ModeratorModule3 pocess method.

Andrzej Wójcik (Tigase) commented 8 years ago

I found that hardcoded modules (modules registered by registerModules() method) were being registered after configuration was applied, so they overwritten bean definition from a configuration file.

I changed execution order and now register() method (and as a result regusterModules() method) is called before configuration is applied. That way bean definition from configuration will be more important than hardcoded bean definition as it should be.

As a result of this change it is no longer possible to depend on bean configuration within register() and registerModules() methods, but it should not be done even before this change.

Next snapshot build of Tigase XMPP Server 7.2.0-SNAPSHOT will contain fix for this issue.

来恩 周 commented 8 years ago

ok,thank you for your help!

issue 1 of 1
Type
Bug
Priority
Major
Assignee
RedmineID
5303
Version
tigase-server-8.0.0
Estimation
6h
Spent time
28h 45m
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#801
Please wait...
Page is in error, reload to recover