« Back to Portlets

GeoIP UsersMap

Introduction #

Portal users are geographically located by their ip's and displayed with Google Maps API, indicating their cities, countries, flags, etc . The GeoIP UsersMap portlet utilizes Max Mind's GeoIP City Database.

The GeoIP UsersMap portlet is a independent portlet and dont require any other plugging or portlet to work.

Configure #

  • 1. Get the GeoIP UsersMap, modify lportal-connection-pool.properties with database credentials and deploy porlet for your Liferay Portal version.
  • 2. Shut down your application server.
  • 3. Download the GeoIP City Database, such as the free GeoLite City Database.
  • 4. Unzip the .dat file to your desired storage path (default: /usr/local/share/GeoIP/), but path can also been configurated in porlet.properties file.
  • 5. Generate a Google Maps API Key
  • 6. Start your application server.
  • 7. Deploy the GeoIP UsersMap portlet.
  • 8. Go to the configuration section inside the own portlet and configure the Google Maps API Key and the desired height.
  • 9. Save changes and reload the page.
0 Attachments
23305 Views
Average (2 Votes)
The average rating is 5.0 stars out of 5.
Comments
Threaded Replies Author Date
Hey, the portal.properties file contains some... Jakub Liska October 6, 2010 10:26 AM
The portlets loads, there are no users on the... Jakub Liska October 6, 2010 5:42 PM
Ouch, sorry, the instructions didn't mention... Jakub Liska October 6, 2010 5:46 PM
Just to clarify :- ) the first comment, the... Jakub Liska October 6, 2010 6:11 PM
Hi Jakub, u are right,I forgot to mention that... José Miguel Trinchán October 9, 2010 4:16 AM
Hi again, I update the project in SourceForge... José Miguel Trinchán October 9, 2010 5:10 AM
Hi, thank You for this portlet! By the way,... gofri _ February 4, 2011 8:03 AM
i use a mssql server these are my settings,... steve rieger May 26, 2011 9:00 AM

Hey, the portal.properties file contains some windows metacharacters....it's encoded into ^M .... it means " include-and-override=portlet-ext.properties^M" so that the file is not included because of it.
Posted on 10/6/10 10:26 AM.
The portlets loads, there are no users on the map, and I get this error:

00:29:47,399 WARN [BasicResourcePool:1224] com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@20c1568f -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30).
java.sql.SQLException: Connections could not be acquired from the underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:104)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0P­ooledConnectionPool.java:264)
at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java­:94)
at com.mchange.v2.c3p0.ComboPooledDataSource.getConnection(ComboPooledDataSource.ja­va:521)
at com.liferay.geoipusersmap.util.LPortalConnectionPool._getConnection(LPortalConne­ctionPool.java:177)
at com.liferay.geoipusersmap.util.LPortalConnectionPool.getConnection(LPortalConnec­tionPool.java:64)
at com.liferay.geoipusersmap.model.GeoIPUsersMapDAO.getUsersData(GeoIPUsersMapDAO.j­ava:74)
at org.apache.jsp.view_jsp._jspService(view_jsp.java:254)

Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAcquire(BasicResourcePool.jav­a:972)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool­.java:208)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0P­ooledConnectionPool.java:260)
Posted on 10/6/10 5:42 PM.
Ouch, sorry, the instructions didn't mention that one must modify lportal-connection-pool.properties with database credentials.
Posted on 10/6/10 5:46 PM.
Just to clarify :- ) the first comment, the property file is not properly encoded for utf-8 linux. The second comment was my fault caused by overlooking the database conf file. And the final comment is, that there is sql select for 'lportal.user_' table ... it should be 'lportal.User_' .... so that there are these errors:

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'lportal.user_' doesn't exist
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
Posted on 10/6/10 6:11 PM.
Hi Jakub,

u are right,I forgot to mention that one must modify lportal-connection-pool.properties with database credentials. I updated the wiki now, thx.

respect to the user_ table its because my current liferay portal is implemented with PostgreSQL database (instead MySQL) and all tables are in lowercase.

Before I published the portlet, I change the driver to MySQL in lportal-connection-pool.properties to doit more compatible, but forgot also change the "user_" to "User_" table in the DAO file.

Thx for your comment.
Posted on 10/9/10 4:16 AM.
Hi again,
I update the project in SourceForge with case sensitive SQL queries, so I hope it works well now in MySQL.
Posted on 10/9/10 5:10 AM.
Hi, thank You for this portlet!
By the way, I've made some changes for my case:
-I didn't understand the reason to connect to DB. I am using UserLocalServiceUtil.getGroupUsers(groupId) to get all group/community users. This makes configuration simpler (LPortalConnectionPool removed).
- In view.jsp GeoIPUsersMapDAO.getUsersData(scopeGroupId) parameter is added. This allows to list users only in current scope group (a-la "members list")
Posted on 2/4/11 8:03 AM in reply to José Miguel Trinchán.
i use a mssql server

these are my settings, yet they dont seem to work

driver.class=com.jdts.jdbc.Driver
jdbc.url=jdbc:jtds:sqlserver://192.168.15.2­22/lportal
user=user
password=password
min.pool.size=1
max.pool.size=5
acquire.increm­ent=1
Posted on 5/26/11 9:00 AM in reply to gofri _.