Web app with JPA doesn't work on extenal Tomcat server - java

I've some problems with publishing my Dynamic Web application in Tomcat, on my VPS server.
I developed an application which contains Servlet( creating Entity Manager and doing operations on the database), and jar files - also Entity components are packed in jar file.
Application uses eclipselink and postgresql.
On Tomcat 7 Server installed witch eclipse, everything works fine, but when I try to deploy it to Tomcat 7 Server on my VPS I'm getting an exception:
javax.servlet.ServletException: Error instantiating servlet class pl.marekbury.controller.StoreServer
and the root cause
javax.naming.NameNotFoundException: Name [pl.marekbury.controller.StoreServer/PERSISTENCE_UNIT_NAME] is not bound in this Context. Unable to find [pl.marekbury.controller.StoreServer].
I had also the same error on my localhost eclipse-integrated server, but i found a solution (somwere here, on stack) to chcange eclipselink version, after I did id, error's gone.
I'm deploying app in these way:
- export war from eclispe
- deploy it trough tomcat web manager
I tried:
- Change server to Tomee
- Place all jar libs in WEB-INF/lib
Structure of application folder after deploying to tomcat:
----krzyzyk
| |---index.jsp
|---META-INF
| |---MANIFEST.MF
|
|---WEB-INF
| |---web.xml
| |---lib
| | |---all jar files(entities,servlet-api itd..)
| |
| |---classes
| | |---META-INF(remain after making jar with entities)
| | |---pl
| | | |---marekbury
| | | | |---controller
| | | | | |---StoreServer.class
| | | | |---model
| | | | | |---entities
| | | | | | |---User.class (remain after making jar with entities)
index.jsp makes http request to servlet StoreServer
Any ideas how to make it run properly?

I have found solution. Error was caused by different Java versions on vps(oracle 1.7) and my computer(openJDK 1.7). I have made .WAR on VPS and everything works fine.

Related

Feature / bundle list for JPA [2.1] for Karaf

I'm trying to migrate project from Eclipse OSGi runtime environment to Karaf, and I prepare install script for depenendecies. It is quite a hard way, for example, transaction API requires javax.enterprise.cdi-api, and this requires
javax.el,version=3.0.0 from javax.el-api (6)
javax.inject,version=1.0.0 from com.eclipsesource.jaxrs.jersey-all (59)
javax.interceptor,version=1.2.0 from javax.interceptor-api (48)
For sure, I'm not the first and last person to go that way. Are there any ready features / bundle lists / install scripts which I could use for the process? And how / where to search for them?
Searching for "JPA 2.1 feature for Karaf" returns me the list of posts with problems people have building their feature list... no ready solutions...
I'm working on Apache ServiceMix 7.0.0 and I have a JPA 2.3.0 feature which is available.
Features list
karaf#root>feature:list | grep jpa
deltaspike-jpa | 1.2.1 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Apache Deltaspike jpa support
camel-jpa | 2.16.4 | | Uninstalled | camel-2.16.4 |
jpa | 1.0.4 | | Uninstalled | enterprise-4.0.8 | OSGi Persistence Container
jpa | 2.3.0 | x | Started | enterprise-4.0.8 | OSGi Persistence Container
openjpa | 2.2.2 | | Uninstalled | enterprise-4.0.8 | Apache OpenJPA 2.2.x persistence engine support
openjpa | 2.3.0 | | Uninstalled | enterprise-4.0.8 | Apache OpenJPA 2.3.x persistence engine support
openjpa | 2.4.1 | | Uninstalled | enterprise-4.0.8 | Apache OpenJPA 2.4.x persistence engine support
deltaspike-jpa | 1.3.0 | | Uninstalled | org.ops4j.pax.cdi-1.0.0.RC1 | Apache Deltaspike jpa support
drools6-jpa | 6.2.0.Final | | Uninstalled | servicemix-kie-7.0.0 | Drools 6 JPA support
The JPA 2.3.0 is coming from enterprise-4.0.8 features repository with URL mvn:org.apache.karaf.features/enterprise/4.0.8/xml/features
Repository list
karaf#root>feature:repo-list
Repository | URL
-------------------------------------------------------------------------------------------------------
org.ops4j.pax.cdi-0.12.0 | mvn:org.ops4j.pax.cdi/pax-cdi-features/0.12.0/xml/features
jclouds-1.9.1 | mvn:org.apache.jclouds.karaf/jclouds-karaf/1.9.1/xml/features
org.ops4j.pax.jdbc-0.9.0 | mvn:org.ops4j.pax.jdbc/pax-jdbc-features/0.9.0/xml/features
camel-2.16.4 | mvn:org.apache.camel.karaf/apache-camel/2.16.4/xml/features
activemq-core-5.14.3 | mvn:org.apache.activemq/activemq-karaf/5.14.3/xml/features-core
org.ops4j.pax.web-4.3.0 | mvn:org.ops4j.pax.web/pax-web-features/4.3.0/xml/features
enterprise-4.0.8 | mvn:org.apache.karaf.features/enterprise/4.0.8/xml/features
org.ops4j.pax.cdi-1.0.0.RC1 | mvn:org.ops4j.pax.cdi/pax-cdi-features/1.0.0.RC1/xml/features
framework-4.0.8 | mvn:org.apache.karaf.features/framework/4.0.8/xml/features
standard-4.0.8 | mvn:org.apache.karaf.features/standard/4.0.8/xml/features
cxf-3.1.5 | mvn:org.apache.cxf.karaf/apache-cxf/3.1.5/xml/features
activemq-5.14.3 | mvn:org.apache.activemq/activemq-karaf/5.14.3/xml/features
servicemix-kie-7.0.0 | mvn:org.apache.servicemix.features/servicemix-kie/7.0.0/xml/features
spring-4.0.8 | mvn:org.apache.karaf.features/spring/4.0.8/xml/features
servicemix-features-7.0.0 | mvn:org.apache.servicemix.features/servicemix-features/7.0.0/xml/features
servicemix-examples-7.0.0 | mvn:org.apache.servicemix.features/servicemix-examples/7.0.0/xml/features
I hope this can help.

