I have created a JAXWS in NetBeans and it works fine on a local Glassfish server.
I need to deploy this on CloudBees. I used ClickStart and uploaded the WAR file which NetBeans had created. However, this doesn't seem to work as I get the same default "Your Glassfish server is running" page. I can't seem to follow the instructions given there, nor can I find any good tutorial.
Can someone please outline the procedure or provide links to a tutorial ?
Could you please verify that you inserted in $WAR_HOME/WEB-INF a file glassfish-web.xml (next to web.xml) with:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<context-root>/</context-root>
...
</glassfish-web-app>
If you forgot this glassfish-web.xml, your application is probably deployed under the /app context.
Al the details should be available on our documentation page https://developer.cloudbees.com/bin/view/RUN/Glassfish3.
If something is missing or is not clear, please tell us.
Cyrille
Related
I saw this and other similar questions before and their solution didn't solve my problem because Glassfish 5 had a lot of changes.
I'm running a soap web service and getting this error:
java.lang.IllegalStateException: The lifecycle method [finalizeConfig] must not throw a checked exception. Related annotation information: annotation [#javax.annotation.PostConstruct()] on annotated element [public void org.apache.cxf.transport.http_jetty.spring.JettyHTTPServerEngineBeanDefinitionParser$SpringJettyHTTPServerEngine.finalizeConfig() throws java.security.GeneralSecurityException,java.io.IOException] of type [METHOD]
at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:503)
at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:423)
at org.glassfish.web.deployment.archivist.WebArchivist.postAnnotationProcess(WebArchivist.java:317)
at org.glassfish.web.deployment.archivist.WebArchivist.postAnnotationProcess(WebArchivist.java:68)
at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:397)
at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:372)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:247)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:256)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:217)
at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:137)
at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:183)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:207)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:73)
at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:857)
at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:797)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:354)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:195)
...
I'm using Glassfish 5.1.0 and using Apache cxf 3.3.5 and my IDE is Eclipse EE Version: 2019-12 (4.14.0)
I downloaded Apache CXF binary distribution and added in to eclipse CXF runtime.
This is my web service class:
package com.web.service;
import javax.jws.WebMethod;
import javax.jws.WebService;
#WebService(targetNamespace = "localhost:8080")
public class Service {
#WebMethod public String greet(String name) {
return "Hi," + name;
}
}
The org.apache.cxf.transport.http_jetty.spring package causes problems when deployed to Glassfish. You need to remove that from the CXF binary distribution.
Please try the following steps:
First remove the original binary distribution from your project in Eclipse.
Then you need to open the binary distribution with some archive tool (maybe the operating system you are using contains something already) and navigate to the lib folder in the archive. Delete the file cxf-rt-transports-http-jetty-*.jar.
Then add the changed binary distribution to your project like you did before with the original binary distribution.
Maybe this will already be sufficient. If not, there is another step you can try.
It is more or less the same solution that you linked already. However, I am not sure if Glassfish 5.1 will still accept the sun-web.xml file. It should be named glassfish-web.xml nowadays.
So create the file glassfish-web.xml with following content:
(if you already have that file, only add the <class-loader delegate="true"/> line to it)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<class-loader delegate="true"/>
</glassfish-web-app>
Put the file into the WEB-INF folder of your WAR file.
There is an ear deployed into WebSphere WAS. It contains 3 portlets. I imported XML descriptor for this app to the WebSphere Portal and put the portlets on portal pages. It was working.
Unfortunately I removed one of the portlets from web modules in portal administration. Because of this portlet was removed from all pages also. I can't find the portlet in portlets list, so I can't put it to the pages again.
How can I reestablish the removed portlet to portal without uninstalling and deploying whole ear application to application server again.
I tried to import portlet XML to portal again. But it didn't help
UPDATE
here is the XML
<?xml version="1.0" encoding="UTF-8"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_7.0.0.xsd" type="update" create-oids="true">
<portal action="locate">
<web-app action="update" active="true" domain="rel" predeployed="true" removable="true" uid="kz.edu.nu.world.roomreservation.RoomReservationPortlet.4207700365webmod">
<url>file://localhost/opt/IBM/WebSphere/wp_profile/installedApps/Cell01/RoomReservationEAR.ear/RoomReservation.war</url>
<context-root>/.RoomReservation</context-root>
<display-name>.RoomReservation</display-name>
<portlet-app action="update" active="true" defaultlocale="en" domain="rel" name="kz.edu.nu.world.roomreservation.RoomReservationPortlet.4207700365" uid="kz.edu.nu.world.roomreservation.RoomReservationPortlet.4207700365">
<portlet action="update" active="true" defaultlocale="en" domain="rel" name="RoomReservation" provided="false">
<localedata locale="en">
<title>RoomReservation</title>
</localedata>
<localedata locale="ru">
<title>RoomReservation</title>
</localedata>
<localedata locale="kk">
<title>RoomReservation</title>
</localedata>
</portlet>
</portlet-app>
</web-app>
</portal>
</request>
Sorry to be the bearer of bad news, but you will need to update the ear. I don't think you have to uninstall the ear, just update it and import xml again.
When I add Hibernate 5 to my website, I can't get it to work in Glassfish 4.1.1. I always get an error
java.lang.NoSuchMethodError:
org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
I've tried to replace the jboss-logging library in Glassfish' modules folder, like I read in an answer to a similar problem, but it didn't change anything. I also tried to use Hibernate 4, but that gave an other error.
In my case, I was running the Hibernate 5 with JPA annotations on tomcat and stop working when I changed to glassfish 4.1
The error:
hibernate.properties not found
Make sure: src/main/resources/hibernate.cfg.xml exists
And if you only have the dependency of hibernate-core, I was using hibernate-annotations and hibernate-common-annotations and it was creating conflict. The hibernate 5 doesnt need these two, I had read somewhere.Try to remove ;)
After that a new error appears:
java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
The reason was the oldest jboss-logging.jar at:
"YOUR_GLASSFISH_FOLDER/glassfish/modules"
Why? The hibernate 5 has dependency with the newest version of
jboss-logging, and the glassfish 4 uses the oldest version even if you
declare inside your POM file the newest version. Actually I'm using:
org.jboss.logging jboss-logging 3.3.0.Final
Then I downloaded it and replace the old .jar inside the modules path
and it back to work, I spent 2 days trying to solve that and I hope it
helps some future issues =D
I used this link to help me: https://medium.com/#mertcal/using-hibernate-5-on-payara-cc242212a5d6#.npq2hdprz
Another solution, in my case, could be back to the last Hibernate 4 version (4.3.11.Final) but it is already too old in my opinion
I had a similar issue, I was able to fix it by creating a glassfish-web.xml file in the WEB-INF directory. The contents of the file are shown below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<class-loader delegate="false"/>
</glassfish-web-app>
This ensures that glassfish does not load it's internal libraries, but libraries from your project..
Try to clean glassfish osgi-cache folder in your domain. You can find details in this Payara github issue: https://github.com/payara/Payara/issues/554 (Payara is a fork of Glassfish with additional features, so basic mechanics remain the same as in Glassfish)
I am migrating my RESTful web application from GlassFish4.1 to WildFly9.0 for the first time.
Initially, I suffered deployment issues due Jersey dependencies. To overcome that problem, I simply replaced said project dependencies with RESTEasy equivalents inside of the pom.xml file. In doing so, my application became deployable -- and according to (WildFly_base)/standalone/log, and the applications themselves -- are working as expected.
Additionally, I added a jboss-web.xml configuration file to my WEB-INF folder:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-web PUBLIC "http://www.jboss.org/j2ee/dtd" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<jboss-web>
<context-root>myprojectstart</context-root>
</jboss-web>
The hello-world page can be reached # http://ipaddress:8080/myprojectstart.
... however, I cannot view my web services # http://ipaddress:8080/myprojectstart/getData, just like I could when using GlassFish-4.1.
So; what am I missing?
Note: I use #annotations like:
#ApplicationPath("/*")
#Path("/getData")
No seperate .xml business here
I don't think RestEasy supports * in ApplicationPath. If you remove that it should work fine.
I have created a EJB, created a jar of it( containing required ejb-jar.xml and weblogic-ejb-jar.xml files).
when i add this jar to weblogic server 12c, using admin console, i get following issue-
Issues were encountered while parsing this deployment to determine module type. Assuming this is a library deployment.
Due to this my ejb is not shown in jndi tree view. So I am not able to do my jndi lookup. Please rectify my error.
ejb-jar.xml-
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_ID">
<display-name>ProductManager</display-name>
<enterprise-beans>
<session>
<ejb-name>Product</ejb-name>
<home>rohit.ProductHome</home>
<remote>rohit.ProductRemote</remote>
<ejb-class>rohit.ProductBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<ejb-client-jar>ProductManagerClient.jar</ejb-client-jar>
</ejb-jar>
weblogic-ejb-jar.xml-
<?xml version=“1.0? encoding=“UTF-8??>
<weblogic-ejb-jar
xmlns=“http://www.bea.com/ns/weblogic/90? xmlns:j2ee=“http://java.sun.com/xml/ns/j2ee” 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-ejb-jar.xsd”>
<welogic-enterprise-bean>
<ejb-name>Product</ejb-name>
<jndi-name>Product</jndi-name>
<stateless-session-descriptor></stateless-session-descriptor>
</welogic-enterprise-bean>
</weblogic-ejb-jar>
Contrary to what you seem to be thinking, the ejb-jar.xml and weblogic-ejb-jar.xml files are not required. As primary deployment descriptors they are ancient artifacts from 2004.
Your ProductHome class should also be removed if you value your sanity. This is an EJB2 artifact that's completely and utterly unnecessary this time of age.
To get started with EJB, all you need is a POJO with an #Stateless annotation:
#Stateless
public class ProductBean {
// ...
}
Jar this up and deploy it. That's all. You don't have to explicitly name your bean (it will get a name) and you certainly don't have to declare its existence in some XML file.
The ejb-jar.xml is mandatory when deploying an application as a jar file. The correct place to put it is in the META-INF in the jar.
Yes, annotations are definitely nice and easier to maintain. Try this by leaving the ejb-jar.xml minimal.
I always package my applications in EAR with the jars inside. In this case an application.xml file is needed.
It sounds like the container does not recognize the jar as an application. Check the position of the ejb-jar.xml or use EAR packaging.
Oracle recommends that even standalone EJBs be packed as an EAR file. The EJB descriptors should be inside the META-INF of the ejb-module.
See this link for the EAR structure for more details.
http://docs.oracle.com/cd/E24329_01/web.1211/e24368/splitcreate.htm#i1103260