Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<jee:local-slsb> no longer works with a business-interface attribute #31627

Closed
sammyhk opened this issue Nov 20, 2023 · 7 comments
Closed

<jee:local-slsb> no longer works with a business-interface attribute #31627

sammyhk opened this issue Nov 20, 2023 · 7 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: regression A bug that is also a regression
Milestone

Comments

@sammyhk
Copy link

sammyhk commented Nov 20, 2023

Affects: 6.1.0


When migrate Spring Framework from 5.3.x to 6.1.x, we noticed that <jee:local-slsb/> is not useable.
Using the similar XML configuration as the documentation (https://docs.spring.io/spring-framework/reference/integration/appendix.html#appendix.xsd-schemas-jee-local-slsb-complex)

<jee:local-slsb id="myBean" jndi-name="ejb/local/MyBean" business-interface="com.mycompany.MyBean" resource-ref="true" />

Causing exception:

Caused by: org.xml.sax.SAXParseException; lineNumber: 15; columnNumber: 25; cvc-complex-type.3.2.2: Attribute 'business-interface' is not allowed to appear in element 'jee:local-slsb'.
        at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
        at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:135)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
        at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:512)
        at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3588)
        at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2993)
        at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2287)
        at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:850)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:247)
        at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:342)
        at deployment.myproject.ear.xpc.war//org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:77)
        at deployment.myproject.ear.xpc.war//org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:441)
        at deployment.myproject.ear.xpc.war//org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399)

When tried to declared as regular bean XML as the documentation mentioned:

<bean id="myBean" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
	<property name="jndiName" value="ejb/local/MyBean" />
	<property name="businessInterface" value="com.mycompany.MyBean" />
	<property name="resourceRef" value="true" />
</bean>

resulting java.lang.ClassNotFoundException as org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean was removed in Spring Framework 6.x

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 20, 2023
@snicoll snicoll changed the title <jee:local-slsb /> is not useable Reference documentation still has reference to EJB access support Nov 20, 2023
@snicoll snicoll added type: documentation A documentation task and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 20, 2023
@snicoll snicoll added this to the 6.0.15 milestone Nov 20, 2023
@snicoll
Copy link
Member

snicoll commented Nov 20, 2023

Thanks for the report @sammyhk. This is an oversight on our end as the support for EJB access has been removed in Spring Framework 6. I've updated the upgrade notes and we will use this issue to fix the documentation.

If you need to lookup an EJB, please use JNDI directly.

@snicoll
Copy link
Member

snicoll commented Nov 20, 2023

Actually, let me take that back. I thought the support was completely removed but @jhoeller mentioned that the XML namespace has been preserved, delegating to JNDI.

@sammyhk can you please remove the business-interface attribute and try again? This shouldn't be required with modern EJBs.

@snicoll snicoll added status: waiting-for-triage An issue we've not yet triaged or decided on and removed type: documentation A documentation task labels Nov 20, 2023
@snicoll snicoll removed this from the 6.0.15 milestone Nov 20, 2023
@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Nov 20, 2023
@snicoll snicoll changed the title Reference documentation still has reference to EJB access support <jee:local-slsb> no longer works with a business-interface attribute Nov 20, 2023
@sammyhk
Copy link
Author

sammyhk commented Nov 20, 2023

Tried but the XSD marked business-interface attribute use="required" so cannot proceed.$

I think the proper fixed should be mark business-interface optional and delegate to proxyInterfaces of JNDI

@sammyhk

This comment was marked as duplicate.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 20, 2023
@snicoll
Copy link
Member

snicoll commented Nov 20, 2023

I can see that the XSD is outdated on schema.springframework.org and our own test have this error. I am not sure what you mean by "cannot proceed" unless you have enabled XSD validation. You can turn that off for the time being and remove the business-interface attribute. The code already delegates to JNDI as it is.

@sammyhk
Copy link
Author

sammyhk commented Nov 20, 2023

I can see that the XSD is outdated on schema.springframework.org and our own test have this error. I am not sure what you mean by "cannot proceed" unless you have enabled XSD validation. You can turn that off for the time being and remove the business-interface attribute. The code already delegates to JNDI as it is.

I see, we have some XSD validation in our build time so I haven't proceed the test. Now tested and it works if skipped the XSD validation.

@snicoll
Copy link
Member

snicoll commented Nov 20, 2023

Alright. For your own purpose here, please move to <jee:jndi-lookup>. We will re-add processing of the attribute (and ignoring it) to preserve backward compatibility.

@snicoll snicoll added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Nov 20, 2023
@snicoll snicoll modified the milestones: 6.0.15, 6.1.1 Nov 20, 2023
@github-actions github-actions bot added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-6.0.x labels Nov 20, 2023
@jhoeller jhoeller self-assigned this Nov 20, 2023
jhoeller added a commit that referenced this issue Nov 20, 2023
…bility

Legacy EJB attributes are ignored since 6.0 due to being bound to a plain JndiObjectFactoryBean - but can still be declared now, e.g. when validating against the common versions of spring-jee.xsd out there.

Closes gh-31627

(cherry picked from commit 6955598)
@jhoeller jhoeller added type: regression A bug that is also a regression and removed type: bug A general bug labels Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: regression A bug that is also a regression
Projects
None yet
Development

No branches or pull requests

4 participants