Deploying theme and portlets in Liferay running on non root context - liferay

Our Liferay Server is setup on a non-root context. The portal context is setup as -
portal.ctx=/lportal
As a result of this the theme that we developed doesn’t work. The images css are not loading in the non root context.
Also, the custom css that the portlets have those are also not loading.
Any clues on how to fix this.
Regards,
Tina

We ran into the same problem, and we solved it by using a custom deployment descriptor for the application server.
We were using WebLogic, so we added a weblogic.xml file to the theme, with a context-root directive specifying the non-root context:
<?xml version="1.0"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
<context-root>/foo/your-theme</context-root>
</weblogic-web-app>
Instructions for doing this with Tomcat or JBoss should be fairly similar.
And then you also have to specify the virtual path in the Liferay theme descriptor (liferay-look-and-feel.xml)
<?xml version="1.0"?>
<!DOCTYPE look-and-feel PUBLIC "-//Liferay//DTD Look and Feel 6.0.0//EN" "http://www.liferay.com/dtd/liferay-look-and-feel_6_0_0.dtd">
<look-and-feel>
<compatibility>
<version>6.1.10+</version>
</compatibility>
<theme id="foo-theme" name="Foo Theme">
<virtual-path>/foo/your-theme</virtual-path>
</theme>
</look-and-feel>
After redeploying the theme, the links to CSS, javascript etc will be working fine under /foo/your-theme.

Note that a theme always is deployed as its own web context - independent of Liferay. So when Liferay is deployed at http://www.example.com/lportal, your theme is deployed at http://www.example.com/my-theme and should reference images from there.
If Apache is generating your 404 error, make sure that it's forwarding the request to your appserver. Typically, if you have mod_jk or mod_proxy or similar configured to forward /lportal to Liferay, you also need to forward /my-theme.
If that doesn't help, please give some more information, like version and sample css that doesn't work, including what it generates.

Related

Netbeans 12 Hot Deployment to Wildfly 16

I'm having a lot of issues getting Netbeans 12 to hot deploy a JavaEE project (using Ant) to Wildfly. Surprisingly, any changes to my Java code hot deploys as usual upon save, but any changes to my web markup (.xhtml) will only show up after a fresh deployment.
Here's a list of what I've done and my current settings:
Settings:
Copy Static Resources on Save
Compile on Save
In my web.xml:
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
What I've tried:
Reviewed the following questions and applied changes where applicable (most was not applicable given my version of Wildfly)
How do I enable on-the-fly compilation of JSPs in Wildfly 9?
https://developer.jboss.org/thread/237954
Netbeans 8.2 + wildfly 11 hot deploy not working [I've had this issue in NetBeans 8.2 instances too! No resolution]
Wildfly system Property:
<system-properties>
<property name="java.net.preferIPv4Stack" value="true"/>
<property name="org.jboss.as.web.deployment.DELETE_WORK_DIR_ONCONTEXTDESTROY" value="true"/>
</system-properties>
Wildfly Deployment Scanner:
<subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0">
<deployment-scanner path="deployments" relative-to="jboss.server.base.dir"
scan-interval="100"
auto-deploy-exploded="true"
untime-failure-causes-rollback="${jboss.deployment.scanner.rollback.on.failure:false}"/>
</subsystem>
In addition to the above, I've also modified the Ant script to copy the required files over to the appropriate directories. This DOES work, but each time I do this, I lose any session state with the app that I had prior to the save.
What I'm hoping to achieve is to be able to modify either my backing Java code or my front-end markup and upon saving the file (or clicking the hot deploy button, doesn't really matter to me) have the changes reflected on my application server.
I've worked on other projects that used WebLogic as the application server with no issues. Netbeans (8) simply "works" when you attach the debugger and modify a file (using WebLogic). The changes are immediately reflected in the browser upon a refresh without loss of state. I'm hoping that I'm missing something really small and it's easy to do with Netbeans 12 + Wildfly as well.
Thank you!! Hopefully I'm just missing something small!

Edit XHTML of a deployed JSF project in glassfish

