I am having trouble figuring out if the library jars specific to a project has to be added to the server configuration folder(In my case jboss server) or inside the application ear(inside WEB_INF/lib) or, inside both.
Recently i tried deploying an ear in a real time jboss server. And kept on getting the following error.
ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/iportalweb].[RBXLoginServlet]]
(http-/192.168.150.3:10041-4) JBWEB000236: Servlet.service() for
servlet RBXLoginServlet threw exception:
java.lang.NoClassDefFoundError: Could not initialize class
org.jboss.logmanager.MDC
at org.apache.log4j.MDC.remove(MDC.java:23) [log4j-jboss-logmanager-1.1.0.Final-redhat-2.jar:1.1.0.Final-redhat-2]
at com.orbidirect.aps.common.Log4jMDCInitializer.removeFromMDC(Log4jMDCInitializer.java:54)
[iRetailLib.jar:]
at com.polaris.iportal.ws.filters.LogInitializationFilter.doFilter(LogInitializationFilter.java:120)
[classes:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at com.polaris.canvas.filters.DeviceDetectFilter.doFilter(DeviceDetectFilter.java:94)
[CTRenderLib.jar:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at com.polaris.canvas.filters.DeviceDetectFilter.doFilter(DeviceDetectFilter.java:94)
[CTRenderLib.jar:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
[jboss-as-web-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)
[jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_91]
I know that with eclipse u could always add jars to project deployment assembly and run it in local. But if the server library has the same jars would there be an problem?
Usually you place your jar library in your ear's lib directory, or your war's lib directory, depending on how you are packing your application. This is the most common way to deploy your library jars.
If you are planning to use the same jar on multiple applications (for example, database drivers), you can declare a jboss module for this jar, and then declare a dependency on your applications that need this jar through MANIFEST.MF file.
It´s not a good idea to deploy jars that jboss already has, because you can have version conflicts.. If you are using maven, you can declare those dependencies as provided, so they won't get copied to you applications lib folder.
Related
I am developing a RCP Application with its product.
When I export the product, the application does not work with xml-dom showing some errors as below.
I added javax.xml dependency both in plug-in project and the product configuration.
I am using eclipse 2021-09 and jdk 17.
and I removed java.xml in Module Dependencies, Java Build Path for the plug-in project since there were some error with "import javax.xml.*" saying that *** is accessible from more than one module: , java.xml.
I cleaned the project several time and then exported the product again.
It is working well when I run it from eclipse but does not work with a exported application.
I would appreciate for some help.
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.Error: Unresolved compilation problems:
Document cannot be resolved to a type
DocumentBuilderFactory cannot be resolved
NodeList cannot be resolved to a type
)
at org.eclipse.swt.SWT.error(SWT.java:4893)
at org.eclipse.swt.SWT.error(SWT.java:4808)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:188)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4029)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3629)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1041)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
I am getting the below error when i am running my project which will drag a text and drop on an image.
SEVERE: Servlet.service() for servlet Vaadin threw exception
java.lang.ClassNotFoundException: com.google.gwt.user.client.ui.Widget
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2446)
at java.lang.Class.getConstructor0(Class.java:2756)
at java.lang.Class.getConstructor(Class.java:1693)
at com.vaadin.server.ServletPortletHelper.verifyUIClass(ServletPortletHelper.java:75)
at com.vaadin.server.ServletPortletHelper.initDefaultUIProvider(ServletPortletHelper.java:139)
at com.vaadin.server.VaadinService.createAndRegisterSession(VaadinService.java:764)
at com.vaadin.server.VaadinService.doFindOrCreateVaadinSession(VaadinService.java:718)
at com.vaadin.server.VaadinService.findOrCreateVaadinSession(VaadinService.java:659)
at com.vaadin.server.VaadinService.findVaadinSession(VaadinService.java:518)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1396)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:305)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:695)
GWT Graphics is a GWT library, which means that it doesn't work with the server-side API of Vaadin. If you want to use it with Vaadin, you need to create your own component, and use GWT Graphics on the client side of that component.
I have a weird problem with my setup that I don't understand. I'm working on a maven GWT project that runs fine in a shell (i.e. mvn gwt:run is working as expected).
However, when I try to run it in Eclipse (with m2e and gwt plugin installed), I get a classnotfoundexception. The class is an entity class and the exception occurs when the entity manager is built. I checked that the class is declared in the persistence.xml and I cannot find any exclusion in the pom.xml or the eclipse build path.
On top of this, it works fine for someone else working on the exact same project.
My guess is that I have a configuration error in Eclipse but I didn't tweek anything.
Any ideas?
Eclipse 4.2
GWT 2.4
Maven 3.0.3
Spring 3.0.5
[WARN] Failed startup of context com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload#57790a{/,C:\Users\gere\Documents\netlight-workspace\NET2\target}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManager' defined in ServletContext resource [/WEB-INF/database.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: netlight_db] class or package not found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: netlight_db] class or package not found
at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1386)
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:1159)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1004)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:689)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 30 more
Caused by: java.lang.ClassNotFoundException: se.netlight.projectplusgui.server.dbo.BusinessArea
at java.lang.ClassLoader.findClass(ClassLoader.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:170)
at org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:1302)
at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1374)
... 38 more
[WARN] Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManager' defined in ServletContext resource [/WEB-INF/database.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: netlight_db] class or package not found:
java.lang.ClassNotFoundException: se.netlight.projectplusgui.server.dbo.BusinessArea
at java.lang.ClassLoader.findClass(ClassLoader.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:170)
at org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:1302)
at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1374)
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:1159)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1004)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:689)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
1) Try executing mvn clean install and then launching the hosted mode. If it works this means some classes/files need to be copied into target for your project to work.
2) If you trying to use Google GWT Webapp Launch, then check your launch folders for arguments. You should try and align it to maven's set up of target, artifact with/without version id etc
3) Check your project names to see if you have imported the maven project with versionid suffix to your project. This might be causing some classpath issues.
It could be the classloading of GWT-Eclipse. By default when running a GWT application from Eclipse all jars in the lib folder are added to the running applications classpath. In addition when Eclipse-GWT comes across any classes that are not on this classpath it searches the system classpath. If it finds the class the corresponding jar is also added to the running applications classpath. This will be logged in the console.
Generally this is okay but it does cause issues when you search the classpath. Classes won't be found unless the jar has been added to the running classpath by Eclipse. You can hack things but its not ideal (see the answer to this question).
I am guessing that with Maven all the Maven dependency jars are being added to the system classpath. When combined with Spring and JPA then there is a lot of classpath searching going on.
That doesn't explain why it works on another persons mechine - unless they have additional jars in their web app lib folder.
As to how to fix it "properly" I am not sure. I am in the same position myself - I have one application that works and one that is configured in a very similar way that doesn't. It's also the reason I found this question!
I have created some OSGI bundles that I was running in Felix with no problems. I have a bundle that invokes a call to a jaxws service. All the stubs for the osgi bundle were generated using cxf-codegen-plugin. Everything works fine if I startup felix directly and execute my application.
I have recently moved this to having everything running inside of a jboss application server(JBoss 5.1.0.GA). I am using the servlet-bridge, and starting up felix when my servlet is registered. Everything starts up find, and all of my bundles are started without error. However when I execute my application I get the following error:
22:23:40,688 ERROR [[proxy]] Servlet.service() for servlet proxy threw exception
javassist.NotFoundException: com.service.ws.Parameters
at javassist.ClassPool.get(ClassPool.java:436)
at org.jboss.ws.core.jaxws.DynamicWrapperGenerator.addProperty(DynamicWrapperGenerator.java:226)
at org.jboss.ws.core.jaxws.DynamicWrapperGenerator.generate(DynamicWrapperGenerator.java:122)
at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder.processWebMethod(JAXWSMetaDataBuilder.java:796)
at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder.processWebMethods(JAXWSMetaDataBuilder.java:920)
at org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder.rebuildEndpointMetaData(JAXWSClientMetaDataBuilder.java:298)
at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.getPortInternal(ServiceDelegateImpl.java:269)
at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.getPort(ServiceDelegateImpl.java:200)
at javax.xml.ws.Service.getPort(Service.java:99)
at com.service.ws.JasperService_Service.getJasperServicePort(JasperService_Service.java:46)
at com.service.ws.JasperReportImpl.initializeServer(JasperReportImpl.java:56)
at com.web.ui.ReportWindow.handleParameters(ReportWindow.java:122)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:528)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:96)
at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:79)
at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java:48)
at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:39)
at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.felix.http.proxy.ProxyServlet.service(ProxyServlet.java:60)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:662)
I'm not sure why the javassist classes are not able to find that class. It is part of the same bundle the call to getPort is made from, and all of this works fine when running from felix directly.
*UPDATE
I can get past this initial error if I put the jar(bundle) containing the class that is being looked for in the jboss lib directory, thus putting it on the global classpath. However once I get past that initial resolution error, I then get another error as follows:
22:05:10,823 ERROR [ServiceDelegateImpl] Cannot create proxy for SEI com.service.ws.JasperService from: file:/home/work/appservers/osgi/bundle/com.jasper-server-ws-client-1.0-SNAPSHOT.jar
22:05:10,824 ERROR [[proxy]] Servlet.service() for servlet proxy threw exception
java.lang.IllegalArgumentException: interface com.service.ws.JasperService is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.createProxy(ServiceDelegateImpl.java:400)
at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.getPortInternal(ServiceDelegateImpl.java:273)
at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.getPort(ServiceDelegateImpl.java:200)
at javax.xml.ws.Service.getPort(Service.java:99)
So something is screwed up with the classpath. I'm not sure why, but it appears that the class pathing for my bundles might be incorrect in some way, but i'm not sure where.
Your current problem, as raised in your first update, is one of Java reflection.
The secret here is to update your MANIFEST.MF file to expose com.service.ws.JasperService to the class loader. Following this guide, you might try something like:
Export-Package: com.service.ws.JasperService
Best of luck with your project.
I'm new to using libraries, but i need to be able to send an email to users who forget their password. I'm trying to use the JavaMail and Apache Commons Email to implement this. However, I think I must be importing the libraries wrongly.
When I try to send an email, I get the following message:
Apr 17, 2011 11:54:33 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 60 in the jsp file: /sendpw.jsp
The type javax.mail.Authenticator cannot be resolved. It is indirectly referenced from required .class files
the code:
57: EmailAuthentication ea = new EmailAuthentication();
58: String authUser = ea.getUser();
59: String authPw = ea.getPw();
60: email.setAuthenticator(new DefaultAuthenticator(authUser, authPw));
61: email.setTLS(true);
62: email.setFrom(authUser+"#gmail.com");
63: email.setSubject("Your Last Love Password");
Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
at java.lang.Thread.run(Thread.java:662)
I've tried a few things:
Copied the org.apache.commons.mail folder containing all the .java files into the source file of my netbeans project, and then adding the javamail library to the project. This worked the first time and I was able to send a few successful emails, but someway down the road it stopped working (perhaps because I cleaned and built the project) and i get the above message.
Created a new library with the jar files in the bin version of the commons-email-1.2 just like i did with the javamail, and add it to the project. This one doesnt seem to work, because when I open up the defaultauthenticator.java, it cannot import javax.mail.Authenticator, although i've added both libraries to the same netbeans project.
Added mail.jar and all the other .jars (dsn.jar, imap.jar, pop3.jar etc) from javamail into the same library as the apache common-email-1.2, meaning 2 classpath files (mail.jar and commons-email-1.2.jar) and 6 source files. This time, there was no error in the defaultauthenticator.java but still cannot send any email (same server error as above).
The part of the code involved is:
HtmlEmail email = new HtmlEmail();
email.setHostName("smtp.gmail.com");
email.setSmtpPort(587);
......
email.setAuthenticator(new DefaultAuthenticator(authUser, authPw));
email.setTLS(true);
email.setFrom(authUser+"#gmail.com");
email.setSubject("Your Password");
....
I am using Netbeans 6.9.1, tomcat 6.0.26.
What am I doing wrongly?
You need the mail.jar - and probably the activation.jar - library to be accessible from within your web application, so they should be either
in the tomcat6/lib, or
in the yourwebapp/WEB-INF/lib
folder.
If someone is using Maven Project and faces this error, then remove jasper properties and dependency from Pom.xml.