its possible change library-ref descriptor using a plan deployment in weblogic? - weblogic

I trying to overwrite the library-ref descriptor from weblogic.xml file using a plan.xml but im getting "DeploymentException: weblogic.management.DeploymentException: Error: Unresolved Webapp Library references..."
the objective is use a different library using plan.xml without modify the weblogic.xml file
In my weblogic.xml (fragment)
<wls:library-ref>
<wls:library-name>lib_framework</wls:library-name>
<wls:specification-version>1.0.0</wls:specification-version>
<wls:implementation-version>1.0.0</wls:implementation-version>
<wls:exact-match>false</wls:exact-match>
</wls:library-ref>
i define in the plan.xml (fragment)
....
<variable>
<name>var_lib_framework</name>
<value>lib_framework_replace</value>
</variable>
<module-descriptor external="false">
<root-element>weblogic-web-app</root-element>
<uri>WEB-INF/weblogic.xml</uri>
<variable-assignment>
<name>var_lib_framework</name>
<xpath>/weblogic-web-app/library-ref/[library-name="lib_framework"]</xpath>
<operation>replace</operation>
</variable-assignment>
</module-descriptor>
....
....
but when i try start the app the error appear during deployment. So the question is: Can i change a library descriptor defined in a weblogic.xml file using a deployment plan?

Related

Netbeans 8.2 : GlassFish 5 Server, deploy, null false - The module has not been deployed

I'm a new Java WebEnt student, and I'm having issues deploying some basic Entity Classes and JSF Pages.
I loaded up some things without any edit to the files, and when trying to deploy. I get the "\nbproject\build-imp.xml:1045 The module has not been deployed" message. I checked the GlassFish server and here is the beginning log:
java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 10;
columnNumber: 18; Deployment descriptor file META-INF/persistence.xml in
archive [classes]. cvc-complex-type.2.4.d: Invalid content was found
starting with element 'properties'. No child element is expected at this point.
The rest of the log is pasted below
https://pastebin.com/7rXsyRit
EDIT
Pastebin to include the XML files in WEB-INF and persistence.xml
https://pastebin.com/6kRJyA54
Thanks for the help/advice
Yes the issue was <properties/> after I had removed that and tried to deploy, I had gotten that error which following the instructions in this link had resolved.

Where do i put JSTL taglibs after downloading them

kept getting this error when i run my web application :
HTTP Status 500 - The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
type Exception report
message The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:445)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:311)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:152)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1427)
org.apache.jasper.compiler.Parser.parse(Parser.java:138)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
myPackage.Register.processRequest(Register.java:63)
myPackage.Register.doGet(Register.java:81)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.
Apache Tomcat/7.0.42
and when i did some search i found that i need to download JSTL taglibs, i downloaded it but i don't know what to do with the files now, is there a specific folder i should put them so that my code runs fine?
From eclipse:
1.
Right Click --> properties --> Java Build Path --> Libraries -- > Add external jars
this will add jar to your eclipse biuld path
Right Click --> Deployment Assembly--> Java Build Path entries --> add JSTL jar
this will add the jar to WAR file when deploying it to the server.

Drools Guvnor on Glassfish error

I'm trying to deploy Guvnor (guvnor-5.5.0.Final-tomcat-6.0) to a fresh
glassfish server ( 3.1.2.2 build 5) and am getting the error below.
I did try the other WARs without any luck and I get the same error on
OSX and windows.
Error occurred during deployment: Exception while loading the app :
java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException:
java.lang.NoClassDefFoundError: org/apache/AnnotationProcessor. Please
see server.log for more details
Are there any work-around for this ?
Add the jasper-xxx.jar to your lib. It should work. If you deploy in tomcat, it should be in catalina.jar.
Unfortunately JBOSS 7 doesn't use tomcat instead it uses JBossWeb. That's why you have this problem.
Take the guvnor-5.5.0.Final-jboss-as-7.0.war binary war file
add dom4j-1.6.1.jar
remove javassit*.jars
add resteasy-jaxb-provider-2.2.3.GA.jar
add resteasy-jaxrs-2.2.3.GA.jar
Add the a glassfish-web.xml file to WEB-INF https://github.com/snowch/glassfish-guvnor/blob/master/src/main/webapp/WEB-INF/glassfish-web.xml
Replace WEB-INF/web.xml with this https://github.com/snowch/glassfish-guvnor/blob/master/src/main/webapp/WEB-INF/web.xml
Repackage the binary war file and deploy to glassfish

Failed Glassfish deploy - "Referencing error: this bundle has no bean of name [ClientBean]"

