Problems Deploy Webservices in oracle Weblogic 10.01 - java

i am using jwsc to build my webservices application. This produces a war file with a weblogic.xml like the following:
<?xml version='1.0' encoding='UTF-8'?>
<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>eori-ws</context-root>
</weblogic-web-app>
As you can see the namespace points towards bea.com. When i try to deploy the war (inside an ear) to my weblogic i get the following:
An error occurred during activation of changes, please see the log for details.
[HTTP:101064][WebAppModule(eori_services:eori-ws)] Error parsing descriptor in Web appplication
"/softs/apps/bea1001/user_projects/domains/myapp/servers/myServer/tmp/_WL_user/myapp/jd3urj/myapp-ws.war"
weblogic.application.ModuleException: Unmarshaller failed at
weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:858) at
weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:285)
(snip)
weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:464)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200) at
weblogic.work.ExecuteThread.run(ExecuteThread.java:172) Caused by:
com.bea.xml.XmlException: failed to load java type corresponding to e=weblogic-web-app#http://www.bea.com/ns/weblogic/weblogic-web-app at
com.bea.staxb.runtime.internal.UnmarshalResult.getPojoBindingType(UnmarshalResult.java:329)
at
com.bea.staxb.runtime.internal.UnmarshalResult.determineTypeForGlobalElement(UnmarshalResult.java:296)
at
(snip)
weblogic.servlet.internal.WebAppDescriptor.getWeblogicWebAppBean(WebAppDescriptor.java:164)
at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:853)
... 25 more weblogic.application.ModuleException: Unmarshaller failed
Failed to load java type corresponding to e=weblogic-web-app#http://www.bea.com/ns/weblogic/weblogic-web-app
i've tried changing the url to match the new domain and i get the same error. I've tried downloading the xsd and putting it in the same folder of the weblogic.xml, wich i changed to look like:
<?xml version='1.0' encoding='UTF-8'?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="weblogic-web-app.xsd">
<context-root>eori-ws</context-root>
</weblogic-web-app>
and the error is still the same
I'm out of ideas. Any help?
EDIT: no solution yet, ill post solution when i find it.

I solved my problem. Seems i was using the wrong version of the JWSC ant task. Just make sure to use the correct weblogic.jar

Related

Where does Weblogic server defines to look in ORACLE_HOME/oracle_common folder for dependecies?

There are some libraries in ORACLE_HOME/oracle_common folder which are creating issues with our deployment (EAR). (in particular jps-ee.jar file).
How do I overwrite my weblogic server (not via web.xml) to not use the libs available (particularly jps-ee.jar) for my EAR Deployment.
We need to disable it from the weblogic end so that we can test that , this jps-ee.jar is the root cause of our issue.
So how can we do it from the weblogic end ?
And docs or steps by step guide ?
Found solution to this problem, weblogic is configured to use oralce_common using setDomainEnv.sh (or setDomainEnv.cmd based on OS)
/%ORACLE_HOME%/Middleware/user_projects/domains/%WEBLOGIC_DOMAIN%/bin/setDomainEnv.sh
This file defines the class path to be used for starting up a domain.
This file is called in by startWeblogic script to set up domain related settings.
Which loads the class paths and pass it to JVM when running the weblogic server.
If you want the weblogic server to start looking for some dependency packages from your ear/war file first, then you must use application.xml or weblogic.xml depending on whether your archive is an ear or a war.
Here is an example;
application.xml
<?xml version = '1.0' encoding = 'UTF-8'?>
<weblogic-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-application http://www.bea.com/ns/weblogic/weblogic-application/1.0/weblogic-application.xsd" xmlns="http://www.bea.com/ns/weblogic/weblogic-application">
<prefer-application-packages>
<package-name>oracle.toplink.*</package-name>
<package-name>oracle.sql.*</package-name>
<package-name>oracle.jdbc.*</package-name>
</prefer-application-packages>
weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app>
<weblogic-version>12.1.3.0.0</weblogic-version>
<context-root>sth</context-root>
<container-descriptor>
<prefer-web-inf-classes>false</prefer-web-inf-classes>
<prefer-application-packages>
<package-name>oracle.toplink.*</package-name>
<package-name>oracle.sql.*</package-name>
<package-name>oracle.jdbc.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
</prefer-application-resources>
</container-descriptor>
prefer-application-packages and prefer-application-resources are the two tools you can use for this purpose in weblogic environments. Weblogic first uses these packages in your archive file when looking a class and if not found, then it uses its embedded dependencies.
Good luck!

Jboss-4.2.3 Seems to be ignoring jboss-web.xml

I've been struggling with this one for a few days now, hopefully someone can help.
I'm getting the following error when my application tries to build my Hibernate3 SessionFactory:
...
org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml
...
Caused by: org.dom4j.DocumentException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory Nested exception: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
...
Below is my /WEB-INF/jboss-web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<loader-repository>some.unique.package.name:archive=lvs.war
<loader-repository-config>java2ParentDelegation=false</loader-repository-config>
</loader-repository>
</jboss-web>
Hibernate works fine in my unit tests, it's only when I deploy it to the test server that this happens.
From what I've found, this appears to be happening because jboss already has a copy of dom4j.
No I can't remove dom4j from my project, web-apps on the server it will be hosted on are expected to use all their own jars.
Try to change / check value for your server configuration.
In server/xxx/deploy/jboss-web.deployer/META-INF/jboss-service.xml
there are two attributes to try
Java2ClassLoadingCompliance
UseJbossWebLoader
Both are boolean values and control some class loader behaviour.
HTH.

