read html file from JSF project root folder - java

I dont know how to explain it but let me try :
I have a eclipse JSF project named web-gestao
I would like to call from URL : http://www.domainxxx/simplefile.html and NOT http://www.domainxxx/web-gestao/simplefile.html
I need this for google verification purposes.

In jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<!-- URL to access the web module -->
<context-root>/</context-root>
...
...
...

Related

JasperException: Absolute uri cannot be resolved

I have been getting the following JasperException when trying to use an XML schema for my web.xml, instead of the deprecated DOCTYPE declaration:
HTTP Status 500 - The absolute uri: http://java.sun.com/jsp/jstl/core
cannot be resolved in either web.xml or the jar files deployed with this
application
If I use this web.xml, the application compiles:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>
However, if I use this web.xml, I get the JasperException:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>CourseManagementJDBC</display-name>\
</web-app>
Any idea why only a deprecated format would work?
NOTE: This is for a Maven project, and the JSTL dependency has been correctly declared, as well as the tag library in the JSP:
pom.xml:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
JSP:
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
They're all correct; what gives?
I finally came upon the solution. By default, for some reason (and I'd like to know why), Maven generates a Dynamic Web Module as version 2.3. DTD was of course the standard for Servlet 2.3 and was probably unable to parse or evaluate my XML-based web.xml file.
I'm still not 100% clear as to why changing web.xml to XSD caused the JasperException with respect to JSTL, though I think it has something to do with JSTL being integrated with JSP at some point after Servlet 2.3 - someone please correct or elaborate on this if possible.
See this: https://stackoverflow.com/a/4928309/2879303
Now for the solution:
Right-click on your Maven project and select Properties
Navigate to Project Facets and untick Dynamic Web Module. Apply
changes.
From the version drop-down box, select the latest version (as of
writing, this is 3.1). Re-select Dynamic Web Module. Apply changes.
Right-click on your Maven project and select Maven -> Update
Project.
Your project should now be able to correctly interpret a web.xml
with an XSD declaration.

Migrating jboss.xml to jboss-ejb3.xml

I'm currently migrating an Java/EE5 application to run with WildFly-8.0.0.Final. As stated here: https://docs.jboss.org/author/display/WFLY8/How+do+I+migrate+my+application+from+AS5+or+AS6+to+WildFly , the legacy jboss.xml file seems to be ignored by now. Unluckily (for me) I was unable to find a good resource for migrating the session part within enterprise-beans. My current jboss.xml looks like this:
<?xml version='1.0' encoding='UTF-8' ?>
<jboss xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss_5_1.xsd" version="5.1">
<security-domain>java:/jaas/customAdmin</security-domain>
<enterprise-beans>
<session>
<ejb-name>CustomConfigBean</ejb-name>
<pool-config>
<pool-value>StrictMaxPool</pool-value>
<pool-max-size>10</pool-max-size>
<pool-timeout>30002</pool-timeout>
</pool-config>
</session>
</enterprise-beans>
<assembly-descriptor>
<security-role>
<role-name>customUser</role-name>
<principal-name>customUser</principal-name>
</security-role>
<security-role>
<role-name>customAdmin</role-name>
<principal-name>customAdmin</principal-name>
</security-role>
</assembly-descriptor>
</jboss>
What is required to make this run in jboss-ejb3.xml ?
Have you taken a look at the schema? It looks like it has the same elements so it should be rather straightforward to create jboss-ejb3.xml using your existing jboss.xml as a starting point.
Here's the jboss-ejb3.xml Reference.
NOTE: I think the schemaLocation is not correct in the reference. It uses http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd, which does not exist. The correct schema location is http://xmlns.jcp.org/xml/ns/javaee/ejb-jar_3_2.xsd. I just created a discussion in the Wildfly group about the schema location problem.
You don't mention where your jboss.xml is located so for completeness just a reminder that for Wildfly it should be in WEB-INF of a war, or META-INF of an EJB jar.

Multiple context for java web application

I have a situation here i have an application in jsf-2.1 which is deployed as http://localhost:8080/myWebApplication and in "META-INF" i have context.xml which has the following configuration
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/myWebApplication" />
Now i want to shorten the name without loosing context => 'myWebApplication' like '/mwp'
i tried to do the following but it did not work out as expected:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/myWebApplication" />
<Context antiJARLocking="true" path="/mwp" />
Please advise if it is possible or is there any workaround to achieve this.
Your application will (on your application server, not talking about vhosts or mod_rewrite on apache) only respond to:
The application name you have defined in your web.xml
If there is no such configuration in your web.xml, it will respond to the name of the war-file. If for example your application is called myWebApplication.war, it will respond to /myWebApplication.

Database schema is not generated in a EAR Application

I have this scenario in a EAR application which have the following structure:
Project
data
ear
entity
META-INF
persistence.xml
business
web
At the entity folder there is all the entity classes and a persistence.xml with the hibernate.hbm2ddl.auto property setted to create. When I deploy the jar about entity the database is generated but when I deploy the ear he isn't. Please somebody can let me know why this is happening and some way to solve it?
In your EAR project you must have a META-INF/application.xml file, that includes the entity jar file:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" id="Application_ID" version="6">
<display-name>MY_ear</display-name>
<module>
<ejb>ENTITY.jar</ejb><!--change the name accordingly-->
</module>
</application>

Webservices in weblogic9.2

I have written an Webservice using jax-ws (with Eclipse IDE) and have bundled it in War, in turn bundled within an Ear. I'm able to deploy that fine and testing of the web services also works fine. But when I login to my Weblogic Admin console and expand the Ear deployment, I don't see anything under 'Web services', it displays None to display.
Could any one please let me know what is that am missing here?
this is the application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application id="Application_ID" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
<display-name>EAR1</display-name>
<module id="WebModule_1376158300960">
<web>
<web-uri>TestWEB.war</web-uri>
<context-root>TestWEB</context-root>
</web>
</module>
</application>

Categories

Resources