Jersey 2.10 in IBM WebSphere - jersey

I am setting up project with Jersey 2.10, JavaSE 1.7 in Websphere 8.5.5.2 (websphere 7.1 SDK)
When i deploy the project, i get this error
com.ibm.ws.webcontainer.webapp.WebApp commonInitializationFinally SRVE0266E: Error occured while initializing servlets: {0}
javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:404)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168)
I tried to delete the jersey libraries after deploying the project and map it to shared library (same jersey libraries) on websphere. The shared library is mapped to project now, but get other error when i run the application like below.
com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[RESTSrv01]: com.ibm.ws.webcontainer.webapp.WebAppErrorReport: Internal Server Error
at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendError(WebAppDispatcherContext.java:626)
at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendError(WebAppDispatcherContext.java:656)
at com.ibm.ws.webcontainer.srt.SRTServletResponse.sendError(SRTServletResponse.java:1301)
at org.glassfish.jersey.servlet.internal.ResponseWriter.commit(ResponseWriter.java:199)
at org.glassfish.jersey.server.ContainerResponse.close(ContainerResponse.java:412)
Any suggestion what could be the problem?

Related

Websphere 8.5.5 - spring boot error: SpringServletContainerInitializer not a subtype

I have a spring boot application that works fine on Tomcat 8. When I try to deploy it on Websphere 8.5.5 with "Class loader order" set to "Classes loaded with local class loader first (parent last)" the application fails to start with the following exception:
... 73 more
Caused by: java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.springframework.web.SpringServletContainerInitializer not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:242)
at java.util.ServiceLoader.access$300(ServiceLoader.java:192)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:380)
at java.util.ServiceLoader$1.next(ServiceLoader.java:456)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:537)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:410)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:171)
... 74 more
Just adding my experience with this problem, looking around on the various answers to similar problems I found out that the problem could be caused by some javax-servlet related jar in the classpath. After some trial and error I noticed that the spring-boot-starter-web dependency has an inherited spring-boot-starter-tomcat dependency. Excludung this jar from the application classpath when deploying on Websphere 8.5.5 solved the problem.

Error running CXF REST web service on Apache Tomee

I'm trying to build a RESTful web service using the "org.apache.cxf.archetype:cxf-jaxrs-service" maven archetype. When I deploy it on Apache Tomee I get the following error:
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'services': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionException
...
...
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:219)
...
...
Caused by: java.lang.ClassCastException: Cannot cast org.apache.cxf.management.jmx.InstrumentationManagerImpl to org.apache.cxf.management.InstrumentationManager*
My guess is I'm missing some configuration but I thought the archetype would 'just work'.
Any ideas?
this error means you have a conflict between cxf in the webapp (WEB-INF/lib) and tomee. You either have to configure the classloading to do that or (recommanded and expected by EE) just remove CXF from the webapp since it is in tomee and tomee does the job for you.
Side note: you will also likely need to clean up the web.xml since tomee will handle the deployment without the need to register a servlet.

Error Migrating from Spring 3.2.2 to 4.0.2

We are trying to migrate a Spring MVC application from 3.2.2 to 4.0.2 and receive the below error.
The .jar files in the lib folder are (all below jar files have been changed to 4.0.2 version):
spring-beans-3.2.2.RELEASE.jar spring-context-3.2.2.RELEASE.jar
spring-core-3.2.2.RELEASE.jar spring-expression-3.2.2.RELEASE.jar
spring-orm-3.2.2.RELEASE.jar spring-web-3.2.2.RELEASE.jar
spring-webmvc-3.2.2.RELEASE.jar
Also added one more jar : spring-aop-4.0.2.RELEASE
ERROR:
[9/28/15 1:43:54:731 EDT] 00000026 ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0014E: Uncaught service() exception root cause /xbnp/sprin
g/BenefitDistributionParameter.jsp: com.ibm.websphere.servlet.error.ServletErrorReport: java.lang.NoSuchMethodError: org/springframework/web/servlet/tags/form/InputTag.
setDisabled(Ljava/lang/String;)V
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:695)
at com.ibm._jsp._BenefitDistributionParameter._jspService(_BenefitDistributionParameter.java:1953)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
Caused by: java.lang.NoSuchMethodError: org/springframework/web/servlet/tags/form/InputTag.setDisabled(Ljava/lang/String;)V
at com.ibm._jsp._BenefitDistributionParameter._jspx_meth_spring_input_1(_BenefitDistributionParameter.java:2010)
at com.ibm._jsp._BenefitDistributionParameter._jspService(_BenefitDistributionParameter.java:624)
How can we rectify this error?

