OC4J application to Weblogic 11g EJB error - spring

I am trying to deploy an application that was originally developed for OC4J. It was compliled under JDK 1.5 and ran on OC4J R3.
I deployed it to Weblogic 11g (10.3.6) and got the following error:
Exception preparing module: EJBModule(XXX-ejb-1.0.jar) Unable to deploy EJB: XXX-ejb-1.0.jar from XXX-ejb-1.0.jar: In EJB XXXXXXXXXX, both the remote home and remote component interface must be specified. Currently, only one of them is specified.
Substituted for missing class In EJB XXXXXXXXX, both the remote home and remote component interface must be specified. Currently, only one of them is specified. -
It is referring to an EJB 3.0 as defined in the ejb-jar.xml ejb-jar version="3.0" and afaik this seems to be an EJB 2.1 error because EJB 3 doesn't require both remote and home interfaces. The EJB is a Stateless Session bean that uses Spring 2.5.6 DI and doesn't use annotations, rather the ejb-jar.xml deployment descriptor.
public class myEJBImpl extends AbstractStatelessSessionBean
implements myEJB {
#Override
// Use Spring DI
protected void onEjbCreate() throws CreateException {
xxxDAO = xxx;
}

Related

Vaadin-SpringBootServletInitializer vs AppShellConfigurator .What is valid for production build on external Tomcat?

I'm building my project with Spring Boot and when uploading to Tomcat as a .war it was throwing errors.
In any case what fixed it is to change
public class Application implements AppShellConfigurator {
to
public class Application extends SpringBootServletInitializer implements AppShellConfigurator {
I've used a sampler from start.vaadin.com v22 to build upon which came by default with the
Application implements AppShellConfigurator
Like this it was running fine inside Intellij with the embedded Tomcat but when deploying to a standalone/external one , I had to change that to the latter.
Is that required ? if yes then the docs should be updated because at
https://vaadin.com/docs/v22/flow/production/production-build
there's no mention of it.
As M. Deinum said this is related to Spring Boot.
Usually you run the Spring Boot Application as an executable JAR. But If you want to run it as a WAR inside a Tomcat you have to use SpringBootServletInitializer.
The first step in producing a deployable war file is to provide a
SpringBootServletInitializer subclass and override its configure
method. Doing so makes use of Spring Framework’s servlet 3.0 support
and lets you configure your application when it is launched by the
servlet container. Typically, you should update your application’s
main class to extend SpringBootServletInitializer...
Source: https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto.traditional-deployment

jpa 2.1 spring boot with web sphere 8.5.5.8(full version) jdk 7

i followed the approach suggested by jeff
https://gist.github.com/jeffsheets/aec3e94870ef903ce7efe33e00563d3c
I was able to overcome the jpa 2.1 java.lang.ClassCastException: com.ibm.websphere.persistence.PersistenceProviderImpl incompatible with javax.persistence.spi.PersistenceProvider.
But i get the following error A servlet named com.x...JerseyConfig can not be dynamically added because a servlet configuration with the same name already exists. i am using WebSphere 8.5.5.8 Full version with JDK 1.7 spring boot 1.4.0.M3.
In my JerseyConfig.java
#Component
#PropertySources(value = {
#PropertySource("classpath:application.properties"),
#PropertySource("classpath:ValidationMessages.properties")})
#DependsOn("hibernatePersistenceProviderResolver")
public class JerseyConfig extends ResourceConfig {
public JerseyConfig() {
packages("com.x.package");
}
}
Thanks for any hints or pointers.
I did the following to make it work (in addition to #DependsOn mentioned previously).
1) load local class loader first and parent last.
2) Add the JVM property at the WebSphere Appserver com.ibm.websphere.jaxrs.server.DisableIBMJAXRSEngine to true in order to use only the JAX RS shipped with the application. (which fixes the servlet name already exists).
3) After deploying successfully when i ran my REST endpoint i got the following error at run time.
UOWManager transaction processing failed; nested exception is com.ibm.wsspi.uow.UOWException: java.lang.VerifyError: com/ibm/websphere/uow/UOWSynchronizationRegistry.registerInterposedSynch ronizat ion(Ljavax/transaction/Synchronization)V
To fix this add spring.jta.enabled=false to use the WebShpere JTA. (Ideally prefer to override web sphere JTA and use spring JTA, need to figure out a way).

cannot resolve reference to bean 'jmsconnectionfactory' when using spring boot + spring integration

I had a problem i'm using hornetq using spring boot and had to create a jmschannel in spring configuration using spring integration <int-jms:channel id="jmsChannel" queue-name="${spring.hornetq.embedded.queues}" connection-factory="jmsConnectionFactory">
<int-jms:interceptors><int:wire-tap channel="logger"/></int-jms:interceptors>
</int-jms:channel>
This is working fine in local when loading with undertow, when deployed the war to Jboss it is throwing up saying bean named jmsConnectionFactory not found, any help is greatly appreiciated
Looks like there is nothing to do with the Spring Integration, but only Spring Boot stuff, which is called deployable war:
The first step in producing a deployable war file is to provide a SpringBootServletInitializer subclass and override its configure method. This makes use of Spring Framework’s Servlet 3.0 support and allows you to configure your application when it’s launched by the servlet container. Typically, you update your application’s main class to extend SpringBootServletInitializer:
#SpringBootApplication
public class Application extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}

