« Zurück zu 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 Anhänge
57183 Angesehen
Durchschnitt (2 Stimmen)
Die durchschnittliche Bewertung ist 5.0 von max. 5 Sternen.
Kommentare
Antworten im Thread Autor Datum
Hey, the portal.properties file contains some... Jakub Liska 6. Oktober 2010 10:26
The portlets loads, there are no users on the... Jakub Liska 6. Oktober 2010 17:42
Ouch, sorry, the instructions didn't mention... Jakub Liska 6. Oktober 2010 17:46
Just to clarify :- ) the first comment, the... Jakub Liska 6. Oktober 2010 18:11
Hi Jakub, u are right,I forgot to mention that... José Miguel Trinchán 9. Oktober 2010 04:16
Hi again, I update the project in SourceForge... José Miguel Trinchán 9. Oktober 2010 05:10
Hi, thank You for this portlet! By the way,... gofri _ 4. Februar 2011 08:03
i use a mssql server these are my settings,... steve rieger 26. Mai 2011 09:00

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.
Gepostet am 06.10.10 10:26.
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)
Gepostet am 06.10.10 17:42.
Ouch, sorry, the instructions didn't mention that one must modify lportal-connection-pool.properties with database credentials.
Gepostet am 06.10.10 17:46.
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)
Gepostet am 06.10.10 18:11.
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.
Gepostet am 09.10.10 04:16.
Hi again,
I update the project in SourceForge with case sensitive SQL queries, so I hope it works well now in MySQL.
Gepostet am 09.10.10 05:10.
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")
Gepostet am 04.02.11 08:03 als Antwort auf 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
Gepostet am 26.05.11 09:00 als Antwort auf gofri _.