JBoss configuration files

I've inherited a project that is running a single instance of a JBoss 7.x server, java back-end, etc. I'm completely new to JBoss and I was curious about the configuration of the file structure(s), what I have to have and where. The documentation has a different structure than what I've been handed and I'm not sure how one would, say, setup a completely new web application server project (i.e. starting a project from scratch).
Why, for instance, do I have multiple standalone.xml files? Namely,
standalone.xml
standalone-ha.xml
standalone-full-ha.xml
standalone-full.xml
Basically, I'm looking for a 'You NEED these to get your app running' sort of guide.
My JBoss folder has this structure
|--appclient
| |--configuration
| | `--appclient.xml
| | `-- logging.properties
|
|--bin
| |--client
| | `-- jboss-client.jar
| |--init.d
| | `-- jboss-as.conf
| | `-- jboss-as-standalone.sh
| `--(a lot of .bat and .conf files)
|
|--bundles
| |--javax
| | |--servlet
| | |--api
| | |--v25
| | `--jbosgi-http-api-1.0.5.jar
| |--org
| |--apache
| |--jboss
| |--osgi
| |--projectodd
|
|--docs
| |--examples
| |--schema
|
|--domain
| |--configuration
| | `--domain.xml
| | `--host.xml
| | `--host-master.xml
| | `--host-slave.xml
| |--data
| | |--content
| | `--(empty)
| |--tmp
| | |--auth
| | `--(empty)
|
|--modules
| |--asm
| | |--main
| | |--asm
| | `--asm-3.3.1.jar
| | `--module.xml
| |--ch
| |--com
| |--gnu
| |--javaee
| |--javax
| |--jline
| |--net
| |--nu
| |--org
| |--sun
|
|--standalone
| |--configuration
| | `--(I know the standalone.xml files go here)
| |--data
| |--deployments
| | `-- (I know the .war files go here)
| |--lib
| |--log
| | `-- (what ever could this be?? *sarcasm)
| |--tmp
|
|--welcome-content
*clearly I got tired and didn't label everything in every folder
The link you provided is for an older version of jboss (4, 5), that is why it's all different jej
standalone*.xml specifies the services jboss provides to the user. You can choose the services you need, so you don't have to waste memory on services you are not going to use.
For example, standalone-full-ha.xml provides all services, and also starts jboss in a cluster mode. standalone-full has all the services, but without cluster mode. standalone.xml is the default one, and has all the basic services you will need to deploy an app (note that it does not include JMS support).
In the extension section of your standalone*.xml you can see what services are being provided.
When you start jboss, if you don't use the -c param, it will use standalone.xml. If you want to use standalone-full.xml (or any other config, could be a custom one), you would use standalone.bat -c standalone-full.xml
As you said, standalone/deployments is where you deploy your apps. Remember to place a .dodeploy file to tell jboss to deploy your apps. For example, myExample.war should have a myExample.war.dodeploy (if you forget this, the log will tell you that there is an app to deploy, and is waiting for the dodeploy file)
Hope it helps!