Difficulty importing the Vaadin SimpleCRM example app for local development

I'm having some trouble importing the SimpleCRM example app (vaadin-jpa-app) found at the bottom of the Vaadin Blog post titled "A recipe for a data centric rich internet application" on January 20 ( Link: https://vaadin.com/blog/-/blogs/a-recipe-for-a-data-centric-rich-internet-application )
After git cloning the repository from https://hub.jazz.net/git/vaadin/vaadin-jpa-app as described in the README.md, I have tried to import the project as a Maven project into Eclipse Luna but unfortunately receive the following errors related to the pom.xml file:
vaadin-maven-plugin:7.3.7:resources
vaadin-maven-plugin:7.3.7:update-theme
vaadin-maven-plugin:7.3.7:update-widgetset
I have tried to deploy the application to my WebSphere Liberty Profile Server anyway but get a "Context Root Not Found" error.
I have also noticed that in my server.xml file under WebSphere Application Server Liberty Profile, I see warnings mentioning that the elements "jdbcDriver" and "dataSource" are "not enabled by the available features" after copying the relevant code outlined in the "Local development" section of the README.md ( from https://hub.jazz.net/project/vaadin/vaadin-jpa-app/overview )
Can someone more familiar with this process walk me through what I should be doing? It would be much appreciated. Thanks!
(Begin procedure)
Preparation:
1) In Eclipse, I installed the WebSphere Application Server Liberty Profile via Eclipse Marketplace ( http://marketplace.eclipse.org/content/ibm-websphere-application-server-liberty-profile-developer-tools-luna-0 )
2) Under the Enterprise Explorer in Eclipse, in WebSphere Application Server Liberty Profile | servers | defaultServer | server.xml, I have added the JDBC Driver configuration snippet as outlined in the Readme. I also modified the code according to the snippet you posted.
3) I added a derby.jar file into the appropriate directory as mentioned in the Readme
4) I installed the m2e-wtp connector (http://marketplace.eclipse.org/content/maven-java-ee-integration-eclipse-wtp-luna)
5) Using Git Shell, I git clone https://hub.jazz.net/git/vaadin/vaadin-jpa-app
Deploying the application:
6) Afterwards, in Eclipse, I import the vaadin-jpa-app directory I just cloned as an "Existing Maven Project". This creates a vaadin-jpa-app project as well as a vaadin-jpa-applicationEAR project in the Eclipse Enterprise Explorer.
7) At this point, the three "errors" I described earlier are rectified by choosing "Do Not Execute (add to pom)" as the action for each of the "errors". (Description: Places metadata which tells m2e to ignore the execution in the pom(s) that adds the Maven plugin to the build.)
8) I right-click the "vaadin-jpa-application [vaadin-jpa-app master]" project and select Run As | Maven Install.
9) I right-click the "vaadin-jpa-application [vaadin-jpa-app master]" project and select Run As | Run On Server.
10) I select the WebSphere Application Server Liberty Profile under localhost and ensure that only the vaadin-jpa-application (and not the vaadin-jpa-applicationEAR) is under the "Configured:" column. This produces a 404 error.
(Begin console output)
Launching defaultServer (WebSphere Application Server 8.5.5.4/wlp-1.0.7.cl50420141211-1039) on Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_25-b18 (en_US)
[AUDIT ] CWWKE0001I: The server defaultServer has been launched.
[AUDIT ] CWWKZ0058I: Monitoring dropins for applications.
[ERROR ] SRVE9990E: The class org.vaadin.presentation.Servlet has a #WebServlet annotation but does not implement the javax.servlet.http.HttpServlet interface.
[ERROR ] SRVE9991E: The class org.vaadin.presentation.CompressionFilter has a #WebFilter annotation but does not implement the javax.servlet.Filter interface.
[WARNING ] CWWJP9991W: openjpa.Enhance: Warn: An exception was thrown while attempting to perform class file transformation on "org.vaadin.backend.domain.Customer":
Exception : java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError: Lcom/vividsolutions/jts/geom/Point;
[WARNING ] CWWJP9991W: openjpa.Enhance: Warn: An exception was thrown while attempting to perform class file transformation on "org.vaadin.backend.domain.Customer":
Exception : java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError: Lcom/vividsolutions/jts/geom/Point;
[WARNING ] CWNEN0049W: Resource annotations on the methods of the org.vaadin.backend.CustomerService class will be ignored. The annotations could not be obtained because of the exception : <openjpa-2.2.3-SNAPSHOT-r422266:1595313 nonfatal general error> org.apache.openjpa.util.GeneralException: Lcom/vividsolutions/jts/geom/Point;
[WARNING ] CWWJP9991W: openjpa.Enhance: Warn: An exception was thrown while attempting to perform class file transformation on "org.vaadin.backend.domain.Customer":
Exception : java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError: Lcom/vividsolutions/jts/geom/Point;
[ERROR ] CNTR4006E: The CustomerService enterprise bean in the vaadin-jpa-application.war module of the vaadin-jpa-application application failed to start. Exception: <openjpa-2.2.3-SNAPSHOT-r422266:1595313 nonfatal general error> org.apache.openjpa.util.GeneralException: Lcom/vividsolutions/jts/geom/Point;
at org.apache.openjpa.enhance.PCClassFileTransformer.transform0(PCClassFileTransformer.java:164)
at org.apache.openjpa.enhance.PCClassFileTransformer.transform(PCClassFileTransformer.java:126)
at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.transform(PersistenceProviderImpl.java:290)
at com.ibm.ws.jpa.management.JPAPUnitInfo.transformClass(JPAPUnitInfo.java:1380)
at [internal classes]
Caused by: java.lang.NoClassDefFoundError: Lcom/vividsolutions/jts/geom/Point;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2575)
at java.lang.Class.getDeclaredFields(Class.java:1908)
at org.apache.openjpa.lib.util.J2DoPrivHelper$7.run(J2DoPrivHelper.java:297)
at org.apache.openjpa.lib.util.J2DoPrivHelper$7.run(J2DoPrivHelper.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.openjpa.persistence.PersistenceMetaDataDefaults.determineImplicitAccessType(PersistenceMetaDataDefaults.java:366)
at org.apache.openjpa.persistence.PersistenceMetaDataDefaults.determineAccessType(PersistenceMetaDataDefaults.java:334)
at org.apache.openjpa.persistence.PersistenceMetaDataDefaults.populate(PersistenceMetaDataDefaults.java:276)
at org.apache.openjpa.meta.MetaDataRepository.addMetaData(MetaDataRepository.java:920)
at org.apache.openjpa.meta.MetaDataRepository.addMetaData(MetaDataRepository.java:905)
at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.getMetaData(AnnotationPersistenceMetaDataParser.java:752)
at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseClassAnnotations(AnnotationPersistenceMetaDataParser.java:545)
at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parse(AnnotationPersistenceMetaDataParser.java:415)
at org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:260)
at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:586)
at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:396)
at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:388)
at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:286)
at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:257)
at org.apache.openjpa.enhance.PCClassFileTransformer.transform0(PCClassFileTransformer.java:146)
... 4 more
Caused by: java.lang.ClassNotFoundException: Could not find class 'com.vividsolutions.jts.geom.Point' as resource 'com/vividsolutions/jts/geom/Point.class'
... 29 more
[AUDIT ] CWWKT0016I: Web application available (default_host): http://localhost:9080/vaadin-jpa-application/
[AUDIT ] CWWKZ0001I: Application vaadin-jpa-application started in 4.171 seconds.
[AUDIT ] CWWKF0011I: The server defaultServer is ready to run a smarter planet.
[WARNING ] CWWJP9991W: openjpa.Enhance: Warn: An exception was thrown while attempting to perform class file transformation on "org.vaadin.backend.domain.Customer":
Exception : java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError: Lcom/vividsolutions/jts/geom/Point;
[WARNING ] CWWJP9991W: openjpa.Enhance: Warn: An exception was thrown while attempting to perform class file transformation on "org.vaadin.backend.domain.Customer":
Exception : java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError: Lcom/vividsolutions/jts/geom/Point;
[WARNING ] CWNEN0049W: Resource annotations on the methods of the org.vaadin.backend.CustomerService class will be ignored. The annotations could not be obtained because of the exception : <openjpa-2.2.3-SNAPSHOT-r422266:1595313 nonfatal general error> org.apache.openjpa.util.GeneralException: Lcom/vividsolutions/jts/geom/Point;
[WARNING ] CWWJP9991W: openjpa.Enhance: Warn: An exception was thrown while attempting to perform class file transformation on "org.vaadin.backend.domain.Customer":
Exception : java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError: Lcom/vividsolutions/jts/geom/Point;
When you start, make sure you have an eclipse installation that has no extra plugins and latest versions of liberty profile plugin (or its beta release) installed. Other eclipse plugins may disturb the deployment.
Also make sure that you have the latest version of the example project (git pull). Both Liberty and Vaadin CDI have developed fast during the last couple of months and there might have been some small incompatibilities.
The "errors" eclipse says are just that eclipse don't know how it should handle those build settings internally. You can just mark them so that eclipse ignores them and do full build once (mvn install) to get client side resources compiled.
If Eclipse creates an "ear project" when it imports the war file, just delete that and deploy the war file only.
In server.xml you must enable required features. The app needs servlet, JPA, EBJ lite and CDI, but it is probably easier and almost as lightweight to just enable whole java ee 6 web profile stuff, this is what I use in my liberty server pretty much always:
<!-- Enable features -->
<featureManager>
<feature>localConnector-1.0</feature>
<feature>webProfile-6.0</feature>
</featureManager>
If you have derby jar added as in instructions and the data source define, things should then work just fine. Let me know if there is still some issue.

