Issue concerning: EclipseLink 2.4.1 (DBWS) on WebLogic
I've created a DBWS webservice based on a Oracle (10g) PL/SQL package, by using EclipseLink DBWS builder. The PL/SQL function exposed as a webservice call has a Object type return type, e.g.:
create or replace type eclipse_type as
create or replace package test_eclipselink_pkg as
function test return eclipse_type;
As I understand it, EclipseLink-DBWS translates this Oracle object type to an Java type when calling the PL/SQL function over JDBC and translates the Java object to XML to be encapsulated in a SOAP message.
The problem is that when changing the specification of the return type (e.g. changing the name of the field num to nmb in the Oracle type eclipse_type) of the Oracle PL/SQL function, regenerating the webservice (WAR-file) with DBWS builder and redeploying it on WebLogic 10.3.6, calling the webservice results in a java.lang.reflect.InvocationTargetException.
Restarting the WebLogic server (or the appropriate managed server) resolves the problem, what shouldn't be a problem in a development environment, but is not always possible in a production environment.
The problem seems to be that redeploying the webservice doesn't result in the XR Operations/Queries being recreated and as a result the old result type definition is used.
I'm not that familar with the setup you describe, but it sounds like when redeploying the service, the underlying EclipseLink sessions are not being logged out and then recreated with the new classloader. How are you obtaining the session?
Thanks for your response! In answer to your question "How are you obtaining the session?" the answer is: I don't know :-)
To clarify this: the tool DBWS Builder - delivered by the EclipseLink project - generates a WAR file which contains this hierarchy:
****** META-INF folder:
********* eclipselink-dbws.xml (which lists the queries executed and the session file used)
********* eclipselink-dbws-or.xml (which lists the OR mappings and PL/SQL procedure or functions the queries are using)
********* eclipselink-dbws-ox.xml (which lists the OX mappings)
********* eclipselink-dbws-sessions.xml (which describes a session of type "server-session" with the server platform (WebLogic 10), the logging level the OX mapping file and the login type (Database - Platofrm Oracle 11) and a session of type "database-session" with the OX mapping file and a logging level)
*** wsdl folder: this contains the WSDL and the XSD file which describes the webservice
This all generated - by the DBWS Builder tool - based on a DBWS builderfile that only contains a Database, a datasource, a log level, a SOAP version and a list of PL/SQL procedures that should be wrapped into a webservice call.
So there's no user code involved for obtaining EclipseLink sessions. I believe that indeed that when redeploying the WAR-file, the underlying EclipseLink sessions are not being logged out, but I have no idea how to change this. All suggestions are welcome! I hope it doesn't mean losing the ability to generate the complete webservice "from a XML file" (the DBWS builder file), but we'll see about that later.
I was pointed to the DBWS code that looks up the sessions, and it should log out any existing sessions when the XRServiceFactory is initialized, but I don't know the flow or if something else isn't being statically held. If possible, I'd recommend modifying the sessoins.xml (eclipselink-dbws-sessions.xml?) to turn logging on to see if this is occuring or if something else is the problem. You might try deploying the service in a ear file and include the eclipselink.jar within the ear so it is used from the local classloader instead of the server classloader. This might workaround the issue if it is something behing held statically at the server level.
Either way, a bug should be filed so it can be looked into further.
I checked the logging while redeploying the WAR file. This part of the output seems to indicate, as you suggested, that the EcliipseLink session is not correctly logged of (InstanceAlreadyExistsException):
*** <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating redeploy operation for application, PLUS_WS [archive: P:\WS-I\eclipselink-2.4.0\runtime\eclipselink-2.4.1.v20120712-r11838\eclipselink\utils\dbws\output\PLUS_WS.war], to AdminServer .>
*** <Notice> <Stdout> <BEA-000000> <[EL Warning]: server: 2012-09-03 16:40:16.598--ServerSession(28419523)--Thread(Thread[[ACTIVE] ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Problem while unregistering MBean: weblogic.management.NoAccessRuntimeException: Access not allowed for subject: principals=, on ResourceType: Configuration Action: unregister, Target: null>
*** <Notice> <Stdout> <BEA-000000> <[EL Config]: connection: 2012-09-03