Everyone. I Face A Problem In Solr Using, In Development Environment, Project Always Close And Start, Start And Close, When We Stop Tomcat, Some Solr Documents Are Remained Not Committed. How To Overcome This Headache, Can Anyone Show Some Ideas? Great Thanx.....
You can use a shutdown hook within your webapplication to handle the shutdowns and commit the data.
Use a class that implements ServletContextListener in your web.xml:
<web-app>
<!-- Usual stuff here -->
<listener>
<listener-class>solr.commitListerner</listener-class>
</listener>
</web-app>
Related
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!
I changed the way an application was being built. It was being built by maven earlier, I changed it to ANT.
After the change, I started getting the following error:
java.lang.IllegalStateException: No Factories configured for this Application.
This happens if the faces-initialization does not work at all - make sure that you
properly include all configuration settings necessary for a basic faces application
and that all the necessary libs are included.
Also check the logging output of your web application and your container for
any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this:
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
javax.faces.FactoryFinder._getFactory(FactoryFinder.java:246)
javax.faces.FactoryFinder.getFactory(FactoryFinder.java:200)
javax.faces.webapp.FacesServlet.init(FacesServlet.java:112)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
java.lang.Thread.run(Thread.java:662)
The web.xml does not have the following:
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
But since the application was working without it earlier, I am thinking this is some other issue. I looked up for this issue in google and most of them suggest it could be because of compatibility issue with Tomcat jar (servlet-api.jar, el-api.jar, jsp-api.jar). I couldn't remove el-api.jar as it is being used by the application.
This seems to be some dependency / libraries issue.
I upgraded a Tomcat 7.0.27 to Tomcat 7.0.57 and the Tomcat is in cluster environment. After upgraded, the Tomcat in cluster, we are getting ViewExpiredException, didn't get in previous version in cluster.
Added state saving method to client but still not working
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
Tried by using error-page tag
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/faces/login.xhtml</location>
</error-page>
It's also not working.
If, when we stopped any one of the server, it's working fine. when ever we bring up the another server getting this issue and the first time only getting this issue, if we reloaded the page, it's working fine.
Strange is, code working fine in Tomcat 7.0.27,
Any suggestions please.
How can i disable OpenSSO Web Services which are provided by default?
Currently my application's OpenSSO can be accessed by the following URL's:
http://host_machine.domain:8080/opensso/identityservices/IdentityServices
http://host_machine.domain:8080/opensso/identityservices?WSDL
This can only be done by tweaking web.xml
Have you tried to remove the following servlet-mappings?
IdentityServices
/identityservices/
IdentityServicesHandler
/identity/
Sidenote: If you're using newer agents they might not work anymore.
-Bernhard
Commented only this part in web.xml and it worked!!!
<servlet-mapping>
<servlet-name>IdentityServices</servlet-name>
<url-pattern>/identityservices/*</url-pattern>
</servlet-mapping>
Does anyone know the steps so that OUR OWN portlets' service builder entities and methods show up when hitting localhost:8080/my-portlet/jsonws? All my entities are remote-service annotated. #JSONWebService is on all my classes. I've added a chunk of XML to web.xml (per http://www.liferay.com/community/wiki/-/wiki/Main/JSON+Web+Services - a very fine wiki otherwise). But I don't see anything happening.
I can browse to http://localhost:8080/api/jsonws and see the portal's JSON methods.
Have I missed a setting? Is there some additional configuration needed?
Thanks.
It must be some miss-configuration:) Let me repeat the steps here.
After installing Liferay 6.1 CE GA1 try if JSONWS api is visible, by accessing following urls: http://localhost:8080/api/jsonws and (for example): http://localhost:8080/knowledge-base-portlet/api/jsonws
Now, create your portlet using latest Liferay SDK. Create at least one service method in *ServiceImpl. Run service builder
Add the following code in portlets web.xml:
<servlet>
<servlet-name>JSON Web Service Servlet</servlet-name>
<servlet-class>com.liferay.portal.kernel.servlet.PortalClassLoaderServlet</servlet-class>
<init-param>
<param-name>servlet-class</param-name>
<param-value>com.liferay.portal.jsonwebservice.JSONWebServiceServlet</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JSON Web Service Servlet</servlet-name>
<url-pattern>/api/jsonws/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>JSON Web Service Servlet</servlet-name>
<url-pattern>/api/secure/jsonws/*</url-pattern>
</servlet-mapping>
Build war and finally deploy portlet to Liferay. After few moments, portlet will be deployed and available. JSONWS will scan your classes and find all service methods. To test if everything went ok, visit: http://localhost:8080/*portlet-context*/api/jsonws
That's all:)