Commons-lang-2.6.jar and FilteringClassLoader Issue

This is in continuation of Despite having commons-lang included in pom, getting exception java.lang.NoSuchMethodError:org.apache.commons.lang.StringUtils.join I have the following in weblogic-application.xml
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application>
<prefer-application-packages>
<package-name>commons-lang.*</package-name>
</prefer-application-packages>
</weblogic-application>
However I am still getting
Root cause of ServletException.
java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.join
(Ljava/util/Collection;Ljava/lang/String;)Ljava/lang/String;
How come classloader filtering is not able to detect jar mentioned in
weblogic-application.xml
<package-name>commons-lang.*</package-name> does not look valid. commons-lang is the artifact ID of the library, not a valid package.
Replace this by something like <package-name>org.apache.commons.*</package-name> or <package-name>org.apache.commons.lang.*</package-name> and it should world correctly.

How do I resolve duplicate property errors in this j2ee schema?

I inherited a J2EE app written for deployment on Weblogic 10 and the developer primarily responsible for this application does not get this error when he opens the project in Eclipse.
I have the following very simple weblogic.xml file:
<?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/920/weblogic-web-app.xsd">
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
Eclipse generates a single XML validation problem for this file, which actually consists of a number of the same errors. The parent text of the XML problem is this:
The errors below were detected when validating the file "j2ee_1_4.xsd"
via the file "weblogic.xml". In most cases these errors can be
detected by validating "j2ee_1_4.xsd" directly. However it is
possible that errors will only occur when j2ee_1_4.xsd is validated in
the context of weblogic.xml.
And an example of the child errors. They all read this way:
sch-props.correct.2: A schema cannot contain two global components with the same name; this schema contains two occurrences of 'http://java.sun.com/xml/ns/j2ee,descriptionGroup'.
This is followed by a line number. There are about 50 of these errors, and only the quoted name at the end of the error changes.
I found the following bug in Sun's bug tracker which seemed to indicate a possible cause, but I'm not sure how I'd apply it to my project, if it's even relevant.
Impossible to create javax.xml.validation.Schema instance from "web-app_2_4.xsd"
I can't help but think that this is related to my Eclipse configuration, but at this point I'm at a loss.
Thanks for your time.
I ran into the same issue. I found an article online about needing to update to the latest schema so I looked through Oracle for latest schemas versions here: http://www.oracle.com/webfolder/technetwork/weblogic/weblogic-web-app/index.html
I modified my weblogic.xml file with the following:
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd">
...
</weblogic-web-app>
Regards,
Jose
You say this is written for WL 10.
My weblogic.xml begins as
<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"
xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
while I can see yours points to the Weblogic 9 namespace
xmlns="http://www.bea.com/ns/weblogic/90"
Does changing this make a difference?

XMLBeans - xsi:type stripped using Axis2 and Tomcat?

I’m new to XMLBeans and have been trying to use it to create an XML document as part of an axis2 web service. When I run my code as a standard Java application or as a standard servlet, the XML is correctly generated:
<?xml version="1.0" encoding="UTF-8"?>
<c:BroadsoftDocument protocol="OCI" xmlns:c="C">
<sessionId>000000001</sessionId>
<command xsi:type="AuthenticationRequest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<userId>admin</userId></command>
</c:BroadsoftDocument>
However, when the exact same code is run under Axis2 & Tomcat in a servlet I get:
<?xml version="1.0" encoding="UTF-8"?>
<c:BroadsoftDocument protocol="OCI" xmlns:c="C">
<sessionId>000000001</sessionId>
<command>
<userId>admin</userId></command>
</c:BroadsoftDocument>
This of course isn’t valid – the xsi:type of the “command” element is stripped when the code is run under Tomcat.
Does anyone have any suggestions of what I could be doing wrong that would cause this type of issue only when running under Axis2? At first I thought it was a Tomcat issue, but after creating a generic servlet and running the exact same code I don't have any issues. I've tried playing with the XMLOptions for XMLBeans, but couldn't seem to resolve the problem. The options I'm currently using are:
xmlOptions = new XmlOptions();
xmlOptions.setCharacterEncoding("UTF-8");
xmlOptions.setUseDefaultNamespace();
xmlOptions.setSaveAggressiveNamespaces();
xmlOptions.setSavePrettyPrint();
It turn out the issue is with the class loader order that Axis2 uses. This was patched and the functionality is described here:
http://marc2.theaimsgroup.com/?l=axis-cvs&m=115946726426905&w=3
Long story short, to resolve this issue you need to edit the "services.xml" for your Axis2 project and add:
<parameter name="ServiceTCCL">composite</parameter>

Categories