I'm trying to run the example from this page : GlassFish-to-GlassFish Remote EJB Invocation
But I get this error when I try to deploy the client on glassfish ("asadmin> deploy client-ejb.jar"):
"Exception while deploying the app [client-ejb] : Referencing error: This bundle has no bean of name [ClientBean]"
I need help, thanks.
I encountered a a similar problem when trying to deploy my application (Exception while deploying the app [my-app] : Referencing error : This bundle has no bean of name [myBeanFacade] ) .Rather weird but all that was needed to solve this was to go to the properties of [my-app] under the build category tree, choose compile and tick the compile on save option. Redeployed my application and viola !!
NB [my-app] contains 2 ejb jars and a web application, one of the ejbs is a library in the web app.
This problem occurred because the guy forgot to add the ServiceIF.class reference in client-ejb.jar.
Execute the command:
jar cvf client-ejb.jar test/ServiceIF.class test/ClientIF.class test/ClientBean.class META-INF/glassfish-ejb-jar.xml
get the new .jar and it will work.
In case you are using a deployment descriptor, then the EJB name should be the same in both the descriptor file.
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>Hello</ejb-name>
<home>com.ejb.test.HelloHome</home>
<remote>com.ejb.test.HelloObject</remote>
<ejb-class>com.ejb.test.HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
**<ejb-name>Hello</ejb-name>**
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
<glassfish-ejb-jar>
<enterprise-beans>
<ejb>
**<ejb-name>Hello</ejb-name>**
<jndi-name>jndi/Hello</jndi-name>
</ejb>
</enterprise-beans>
</glassfish-ejb-jar>

java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl while starting the weblogic

As part of our application we are using apache's xerces jaxp parser. When we deploy the application on weblogic 9.2, we are getting the following error.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.wsdl.WSDLManager' defined in class path resource [META-INF/cxf/cxf.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw exception; nested exception is java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
As per our analysis, weblogic is trying to to load its own DocumentBuilderFactoryImpl which is present in weblogic.jar instead of apache's xerces.
We tried the following to force the weblogic to load DocumentBuilderFactoryImpl from xerces
i) we have added the following tag into weblogic.xml
<prefer-web-inf-classes>true</prefer-web-inf-classes>
ii) we have put latest versions of xalan in jre/lib/endorced folder. this didn't resolve our problem.
ii) we have added entries in weblogic-application.xml
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
<application-param>
<param-name>webapp.encoding.default</param-name>
<param-value>UTF-8</param-value>
</application-param>
<prefer-application-packages>
<package-name>javax.jws.*</package-name>
<package-name>org.apache.xerces.*</package-name>
<package-name>org.apache.xerces.jaxp.*</package-name>
</prefer-application-packages>
</weblogic-application>
ii)Added the following entry in weblogic-application.xml
<xml>
<parser-factory>
<saxparser-factory>org.apache.xerces.jaxp.SAXParserFactoryImpl</saxparser-factory>
<document-builder-factory>org.apache.xerces.jaxp.DocumentBuilderFactoryImpl</document-builder-factory>
<transformer-factory>org.apache.xalan.processor.TransformerFactoryImpl</transformer-factory>
</parser-factory>
</xml>
iii) Added jaxp.properties to load DocumentBuilderFactoryImpl from xerces to the jre/lib and started the server.In this case, the weblogic didnt start.
iv) Then we started the server first and then copied the jaxp.properties file during the run time when server starts.But no success
None of the above worked for us.
Any help is highly appreciated.
You did so many things that I don't understand the exact status. My advice would be to strictly follow the Application Server Specific Configuration Guide for WebLogic that I've successfully used in the past with WLS 9.2.
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
<application-param>
<param-name>webapp.encoding.default</param-name>
<param-value>UTF-8</param-value>
</application-param>
<prefer-application-packages>
<package-name>javax.jws.*</package-name>
</prefer-application-packages>
</weblogic-application>
You'll certainly have to add more packages under prefer-application-packages to setup Weblogic ClassLoader filtering but in the current state of the question, it's impossible to provide a precise answer.
Just in case, you can maybe try to blindly use the weblogic-application.xml from this thread:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
<xml>
<parser-factory>
<saxparser-factory>
org.apache.xerces.jaxp.SAXParserFactoryImpl
</saxparser-factory>
<document-builder-factory>
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
</document-builder-factory>
<transformer-factory>
org.apache.xalan.processor.TransformerFactoryImpl
</transformer-factory>
</parser-factory>
</xml>
<application-param>
<param-name>webapp.encoding.default</param-name>
<param-value>UTF-8</param-value>
</application-param>
<prefer-application-packages>
<package-name>javax.jws.*</package-name>
<package-name>org.apache.xerces.*</package-name>
<package-name>org.apache.xalan.*</package-name>
</prefer-application-packages>
</weblogic-application>
But this is a shot in the dark.
You could try forcing the use of the specified document builder factory as a command line option:
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
This is assuming that you have the required Xerces builder factory class in your classpath.
In general, you shouldn't use a separate xerces.jar anymore, unless required by some legacy code. The Xerces parser classes come with the JRE, the package names just start with com.sun.org.apache instead of org.apache. You could try also
-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
and remove xerces.jar from your classpath altogether (this is what we did on WLS 10.3 and Java 1.6).
I managed to resolve the issue DocumentBuilderFactory not found with simple solution.
Try to copy xercesImpl.jar to the domain specific lib directory on weblogic MyDomain\servers\MyServer\lib.
In my case the problem was that i made a dependency on commons-digester which in turn used another version of xerces (that caused the conflict). So you can review your dependencies in case some other version of xerces was transitively included.