-
1. Re: How to add a resource-adapter programatically?
rareddy Jun 19, 2013 6:26 PM (in response to madhu.garimilla)Anything operations that can be done through CLI can be done through a JAVA program. See https://github.com/teiid/teiid/blob/master/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java
-
2. Re: How to add a resource-adapter programatically?
madhu.garimilla Jun 24, 2013 9:26 AM (in response to rareddy)Hi Ramesh,
I tried with below code to add a file data source programmatically.
Admin admin = AdminFactory.getInstance().createAdmin("localhost",9999,"admin","admin".toCharArray());
Properties p = new Properties();
p.setProperty("class-name","org.teiid.resource.adapter.file.FileManagedConnectionFactory");
p.setProperty("pool-name", "marketdata-file");
p.setProperty("max-pool-size", "4");
p.setProperty("enabled", "true");
p.setProperty("use-java-context", "true");
p.setProperty("ParentDirectory", "../data/");
p.setProperty("AllowParentPaths", "true");
admin.createDataSource("java:/marketdata-file","teiid-connector-file.rar",p);
This shows up the below error in jboss console. Am i missing anything here? How do i avoid this error.
15:32:52,571 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.ra.deployment."teiid-connector-file.r
ar_1": org.jboss.msc.service.StartException in service jboss.ra.deployment."teiid-connector-file.rar_1": org.jboss.jca.core.spi.mdr.NotFoundException:
IJ000855: teiid-connector-file isn't registered
at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:127)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_03]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_03]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]
Caused by: org.jboss.jca.core.spi.mdr.NotFoundException: IJ000855: teiid-connector-file isn't registered
at org.jboss.jca.core.mdr.SimpleMetadataRepository.getResourceAdapter(SimpleMetadataRepository.java:150)
at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:87)
... 5 more
15:32:52,673 INFO [org.jboss.as.controller] (management-handler-thread - 22) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.ra.deployment."teiid-connector-file.rar_1": org.jboss.msc.service.StartException in s
ervice jboss.ra.deployment."teiid-connector-file.rar_1": org.jboss.jca.core.spi.mdr.NotFoundException: IJ000855: teiid-connector-file isn't registered
Thanks
-
3. Re: How to add a resource-adapter programatically?
rareddy Jun 24, 2013 11:04 AM (in response to madhu.garimilla)try
admin.createDataSource("java:/marketdata-file","file",p);
In 8.4, the RAR files have been converted to use JBoss modules and they have simple names like "file".
Ramesh..
-
4. Re: How to add a resource-adapter programatically?
madhu.garimilla Jun 25, 2013 11:28 AM (in response to rareddy)We are using teiid 8.1. Is there anyway that we could do this in 8.1?
-
5. Re: How to add a resource-adapter programatically?
rareddy Jun 25, 2013 1:20 PM (in response to madhu.garimilla)The original code above should be right one then. Look in 8.1 branch otherwise. Also note there is bug JBoss AS JCA connection factory creation if added it once and deleted and added with same name again.
as per the above exception, you need to make sure "teiid-connector-file.rar" has been deployed. You can a call "admin.getDataSourceTemplateNames" to make sure.
Ramesh..
-
6. Re: How to add a resource-adapter programatically?
madhu.garimilla Jun 25, 2013 1:54 PM (in response to rareddy)Hi Ramesh,
teiid-connector-file.rar is already deployed. I have checked with admin.getDataSourceTemplateNames and teiid-connector-file.rar is coming as part of it.I see the data source getting added and the vdb referring to it also getting deployed properly but i was not able to query the data source because of the exception i was getting while creating the data source. When i try to query, It says "TEIID30504 text-connector: TEIID30481 Failed to find the Connection Factory with JNDI name java:marketdata-file."
Are you referring to the bug https://issues.jboss.org/browse/AS7-4776 ? Currently I am using jboss 7.1.1.
-
7. Re: How to add a resource-adapter programatically?
rareddy Jun 25, 2013 1:58 PM (in response to madhu.garimilla)Yes, I was referring to that issue. It got better with JBoss EAP 6.1 alpha build, so you can try using that. EAP 6.1 Alpha works with Teiid 8.4
Also where is "/" in your name? shouldn't that be "java:/marketdata-file"?
Ramesh..
-
8. Re: How to add a resource-adapter programatically?
madhu.garimilla Jun 25, 2013 2:09 PM (in response to madhu.garimilla)Is there any other way that we could read the data from a csv file and refer to it through a teiid view?
-
9. Re: How to add a resource-adapter programatically?
madhu.garimilla Jun 25, 2013 11:05 PM (in response to rareddy)"/" is given while creating the data source but it was not present in the error message i got while querying the data source
-
10. Re: How to add a resource-adapter programatically?
rareddy Jun 26, 2013 8:29 AM (in response to madhu.garimilla)Pls attach your log file, if it is too long, delete and restart the server and re-run the testcase and attach that. I do not see anything wrong with it so far.
-
11. Re: How to add a resource-adapter programatically?
madhu.garimilla Jun 27, 2013 10:35 AM (in response to rareddy)Hi Ramesh, I tried the following 2 approaches.
Approach 1:
With jboss 7.1.1 and teiid 8.1 , I tried to add a file data source using the below code and it resulted in an exception which i mentioned in my earlier post, attached the log(jboss_711_Teiid_81.log).
Admin admin = AdminFactory.getInstance().createAdmin("localhost",9999,"admin","admin".toCharArray());
final Properties p = new Properties();
p.setProperty("class-name","org.teiid.resource.adapter.file.FileManagedConnectionFactory");
p.setProperty("pool-name", "marketdata-file");
p.setProperty("max-pool-size", "4");
p.setProperty("enabled", "true");
p.setProperty("use-java-context", "true");
p.setProperty("ParentDirectory", "../data/");
p.setProperty("AllowParentPaths", "true");
admin.createDataSource("java:/marketdata-file","teiid-connector-file.rar",p);
Approach 2:
With jboss-eap-6.1 and teiid 8.4,I tried to add a file data source using the below code and it resulted in an exception in my test case, attached the log (jboss_eap_61_Teiid_81.log)
Admin admin = AdminFactory.getInstance().createAdmin("localhost",9999,"admin","admin".toCharArray());
final Properties p = new Properties();
p.setProperty("class-name","org.teiid.resource.adapter.file.FileManagedConnectionFactory");
p.setProperty("pool-name", "marketdata-file");
p.setProperty("max-pool-size", "4");
p.setProperty("enabled", "true");
p.setProperty("use-java-context", "true");
p.setProperty("ParentDirectory", "../data/");
p.setProperty("AllowParentPaths", "true");
admin.createDataSource("java:/marketdata-file", "file", p);
-
jboss_eap_61_Teiid_81.log.zip 787 bytes
-
jboss_711_Teiid_81.log.zip 3.5 KB
-
-
12. Re: How to add a resource-adapter programatically?
rareddy Jun 27, 2013 1:47 PM (in response to madhu.garimilla)try
Admin admin = AdminFactory.getInstance().createAdmin("localhost",9999,"admin","admin".toCharArray()); final Properties p = new Properties(); p.setProperty("class-name","org.teiid.resource.adapter.file.FileManagedConnectionFactory"); p.setProperty("ParentDirectory", "../data/"); p.setProperty("AllowParentPaths", "true"); admin.createDataSource("java:/marketdata-file","teiid-connector-file.rar",p);
-
13. Re: How to add a resource-adapter programatically?
madhu.garimilla Jul 1, 2013 5:40 AM (in response to rareddy)Thanks Ramesh. I could get this working.
However, I still have the problem (https://issues.jboss.org/browse/AS7-4776 ) while deleting and readding data source as i am using Jboss 7.1.1 and Teiid 8.1.
-
14. Re: How to add a resource-adapter programatically?
madhu.garimilla Jul 15, 2013 4:11 AM (in response to rareddy)Hi Ramesh,
I tried to test this by adding multiple file data sources.
{code} final Admin admin = AdminFactory.getInstance().createAdmin("localhost",9999,"admin","admin".toCharArray());
final Properties p = new Properties();
p.setProperty("class-name","org.teiid.resource.adapter.file.FileManagedConnectionFactory");
p.setProperty("ParentDirectory", "${jboss.home.dir}/../data/");
p.setProperty("AllowParentPaths", "true");
admin.createDataSource("java:/marketdata-file","teiid-connector-file.rar",p);
final Properties p1 = new Properties();
p1.setProperty("class-name","org.teiid.resource.adapter.file.FileManagedConnectionFactory");
p1.setProperty("ParentDirectory", "${jboss.home.dir}/../data/");
p1.setProperty("AllowParentPaths", "true");
admin.createDataSource("java:/marketdata-file1","teiid-connector-file.rar",p1);{code}
Then it throws the below exception in the jboss console.
13:28:58,987 INFO [org.jboss.as.connector.deployers.RaXmlDeployer] (MSC service thread 1-2) IJ020001: Required license terms for file:/C:/Chorus/CAR/
Work/jboss-as-7.1.1.Final/standalone/tmp/vfs/temp98701600a4006a0e/teiid-connector-file.rar-4c490c2c33dad3d0/contents/
13:28:58,993 INFO [org.jboss.as.deployment.connector] (MSC service thread 1-2) JBAS010406: Registered connection factory java:/marketdata-file
13:28:58,996 INFO [org.jboss.as.connector.deployers.RaXmlDeployer] (MSC service thread 1-2) IJ020002: Deployed: file:/C:/Chorus/CAR/Work/jboss-as-7.1
.1.Final/standalone/tmp/vfs/temp98701600a4006a0e/teiid-connector-file.rar-4c490c2c33dad3d0/contents/
13:28:58,998 INFO [org.jboss.as.deployment.connector] (MSC service thread 1-8) JBAS010401: Bound JCA ConnectionFactory [java:/marketdata-file]
13:28:59,379 INFO [org.jboss.as.deployment.connector] (MSC service thread 1-11) JBAS010410: Unbound JCA ConnectionFactory [java:/marketdata-file]
13:28:59,381 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-16) MSC00001: Failed to start service jboss.ra.deployment."teiid-connector-file.
rar_1": org.jboss.msc.service.StartException in service jboss.ra.deployment."teiid-connector-file.rar_1": org.jboss.jca.core.spi.mdr.NotFoundException
: IJ000855: teiid-connector-file isn't registered
at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:127)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_03]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_03]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]
Caused by: org.jboss.jca.core.spi.mdr.NotFoundException: IJ000855: teiid-connector-file isn't registered
at org.jboss.jca.core.mdr.SimpleMetadataRepository.getResourceAdapter(SimpleMetadataRepository.java:150)
at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:87)
... 5 more
13:28:59,453 INFO [org.jboss.as.controller] (management-handler-thread - 1) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.ra.deployment."teiid-connector-file.rar_1": org.jboss.msc.service.StartException in s
ervice jboss.ra.deployment."teiid-connector-file.rar_1": org.jboss.jca.core.spi.mdr.NotFoundException: IJ000855: teiid-connector-file isn't registered
Where as this works fine when i add only one file data source. Though it is adding the resource adapters in the standalone-teiid.xml, those are working fine only after a jboss restart.