#EJB dependency injection query regarding Local Stateless Session bean (EJB 3.x)

I have 2 EJB projects.
Ejb1
Ejb2
Ejb1 has Stateless Local Session bean.
package p1;
#Stateless
public class CallerNew implements CallerLocal {
Ejb2 has Stateless Remote Session bean.
package p2;
#Stateless
public class MobilePhone implements MobilePhoneRemote {
#EJB(mappedName="CallerNew/local-p1.CallerLocal")
CallerLocal caller;
I deployed both the projects individually in the same server (JBoss v5.0).
The server registers CallerLocal also in Global JNDI namespace.
The question is even though I have made the CallerLocal as Local session bean, I can still get its reference through the JNDI from a separate EJB project which I thought is only possible if both the EJB projects are packaged into an EAR.
Is this behavior correct? please explain.

Spring EJB remote interface call

I need help in making a call to EJB remote interface from Spring.
I have a legacy EJB deployed in my JBoss.
Ejb-jar.xml islisted below.
<session>
<display-name>ServiceBean</display-name>
<ejb-name>ServiceBean</ejb-name>
<home>com.ejbproject.ejb.ServiceHome</home>
<remote>com.ejbproject.ejb.Service</remote>
<ejb-class>com.ejbproject.ejb.impl.ServiceBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
I have a web application which uses Spring.The spring application context contains the following entry:
<jee:remote-slsb id="myServiceBean"
jndi-name="ejb/ServiceBean"
business-interface="com.myproject.account.ejb.ServiceBean"
resource-ref='true'></jee:remote-slsb>
I created the business interface ServiceBean in web project and added all methods defined in remote interface define in ejb-jar.xml.
The web application is deployed in the same JBoss server.
But when I try to deploy I am getting a naming exception 'ServiceBean' not bound. Do I have to add environment entries in web.xml to access the EJB (even if both the EJB and web application are deployed in same JBoss)?
First of all, check real jndi-name of your ejb component, usually application server print some information about it in the log files.
Then try to define slsb like this
<jee:remote-slsb
id="taskStarter"
jndi-name="ejb/TaskStarterBean#ru.TaskStarterRemote"
business-interface="ru.TaskStarter"
lookup-home-on-startup="false"
/>
I show my realization of this structure:
#Remote(TaskStarterRemote.class)
#Local(TaskStarterLocal.class)
#Stateless
public class TaskStarterBean implements TaskStarter
#Remote
public interface TaskStarterRemote extends TaskStarter
public interface TaskStarter

Resources