That sounds like something is cached which is stale. Try restarting your servlet engine / application server. If that doesn't fix it, can you show the parent and inheriting DataSource definitions?
Announcement
Collapse
No announcement yet.
X
-
Ok ... I've verified this works if I put the table name in the base object as well but if I leave it out I get the class cast exception.
I've restarted JBoss so I don't think its stale data ...
my DataSource definition is fairly simple. This works ...
Code:<DataSource ID="ServiceType" serverType="sql" tableName="MyServiceType" recordName="MyServiceType"> <DataSource ID="MyServiceType" inheritsFrom="ServiceType" serverType="sql" tableName="MyServiceType" recordName="MyServiceType">
Code:<DataSource ID="ServiceType"> <DataSource ID="MyServiceType" inheritsFrom="ServiceType" serverType="sql" tableName="MyServiceType" recordName="MyServiceType">
Code:<DataSource ID="ServiceType" recordName="MyServiceType"> <DataSource ID="MyServiceType" inheritsFrom="ServiceType" serverType="sql" tableName="MyServiceType" recordName="MyServiceType">
Comment
-
Hi Mike,
That's actually expected and documented behavior. "inheritsFrom" just inherits field definitions from the parent DataSource, not other settings. So you do need to put just enough properties on the inheriting DataSource to make it clear it's a SQL DataSource - as you discovered, setting "tableName" is enough.
Comment
-
Thanks for that, based on what you said this seems to work (for anyone with a similar problem) ...
Code:<DataSource ID="ServiceType" serverType="sql"> <DataSource ID="MyServiceType" inheritsFrom="ServiceType" serverType="sql" tableName="MyServiceType" recordName="MyServiceType">
Can I use an enviroment variable for setting the DS directory in the server.properties ?
I've tried $DS_HOME and ${env.DS_HOME} without success ...
Comment
-
Also ... I seem to be only able to model one level of inheritance in the ds.xml files.
I can have
Code:<DataSource ID="ServiceType" serverType="sql"> <DataSource ID="MyServiceType" inheritsFrom="ServiceType" serverType="sql" tableName="MyServiceType" recordName="MyServiceType">
Code:<DataSource ID="OtherServiceType" serverType="sql"> <DataSource ID="MyServiceType" inheritsFrom="OtherServiceType" serverType="sql" tableName="MyServiceType" recordName="MyServiceType">
Code:<DataSource ID="ServiceType" serverType="sql"> <DataSource ID="OtherServiceType" serverType="sql" inheritsFrom="ServiceType"> <DataSource ID="MyServiceType" inheritsFrom="OtherServiceType" serverType="sql" tableName="MyServiceType" recordName="MyServiceType">
Code:java.lang.NullPointerException at com.isomorphic.sql.MysqlDriver.sqlOutTransform(MysqlDriver.java:158) at com.isomorphic.sql.SQLDataSource.getVariablesContext(SQLDataSource.java:1531) at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:994) at com.isomorphic.sql.SQLDataSource.execute(SQLDataSource.java:193) at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:708) at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:665) at com.isomorphic.application.AppBase.execute(AppBase.java:498) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1182) at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:155) at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:106) at com.isomorphic.servlet.IDACall.doPost(IDACall.java:54) 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)
Comment
-
Hi Mike,
We've found and fixed a bug that involved an interaction between multi-level DataSource inheritance and the SQL layer, you'll see the fix in the next release. In the meantime just use a single level of inheritance.
What's leading you to use multi-level inheritance and SQL at the same time by the way? Building your own Hibernate? :)
Comment
-
Originally posted by IsomorphicHi Mike,
We've found and fixed a bug that involved an interaction between multi-level DataSource inheritance and the SQL layer, you'll see the fix in the next release. In the meantime just use a single level of inheritance.
What's leading you to use multi-level inheritance and SQL at the same time by the way? Building your own Hibernate? :)
What about my other (small issue) w.r.t. using an enviroment variable in the server.properties ? I'd like to be able to setup a DS_HOME thats outside of the webroot and I'd rather not hardcode it ... Is this possible ?
Comment
-
Originally posted by IsomorphicAt the moment you would want to pre-process server.properties, possibly with a tool like Ant, as a deployment step.
I have a problem with Dynamic Datasource loading ... based on your suggestion earlier in this thread I'm using this ...
Code:RPCRequest rpcRequestProperties = new RPCRequest(); rpcRequestProperties.setEvalResult(true); rpcRequestProperties.setActionURL(dataSourceUrl); Map<String, String> map = new HashMap<String, String>(); map.put(dataSourceParamName, dataSourceName); rpcRequestProperties.setParams(map); RPCManager.sendRequest(rpcRequestProperties);
Except ... it doesn't work immediately.
Its a takes a little time to do the request and process the response. But I wanted to load the Datasources on demand (i.e. when a user opens a new window) and when I use the above method I get a race condition (of sorts) in that on the first call to open the window, I call to the server to load the DS, but when I try to bind the ds to whatever widget, it tells me that the DS is null. When I open the window subsequentially, it works. i.e. its already loaded.
I'm assuming I should be using RPCManager.send(data, callback, map) instead but I'm not sure how to preform setEvalResult(true) step with the above. I'm guessing I have to execute some JavaScript returned in the RPCResponse but I'm not sure how to do that. Any ideas ?
Comment
-
Originally posted by IsomorphicWith the signatures of send() that take a callback, the Map parameter is basically properties for an RPCRequest. So if you put("evalResult", true) into the Map, that's like setEvalResult(true) on RPCRequest.
We'll add signatures that actually take an RPCRequest to make it clearer.
I've tried every combination I can think of with the RPCManager.send method but I keep getting a null pointer exception in your server code (which I think is relating to not getting the list of datasources ...
Code:Map requestParams = new HashMap(); requestParams.put("evalResult", true); requestParams.put("dataSource", strBuf.toString()); RPCManager.setActionURL(dataSourceUrl); RPCManager.send("", new RPCCallback(){ @Override public void execute( RPCResponse response, Object rawData, RPCRequest request) { dataUiComp.bindComponents(); } }, requestParams);
Code:Map requestParams = new HashMap(); requestParams.put("evalResult", true); requestParams.put("dataSource", strBuf.toString()); RPCManager.setActionURL(dataSourceUrl); RPCManager.send("dataSource="+strBuf.toString(), new RPCCallback(){ @Override public void execute( RPCResponse response, Object rawData, RPCRequest request) { dataUiComp.bindComponents(); } }, requestParams);
Code:Map requestParams = new HashMap(); requestParams.put("evalResult", true); requestParams.put("dataSource", strBuf.toString()); RPCManager.setActionURL(dataSourceUrl); RPCRequest rpcRequestProperties = new RPCRequest(); rpcRequestProperties.setEvalResult(true); rpcRequestProperties.setActionURL(dataSourceUrl); rpcRequestProperties.setParams(requestParams); RPCManager.send("", new RPCCallback(){ @Override public void execute( RPCResponse response, Object rawData, RPCRequest request) { dataUiComp.bindComponents(); } }, JSOHelper.convertToMap(request.getJsObj()));
Code:16:39:02,550 INFO [STDOUT] === 2009-08-17 16:39:02,550 [80-3] ERROR DataSourceLoader - Top-level servlet error: javax.servlet.ServletException: java.lang.NullPointerException at com.isomorphic.servlet.DataSourceLoader.processRequest(DataSourceLoader.java:78) at com.isomorphic.servlet.DataSourceLoader.doPost(DataSourceLoader.java:57) 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.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
Comment
-
Are you sure ? ... I was using RPCManager.setActionURL to set the url and trace from the server saying an exception occured loading the datasource.
for the record ... this gives me the same exception, I'm fairly certain its because it can't find any dataSource field in the arguments.
Code:StringBuffer strBuf = generateString(dataSources); Map requestParams = new HashMap(); requestParams.put("evalResult", true); requestParams.put("actionURL", "sc/DataSourceLoader"); requestParams.put("dataSource", strBuf.toString()); RPCManager.send("", new RPCCallback(){ @Override public void execute( RPCResponse response, Object rawData, RPCRequest request) { dataUiComp.bindComponents(); } }, requestParams);
Code:18:44:50,767 INFO [STDOUT] === 2009-08-17 18:44:50,767 [80-8] ERROR DataSourceLoader - Exception while attempting to load a DataSource java.lang.NullPointerException at com.isomorphic.servlet.DataSourceLoader.processRequest(DataSourceLoader.java:78) at com.isomorphic.servlet.DataSourceLoader.doPost(DataSourceLoader.java:57) 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.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
Comment
Comment