留言板

NPE Starting Liferay

thumbnail
Gordon Augat,修改在7 年前。

NPE Starting Liferay

Regular Member 帖子: 107 加入日期: 06-8-16 最近的帖子
When trying to start Liferay 6.2 using the Liferay IDE 3.0.1, I get the following error.


java.lang.NullPointerException
	at java.util.Objects.requireNonNull(Objects.java:203)
	at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
	at java.util.Arrays.asList(Arrays.java:3800)
	at com.liferay.ide.core.util.FileListing.getFileListing(FileListing.java:67)
	at com.liferay.ide.server.tomcat.core.util.LiferayTomcatUtil.getAllUserClasspathLibraries(LiferayTomcatUtil.java:386)
	at com.liferay.ide.server.tomcat.core.LiferayTomcatRuntime.getUserLibs(LiferayTomcatRuntime.java:296)
	at com.liferay.ide.server.tomcat.core.util.LiferayTomcatUtil.getVersion(LiferayTomcatUtil.java:550)
	at com.liferay.ide.server.tomcat.core.LiferayTomcatRuntime.getPortalVersion(LiferayTomcatRuntime.java:207)
	at com.liferay.ide.server.tomcat.core.LiferayTomcatRuntime.validate(LiferayTomcatRuntime.java:389)
	at org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour.setupLaunch(TomcatServerBehaviour.java:491)
	at org.eclipse.jst.server.tomcat.core.internal.TomcatLaunchConfigurationDelegate.launch(TomcatLaunchConfigurationDelegate.java:96)
	at com.liferay.ide.server.tomcat.core.LiferayTomcatLaunchConfigDelegate.launch(LiferayTomcatLaunchConfigDelegate.java:72)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:731)
	at org.eclipse.wst.server.core.internal.Server.startImpl2(Server.java:3556)
	at org.eclipse.wst.server.core.internal.Server.startImpl(Server.java:3492)
	at org.eclipse.wst.server.core.internal.Server$StartJob.run(Server.java:367)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
</init>


I have noticed that the error only happens when I have Liferay running in a context other than ROOT. How do I get the Liferay IDE to working when Liferay is using a different context than ROOT?
thumbnail
David H Nebinger,修改在7 年前。

RE: NPE Starting Liferay

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Greg and team may have an answer for this, but just my own recommendation - don't do it.

I always recommend keeping the development environment simple, favor tomcat over jboss, use hsql instead of a separate db (if possible), and, for your case, develop on the ROOT context instead of non-root.

I'm not trying to downplay the importance these things have in your testing environment, pre-prod, etc. These environments serve you better when they are closer to the production environment.

The point here is that you want to focus your developers on their development tasks. Having them blow cycles trying to figure out how to get non-root contexts working, how to debug against jboss or a heavier-administration app server, etc., these are all things that do not help the development process, they only hinder it.

Maximize your development time by using the simplest development environment to get the work done. Once the work is done, you can push it up to your higher-level environments and deal with issues of how to get things working in a jboss cluster against a full-scale database platform and within the non-root context. I think you'll find your developers will actually end up being more productive.








Come meet me at the LSNA!
thumbnail
Gordon Augat,修改在7 年前。

RE: NPE Starting Liferay

Regular Member 帖子: 107 加入日期: 06-8-16 最近的帖子
Good points.

I just bring it up because, we have been running in a non ROOT context for 5 years and Liferay IDE 2.x worked just fine with a non ROOT context.

I guess we could develop using a ROOT context, but the way our production environment is setup required us not to use ROOT. Some other system was using the ROOT context. We really did not have a choice.
thumbnail
David H Nebinger,修改在7 年前。

RE: NPE Starting Liferay

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Like I said, the IDE team may chime in with a solution; I don't use non-root locally like ever, so I wouldn't have known it was not working myself.

I think many devs share the opinion that they need to make their environment match (somewhat) the production environment, but that's really not the case with Liferay development.

When you think about it, your code, whether a portlet or a hook or a theme or whatever, really doesn't have application server specific code and often not really environment-specific code. Because we use app server and database agnostic code, that means development aspects can be separated from operational aspects.

I find myself doing something similar for front-end development - I develop and test using chrome, not because my users are all using chrome, just because I find the developer tools easier to use in chrome. So I'll get the work done using chrome and worry about IE when I'm done and ready to move to test.

The one aspect that I will flip on is developing against the same database type as used in production, but that's really only for custom query development. I've seen developers get bitten too many times by getting a query working against mysql in development but fails miserably when using Oracle, simply because the SQL interpreter for mysql is a more forgiving than Oracle's. But if you're using native ServiceBuilder code (Hibernate-based) or DQ, then mysql or hsql is just fine because in the end the underlying framework will generate the right sql for the target DB.

I think this is a unique aspect of developing for Liferay; if I were building web applications (servlets), I would probably want a development environment matching production because many of the layers Liferay has added to isolate and eliminate app server/database differences just wouldn't be there in a normal servlet app.

Anyway I'll climb down off of my soapbox now, I'm sure you're not looking for some sort of general philosophical debate emoticon








Come meet me at the LSNA!
thumbnail
Joye Luo,修改在7 年前。

RE: NPE Starting Liferay

Regular Member 帖子: 144 加入日期: 16-5-3 最近的帖子
Hello Gordon Augat,

Thanks for your feedback. I test this with IDE 3.0.1 and Liferay SDK 6.2. It appear the same error as u. Finally we find that is a bug in liferay IDE. We will fix it in the next version. There is one way I tried to avoid this problem and it succeeded. I add a new server into liferay IDE without changing the root context. After it, I change the root context by following this link. It will be no problem. Hope that will help.

Best Regards,
Joye Luo
thumbnail
Joye Luo,修改在7 年前。

RE: NPE Starting Liferay

Regular Member 帖子: 144 加入日期: 16-5-3 最近的帖子
Hi Gordon Augat,
Did u still have this problem? I find a better way to solve this problem by looking for IDE-source code. Actually we check the user's custom context
path by the <docBase> attribute in ROOT.xml. So if u want to change the root context, you should add a <docBase> attribute to direct to your custom context path in ROOT.xml. I have changed my context path from ROOT to portal and it works well. Following are the things I have done:

1. change <installation-path-of-your-apache-tomcat>/webapps/ROOT to <installation-path-of-your-apache-tomcat>/webapps/portal
2. add portal-ext.properties file under <installation-path-of-your-apache-tomcat>/webapps/<your-renamed-liferay-folder>/WEB-INF/classes
the file content for me is : portal.ctx=/portal
3. add <docBase> attribute in <installation-path-of-your-apache-tomcat>/conf/Catalina/localhost/ROOT.xml. The ROOT.xml content for me now is:
<Context path="" crossContext="true" docBase="F:/liferay-bundle/62_test_server/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/portal">
</Context>

And there is no problem for me to start server in liferay IDE(liferay-ide-eclipse-windows-x64-3.0.1-ga2-201606151031). Hope that will be helpful. If u still have any problem about that. Please let us know.

Joye Luo
thumbnail
Gordon Augat,修改在7 年前。

RE: NPE Starting Liferay

Regular Member 帖子: 107 加入日期: 06-8-16 最近的帖子
This last solution fixed the problem! Thanks!
thumbnail
Luis J. Gomez,修改在6 年前。

RE: NPE Starting Liferay

New Member 发布: 1 加入日期: 15-2-20 最近的帖子
Hi Joye Luo,

thanks a lot, you've save my day.

Regards,
Luis J. Gómez