I have a web application I'd like to edit while it's already deployed.
The part I'd like to edit is inside ...applications/myapplication/WEB-INF/classes/META-INF/*.xhtml.
I have a tool that I use to generate these XHTML files and insert them into the aforementioned directory. In a production environment actually these XHTML files are part of a jar project included as a dependency in the main web application.
But what I need is to make hot deploy during development.
I can do it by removing the jar dependency and adding the XHTML in the directory mentioned above. But updating it later doesn't do the job.
Any idea?
If you're using IntellijIDEA, just go to the configuration of glassfish server and select "Update Resources" on "Frame Deactivation".

system.webServer/fastCgi/application not working in web.config

How do I register an IIS FastCGI application in a MSDeploy's web.config file as documented?
I'm trying to build a simple test MS Web Deploy package installable by
the Web Platform Installer via a custom feed. I'm trying to
register a FastCGI application in the packages web.config as the
docs indicate is possible. You can see the web.config file below
or in github:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<fastCgi>
<application fullPath="C:\Python27\python.exe" arguments="-u C:\Python27\Scripts\iiswsgi-script.py" monitorChangesTo="C:\Python27\Scripts\iiswsgi-script.py" maxInstances="1" />
</fastCgi>
...
This doesn't work when installed via the Web Platform Installer and then tested through Web Matrix/IIS Express. However, as soon as I run the appcmd.exe command as below and in the install.cmd batch file:
set IIS_BIN=%ProgramFiles%\IIS Express
"%IIS_BIN%\appcmd.exe" set config -section:system.webServer/fastCgi /+"[fullPath='%SystemDrive%\Python27\python.exe',arguments='-u %SystemDrive%\Python27\Scripts\iiswsgi-script.py',maxInstances='1',monitorChangesTo='%SystemDrive%\Python27\Scripts\iiswsgi-script.py']" /commit:apphost
...the FastCGI app works just fine. IOW, it seems like the <fastCGI><application> elements in web.config don't take effect, but they do in IIS's applicationhost.config even though the docs indicate this is possible in web.confg.
Is there a way to get this to work in the specific app (through web.config or otherwise) without changing the global IIS config?
I'm doing all this under Windows 7 Professional, Web Platform
Installer 4.0, and Web Matrix 2.0 RC whose about dialog says:
Version 2.0 RC
WebMatrix: 7.1.1587.0
IIS Express: 8.0.8298.0
.NET Framework: 4.0.30319.17379 built by: FXBETAREL
Web Deploy: 7.1.1516.0
SQL Server Compact: 4.0.8854.1
Web Platform Installer: 7.1.1586.1
ASP.NET Web Pages: 2.0.20505.0
ASP.NET Web Pages: 1.0.20105.407
The code behind all this is in IISWSGI on GitHub, use this commit to test. To reproduce the
environment I'm using, see the IISWSGI documentation.

Wrong library version when moving web application from Tomcat to WebLogic

My java web application was working on Apache Tomcat. It needs some third party libraries for its work (jasperreports 3.7.2 in particular). But now it became necessary to move application on WebLogic. And it appears that it uses not the library it was using before (on Tomcat) but some other version of this library (I suspect that one which comes with WebLogic by default). How can i specify concrete version of library and make WebLogic use it? I've never used weblogic before. May be i should type something in deployment descriptors or something like that? Thanks for your replies.
If you have the JAR you want inside WEB-INF/lib in your war, you can tell Weblogic to use that jar over any other jar that might be present in the Classloader.
Use the prefer-web-inf-classes element in a weblogic.xml Web application deployment descriptor (that goes in WEB-INF next to the web.xml)
Here is an example weblogic.xml:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic- web-app.xsd">
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
Note: In this usage all WEB_INF/lib classes will be preferred over other versions in the classpath.

Jrebel eclipse tomcat republish problem

when using jrebel, How can I make it automaticly republish static resource such as HTML javascript and jsp?
you should use rebel.xml configuration file to map your resources like jsps to the deployed app.
Check out the example: http://www.zeroturnaround.com/reference-manual/app.html#app-3.1

Resources