Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DynamicDSGenerator breaks other DS

    SmartClient Version: v9.1p_2015-01-02/PowerEdition Deployment (built 2015-01-02)

    Hi,
    until now I used xml generated DS. But now I need to add a DS which is going to have a dynamically set table name. So I decided to create a DynamicDSGenerator.
    Code:
    public class PersonalFolderDSGenerator implements DynamicDSGenerator {
    
        @Override
        public DataSource getDataSource(String s, DSRequest dsRequest) {
            DataSource dataSource = null;
            if(DataSourceEviLoader.getPersonalMessagesDsId().equals(s)) {
                StringBuffer stringBuffer = new StringBuffer();
                stringBuffer.append("<DataSource ID=\"personalMessages\" progressiveLoading=\"false\" requiresAuthentication=\"true\" schema=\"dev\" serverType=\"sql\" tableName=
    ...
                        "</DataSource>");
                try {
                    dataSource = DataSource.fromXML(stringBuffer.toString());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return dataSource;
        }
    I'm adding the generator in one of my configuration startup services
    Code:
    DataSource.addDynamicDSGenerator(new PersonalFolderDSGenerator());
    afterwards I'm loading the new DS like all my previous once
    Code:
    DataSource.load(personalMessages, new Function() {
    			@Override
    			public void execute() {
    					callback.execute();
    			}
    		});
    So far so good. But when I add the generator my IDACall is having problems creating an RPCManager instance. Which I use to authenticated users.

    Code:
    RequestContext context = RequestContext.instance(this, request, response);
    				RPCManager rpc = new RPCManager(request, response);
    				rpc.setAuthenticated(true);
    				rpc.setUserRoles(Lists.newArrayList(roles));
    the fallowing exception is thrown
    Code:
    java.lang.ClassCastException: com.isomorphic.js.JSExpression cannot be cast to java.lang.Long
    	at com.isomorphic.rpc.RPCManager.parseRequest(RPCManager.java:2317)
    	at com.isomorphic.rpc.RPCManager.<init>(RPCManager.java:377)
    	at com.evizone.rbp.ui.server.servlets.SecureIDACall.processRequest(SecureIDACall.java:82)
    	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    	at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    	at org.mortbay.jetty.Server.handle(Server.java:324)
    	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
    it seems that my "transactionNum" is empty and can't be thrown to a Long.

    No server logs attached because it doesn't come to the call. An error is returned in the response.

    Without the generator everything seems to be working fine.

    #2
    Shameless self bump

    Comment

    Working...
    X