Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Alex Belt
Ext Environment Compile Issue
May 16, 2013 7:07 AM
Answer

Alex Belt

Rank: Junior Member

Posts: 49

Join Date: October 9, 2012

Recent Posts

Hi All,

I'm having a database related issue when I build the EXT Environment. I've created a web service in the EXT Environment in Lilferay 5.2.3. When I compile and deploy Liferay without the EXT Environment, it works fine. As soon as I compile and deploy the EXT Environment, with or without the main Liferay code, it changes my database configuration from using SQLServer back to HSQL. The end result is, when I attempt to start Liferay after deploying the EXT Environment build, I get a massive stack trace on the screen because it's trying to update a non-existent HSQL database instead of looking at the SQL Server database it's supposed to.

The database connection information resides in Tomcat's server.xml as Resource tags, and the database connections are directly injected into DAO objects using Spring config files.

Has anyone encountered an issue like this before? Any ideas on how to solve it?

Thanks,
Alex
Anonymous
RE: Ext Environment Compile Issue
April 23, 2013 4:06 PM
Answer

Anonymous

Do you have the database connection information setup in a portal-ext.properties file?
Manish Yadav
RE: Ext Environment Compile Issue
April 24, 2013 4:25 AM
Answer

Manish Yadav

Rank: Expert

Posts: 384

Join Date: May 26, 2012

Recent Posts

Hello Alex Belt,

Might be you are missing to update porta-ext.properties present in <EXT>\docroot\WEB-INF\ext-impl\src\portal-ext.properties.Because when you deploy ext then portal-ext.properties will always override present in <liferay>/tomcat/webapps/ROOT/WEB-INF/classes/portal-ext.properties.

So before deploying EXT ensure that,both files should have same values porat-ext.properties in EXT and server

Thanks & Regards
Manish Yadav
Alex Belt
RE: Ext Environment Compile Issue
April 24, 2013 8:13 AM
Answer

Alex Belt

Rank: Junior Member

Posts: 49

Join Date: October 9, 2012

Recent Posts

Hi James,

No, the database information is not contained in portal-ext.properties. The only database config data is contained in the portal.properties, and it's the default HSQL config. It doesn't make sense to me though, that I can build and deploy Liferay and it finds the SQL Server configuration fine, but as soon as I add in the EXT Environment, it reverts to HSQL.

Thanks.

Update: I put some configuration data in the portal-ext.properties file, that stopped the HSQL errors, but it still doesn't run. Examining the Tomcat logs produces this:
...
SEVERE: Error listenerStart
Apr 24, 2013 org.apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors
Apr 24, 2013 org.apache.catalina.startup.ContextConfig stop
FINE: ContextConfig: Processing STOP
Apr 24, 2013 3:01:10 PM org.apache.catalina.startup.ContextConfig init
FINE: ContextConfig: Initializing
...
Apr 24, 2013 org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load javax.servlet.Servlet. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1273)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at org.apache.catalina.loader.WebappClassLoader.validateJarFile(WebappClassLoader.java:2294)
at org.apache.catalina.loader.WebappClassLoader.addJar(WebappClassLoader.java:682)
at org.apache.catalina.loader.WebappLoader.setRepositories(WebappLoader.java:1010)
at org.apache.catalina.loader.WebappLoader.start(WebappLoader.java:650)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4212)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)


Any ideas?
Anonymous
RE: Ext Environment Compile Issue
April 24, 2013 1:35 PM
Answer

Anonymous

Hi Alex,

Manish is correct. You want to create a file called portal-ext.properties in your LIFERAY_HOME directory. The portal will detect this and make any of the changes you have in there instead of making changes in portal.properties. For instance to connect to MySQL you could set the file to something like this:


# MySQL
#
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/DATABASENAME?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=USERNAME
jdbc.default.password=PASSWORD

You can read about it here:

http://www.liferay.com/documentation/liferay-portal/6.1/user-guide/-/ai/using-liferay-s-setup-wizard

and

http://www.liferay.com/documentation/liferay-portal/6.1/user-guide/-/ai/using-an-overridden-configuration-file
Alex Belt
RE: Ext Environment Compile Issue
April 25, 2013 7:08 AM
Answer

Alex Belt

Rank: Junior Member

Posts: 49

Join Date: October 9, 2012

Recent Posts

I did that, but it still won't work. It refuses to load Liferay, and to make matters worse, I only get the stack trace as I indicated in my previous post - there is no indication what might be wrong, only that it failed to start and won't run.
Manish Yadav
RE: Ext Environment Compile Issue
April 25, 2013 7:15 AM
Answer

Manish Yadav

Rank: Expert

Posts: 384

Join Date: May 26, 2012

Recent Posts

Please follow below steps
1 keep your db setting properties in only portal-ext.properties. [<LIFERY_HOME>/tomcat/webapps/ROOT/WEB-INF/classes/portal-ext.properties].and no where else
2. copy same file portal-ext.properties in your ext ->impl->src->portal-ext.properties

Hope this will help you
Alex Belt
RE: Ext Environment Compile Issue
April 25, 2013 10:45 AM
Answer

Alex Belt

Rank: Junior Member

Posts: 49

Join Date: October 9, 2012

Recent Posts

I can appreciate that I should do that, but I don't think I can. I'm working on an already existing site where the database connections are being injected to DAOs using Spring JDBC. Plus, there are multiple database connections, not just one, and it doesn't appear that the db properties allow for more than one connection. If I move all the database connection information to portal-ext.properties, I would have to do some significant re-writing of our existing application, which is not acceptable. Thanks anyway.
Alex Belt
RE: Ext Environment Compile Issue
May 16, 2013 11:16 AM
Answer

Alex Belt

Rank: Junior Member

Posts: 49

Join Date: October 9, 2012

Recent Posts

I finally managed to get a stack trace - there's a Spring related error in the EXT Environment. When it goes to start up, it tries to instantiate the data sources into the generated service impl classes, but it can't. I'm trying to figure out why it won't.

Has anyone else run into this?
Gaurang Sheladia
RE: Ext Environment Compile Issue
May 16, 2013 11:20 AM
Answer

Gaurang Sheladia

Rank: Regular Member

Posts: 160

Join Date: February 15, 2009

Recent Posts

Hi Alex,

Are you getting spring error like bean reference or something else can you please post your error?

Thanks
Alex Belt
RE: Ext Environment Compile Issue
May 16, 2013 12:33 PM
Answer

Alex Belt

Rank: Junior Member

Posts: 49

Join Date: October 9, 2012

Recent Posts

Actually, I have finally solved the problem. It turns out that the ext-spring.xml file was not getting configured with the JNDI database information, so it couldn't inject the database connections into the Spring beans. Once I put the jndi info into the file and deployed it, it worked like a charm.