hawtio-web stuck "deploying", won't start in karaf

( hawtio version 1.4.27, karaf version 3.0.2 )
i'm not quite sure what i'm missing here. I ran the following console commands to deploy the hawtio feature to Karaf
karaf#local()> feature:repo-add mvn:io.hawt/hawtio-karaf/1.4.27/xml/features
Adding feature url mvn:io.hawt/hawtio-karaf/1.4.27/xml/features
karaf#local()> feature:install hawtio-core
karaf#local()> web:list
ID | State | Web-State | Level | Web-ContextPath | Name
-----------------------------------------------------------------------------------------
216 | Active | Deploying | 80 | /hawtio | hawtio :: hawtio-web (1.4.27)
karaf#local()>
As suggested here i'm installing only the hawtio-core feature.
however, the war bundle 207 ( hawtio-web ) is forever stuck in the "Deploying" web-state. I don't see any servlets installed either
karaf#local()> http:list
ID | Servlet | Servlet-Name | State | Alias | Url
-------------------------------------------------
karaf#local()>
According to log:display ( the root logger is running on INFO and logging to osgi:* ) these are the only relevant lines logged
2014-10-22 16:09:17,783 | WARN | e ssh user karaf | FeatureValidationUtil | 24 - org.apache.karaf.features.core - 3.0.1 | Old style feature file without namespace found (URI: mvn:io.hawt/hawtio-karaf/1.4.27/xml/features). This format is deprecated and support for it will soon be removed
2014-10-22 16:10:03,770 | INFO | e ssh user karaf | FeaturesServiceImpl | 24 - org.apache.karaf.features.core - 3.0.1 | Installing feature hawtio-core 1.4.27
2014-10-22 16:10:03,771 | INFO | e ssh user karaf | FeaturesServiceImpl | 24 - org.apache.karaf.features.core - 3.0.1 | Installing feature war 3.0.1
Any ideas on how i could debug this, as nothing indicating a problem is logged, the war is "stuck" and the /hawtio resource is not available?
thanks!
Andras
PBKAC - i had org.osgi.core and org.osgi.compendium downloaded by maven and added to the karaf "lib" folder. They creeped on to the classpath ( definitely not listed in -cp though ) - as karaf/felix provide the packages in these, they are redundant and apparently cause extremely difficult to debug problems ( again, not a single line logged indicating a problem )
tl;dr this is not reproducible with the 3.0.2 karaf release tar. Drop osgi.core and osgi.compendium in the lib folder however..

Apache Tomcat using old resources - changes in Eclipse project not reflected in Web App