Worklight Server6.0 Installation on WAS

I have WAS v8.0.0.3 running on my machine. I've installed worklight server v6.0 on WAS using IBM Installation manager. But using this config, when i try to install a woklight .war of an application and try to access console, it throws an exception.
Error 500: java.lang.RuntimeException: BaseProjectLocal is null
From the logs, while accessing application console, this exception comes:
[8/21/13 3:32:28:986 PDT] 0000008b LocalTranCoor E WLTC0017E: Resources rolled back due to setRollbackOnly() being called.
[8/21/13 3:32:28:997 PDT] 0000008b webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[ServletNameNotFound]: java.lang.RuntimeException: BaseProjectLocal is null
at com.worklight.common.util.BaseProjectLocal.get(BaseProjectLocal.java:41)
at com.worklight.server.util.ProjectLocal.get(ProjectLocal.java:55)
at com.worklight.server.util.ProjectLocal.getCoreBeanFactoryS(ProjectLocal.java:95)
at com.worklight.core.util.RssBrokerUtils.getBeanFactory(RssBrokerUtils.java:60)
While starting the application, this exception comes in logs:
[8/21/13 3:37:56:992 PDT] 000000a5 webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
java.lang.NullPointerException
at com.worklight.server.bundle.project.JeeProjectActivator.contextInitialized(JeeProjectActivator.java:105)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1651)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:410)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:422)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:714)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1160)
I fear if something is wrong with installation configuration or database configuration. I'm using mySQL database as backend for worklight. Installation has created Datasource on WAS and test connection also succeeds.
Any help would be highly appreciated.
The IBM Installation Manager does not install Worklight into your existing WAS installation.
In Worklight 6.0 all that it currently does, is:
extract the Worklight framework files and place them in your HD
extract Ant task scripts
You then need to edit these Ant task scripts with your database and .war information and run them to actually install.
Make sure you read the IBM Worklight 6.0 Information Center at:
http://pic.dhe.ibm.com/infocenter/wrklight/v6r0m0/topic/com.ibm.worklight.help.doc/admin/c_installation.html

Resources