Forums de discussion
[RESOLVED] Liferay 6: Multiple Datasources Issue
Matt Lewis, modifié il y a 13 années.
[RESOLVED] Liferay 6: Multiple Datasources Issue
New Member Publications: 6 Date d'inscription: 26/04/10 Publications récentes
Hi.
I am using Liferay Developer Studio/Liferay Portal 6.0.5/Tomcat 6.0.26. I have created my schema in the liferay database under a separate namespace using service builder/hibernate/mysql...no problem. I have setup the mysql connection through a connection pool and everything is working fine.
The problem I am having is now I want to write to separate mysql db outside the default liferay connection pool that is shared by another outside existing app.
Here are my changes:
server.xml:
root.xml
web.xml
And now I am just trying to connect to it to get the connection like this:
But I am unsuccessful and I keep getting this error:
21:34:25,240 ERROR [PortletServlet:96] javax.portlet.PortletException: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
javax.portlet.PortletException: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
Any ideas? Anything would help.
Thanks
matt
I am using Liferay Developer Studio/Liferay Portal 6.0.5/Tomcat 6.0.26. I have created my schema in the liferay database under a separate namespace using service builder/hibernate/mysql...no problem. I have setup the mysql connection through a connection pool and everything is working fine.
The problem I am having is now I want to write to separate mysql db outside the default liferay connection pool that is shared by another outside existing app.
Here are my changes:
server.xml:
<resource auth="Container" driverClassName="com.mysql.jdbc.Driver" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" maxActive="50" maxIdle="10" maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="240" validationQuery="SELECT 1" name="jdbc/matt" username="root" password="root" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/matt" />
root.xml
<resourcelink global="jdbc/matt1" name="jdbc/matt" type="javax.sql.DataSource" />
web.xml
<resource-ref>
<res-ref-name>jdbc/matt1</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
And now I am just trying to connect to it to get the connection like this:
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/matt");
Connection connection = ds.getConnection();
But I am unsuccessful and I keep getting this error:
21:34:25,240 ERROR [PortletServlet:96] javax.portlet.PortletException: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
javax.portlet.PortletException: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
Any ideas? Anything would help.
Thanks
matt
Matt Lewis, modifié il y a 13 années.
RE: Liferay 6: Multiple Datasources Issue
New Member Publications: 6 Date d'inscription: 26/04/10 Publications récentes
So everyone's liferay deployment are simple one database deployments?
How are you guys setting up multiple databases?
Thanks
matt
How are you guys setting up multiple databases?
Thanks
matt
jelmer kuperus, modifié il y a 13 années.
RE: Liferay 6: Multiple Datasources Issue
Liferay Legend Publications: 1191 Date d'inscription: 10/03/10 Publications récentes
Your question is completely unrelated to Liferay
consult the tomcat documentation on how to configure jndi datasources
consult the tomcat documentation on how to configure jndi datasources
Matt Lewis, modifié il y a 13 années.
RE: Liferay 6: Multiple Datasources Issue
New Member Publications: 6 Date d'inscription: 26/04/10 Publications récentesjelmer kuperus:
Your question is completely unrelated to Liferay
consult the tomcat documentation on how to configure jndi datasources
Which is what I thought to but then after reading more and more posts... I have everything setup correctly in tomcat so it has to be a liferay thing?
http://www.liferay.com/community/forums/-/message_boards/message/4372077
Thanks
Matt Lewis, modifié il y a 13 années.
RE: Liferay 6: Multiple Datasources Issue
New Member Publications: 6 Date d'inscription: 26/04/10 Publications récentes
If you are using Liferay Developer Studio and you want to get this to work...you need to create context.xml file in your /docroot/META-INF.
context.xml
Using everything in the first post, all I did was create this file and everything started working correctly.
matt
context.xml
<context path="" docbase="" debug="5" reloadable="true" crosscontext="true">
<resourcelink global="jdbc/matt" name="jdbc/matt" type="javax.sql.DataSource" />
</context>
Using everything in the first post, all I did was create this file and everything started working correctly.
matt
Krati Gupta, modifié il y a 13 années.
RE: Liferay 6: Multiple Datasources Issue
Regular Member Publications: 119 Date d'inscription: 05/12/08 Publications récentes
Hi All,
I am using Liferay 5.2.3 and want to connect Liferay-tomcat6.0 with 3 different databases apart from liferay database .
And My requirement is that when a user search user in search box of website , so the user will be search in all the 4 databases and after that result will come .
Please tell this could be possible in Liferay or not ?and if possible so please help me how to implement it .
I am using Liferay 5.2.3 and want to connect Liferay-tomcat6.0 with 3 different databases apart from liferay database .
And My requirement is that when a user search user in search box of website , so the user will be search in all the 4 databases and after that result will come .
Please tell this could be possible in Liferay or not ?and if possible so please help me how to implement it .