I am using the Eclipse Java EE IDE with Apache Tomcat version 6 to develop a web application.
The structure of the application is very simple, there are just two classes, one is the servlet class and the other is a object which is built by the servlet and does most of the work.
The problem that I am having is this: since this morning changes which I have made to both class files have not been appeared in the behaviour of the Web application. The application essentially behaves as if it is running my code from yesterday. To make sure that this is the case, I temporarily altered the behaviour of the program in radical ways and low, these changes still did not affect the web application.
Some relevant information:I am running Ubuntu 12, my Eclipse project is set to build automatically, and the tomcat server is configured to auto load modules by default and to automatically publish whenever a resource is changed. I have also cleaned
out the server's working directory.
How can I overcome this issue? I need my web application to implement the changes which I have made to the source code of my servlet and the class which the servlet uses.
If you add the Tomcat server in the standar way in the tabs Servers, the deploy path lives in the .metadata directory of your workspace.
The next tree directory is for my workspace. I added Tomcat 7.
MY_WORKSPACE
+---.metadata
| \---.plugins
| +---org.eclipse.wst.server.core
| | | monitors.xml
| | | publish.xml
| | | servers.xml
| | | tmp-data.xml
| | |
| | +---publish
| | | publish0.dat
| | | publish1.dat
| | |
| | \---tmp0
| | +---conf
| | | | catalina.policy
| | | | catalina.properties
| | | | context.xml
| | | | server.xml
| | | | tomcat-users.xml
| | | | web.xml
| | | |
| | | \---Catalina
| | | \---localhost
| | +---logs
| | | catalina.2013-07-06.log
| | | catalina.2013-07-11.log
| | | host-manager.2013-07-06.log
| | | host-manager.2013-07-11.log
| | | localhost.2013-07-06.log
| | | localhost.2013-07-11.log
| | | localhost_access_log.2013-07-06.txt
| | | localhost_access_log.2013-07-11.txt
| | | manager.2013-07-06.log
| | | manager.2013-07-11.log
| | |
| | +---temp
| | +---webapps
| | +---work
| | | \---Catalina
| | | \---localhost
| | \---wtpwebapps
| | +---ROOT
| | | \---WEB-INF
| | | web.xml
| | |
| | \---MyWebProject
| | | index.html
| | |
| | \---WEB-INF
| | +---classes
| | | |
| | | \---several-packages-and-clases
| | \---lib
| | log4j-1.2.17.jar
| | slf4j-api-1.7.5.jar
| | slf4j-log4j12-1.7.5.jar
| |
| \---org.other.plugins
|
\---Servers
| .project
|
+---.settings
| org.eclipse.wst.server.core.prefs
|
\---Tomcat v7.0 Server at localhost-config
catalina.policy
catalina.properties
context.xml
server.xml
tomcat-users.xml
web.xml
The real path for my web application MyWebProject is in the directory wtpwebapps. You can delete MyWebProject and try again.
If you have several Tomcat's in your workspace, you see directories like tmp0, tmp1, tmp2 ...
I have faced similar issue , in my case even if the tmp0 folder was correctly updated with new class files and resource files, still I was getting the same issue.
In my case, i got it resolved by disabling jrebel plugin for eclipse. I had jrebel installed in eclipse which was still monitoring and deploying the project from other workspace (not even this workspace), I am going to raise a bug to jrebel team as well.
Simply disable jrebel for that project and get it working back to normal

Problems with clear case plugin eclipse

I have a following problems with eclipse, when I installed ClearCase plugin from this url http://www3.software.ibm.com/ibmdl/pub/software/rationalsdp/clearcase/60/update/windows/ :
Has anyone experienced the similar problem? I'm using Windows 7 and eclipse galileo. I've installed the plugin from this URL, what can I do to work this problem out?
For those who can't see tinypic images
+----------------------------------------------------------------------+
| Connect to the Rational ClearCase failed |
| |
| Connect to the Rational ClearCase failed |
| |
| Reason: |
| Select Details >> for more information. |
| |
| +------------+ +------------+ |
| | OK | | << Details | |
| +------------+ +------------+ |
| |
|Could not connect to the Rational Clearcase. Please ensure that proper|
|version of ClearCase is installed with the proper patches. Consult the|
|ClearCase SCM Adapter documentation for further details. |
| |
| |
|Provider name: IBM |
|Plugin name: Rational ClearCase SCM Adapter |
|Plugin ID: com.rational.clearcase |
|Version: 7.5.0.v200910221234 |
+----------------------------------------------------------------------+
Google doesn't help much ..
I have no problem with that plugin (except the MVFS layer does not work for now, since dynamic views are not yet supported on windows7), provided you do have the exact tree
yourEclipse
eclipse
plugins
com.rational.clearcase.help_7.5.0.v200910221234
com.rational.clearcase.activities_7.5.0.v200910221234
com.rational.clearcase_7.5.0.v200910221234
features
com.rational.clearcase_7.5.0.v200910221234
com.ibm.rational.clearcase.ccrefresh_7.5.0.v200910221234
com.ibm.rational.clearcase.ccimport.feature_7.1.0.v200905202348--08422A2_242663
So you can start and check if you do see this configuration.
Note: I only install it on Eclipse Galileo 3.5 and Eclipse Helios 3.6Mx.
Currently, version 1.6 of the JVM is not supported. To use this integration successfully, you must downgrade to JVM 1.5.
As far as I know, the latest version of ClearCase available is 7.1, which is not qualified on Windows 7, maybe the issue is there.
Did you try with in the integration/plugin for other IDE ? (VisualStudio ?)
Can you access your views (snapshot or dynamic) outside of eclipse ?

Categories

Resources