Activating Apache Felix HTTP bundle within Karaf - java

We are running apache-karaf-4.2.0 on an internal network that is not connected to the internet. We are trying to get an HTTP server running within Karaf and we decided to use org.apache.felix.http.bundle-3.0.0.jar since it contains everything we need in one jar (as opposed to bringing back everything listed in the http feature within Karaf).
Here are my steps to reproduce the issue:
Download a copy of apache-karaf-4.2.0.tar.gz and untar it
Download a copy of org.apache.felix.http.bundle-3.0.0.jar
cd into apache-karaf-4.2.0
mkdir -p system/org/apache/felix/org.apache.felix.http.bundle/3.0.0/
Copy org.apache.felix.http.bundle-3.0.0.jar into the directory you just
created
Open
system/org/apache/karaf/features/standard/4.2.0/standard-4.2.0-features.xml
At the bottom, before <feature name="standard"...> add the following
lines (see below since I cannot embed it into this list):
Open etc/custom.properties
Add the following line to the bottom: org.apache.felix.jettyEnabled =
true
Execute ./bin/karaf
At the karaf prompt type: feature:install felix-http
And here's what the XML should look like in the standard-4.2.0-features.xml file:
<feature name="felix-http" description="Apache Felix HTTP Bundle" version="4.2.0">
<bundle>mvn:org.apache.felix/org.apache.felix.http.bundle/3.0.0</bundle>
<config name="org.apache.felix.http">
org.osgi.service.http.port=8888
</config>
</feature>
If I understand the IncompatibleClassChangeError it means something was compiled with an older version of something else. I'm assuming that something else is jetty but nothing else is providing it. So I'm very confused.
If anyone has any thoughts on how to continue to debug and/or fix this I would greatly appreciate it.

Related

Domino OSGI plugin - Couldn't find design note

I am trying to creata a Domino OSGI plugin which exposes a simple Hello World servlet.
To do this I created in eclipse a plugin project(with web.xml and the servlet in place) , a feature project containing this plugin and an updated site project.
After this I created an application in Domino designer using the 'Eclipse Update Site' as template (name RestDemoUpdateSite.nsf).
With this application open in Domino administrator, I successfully imported my eclipse update site.
Finally I copied RestDemoUpdateSite.nsf to the folder -
C:\Program Files\IBM\Domino\data and added the line OSGI_HTTP_DYNAMIC_BUNDLES=RestDemoUpdateSite.nsf in notes.ini.
The link http://<>/RestDemoUpdateSite.nsf opens fine
A GET request to http://<>/RestDemoUpdateSite.nsf/api/ gives the json response
{
"services":[
{
"name":"Data",
"enabled":false,
"version":"9.0.1",
"href":"\/RestDemoUpdateSite.nsf\/api\/data"
},
{
"name":"Calendar",
"enabled":false,
"version":"9.0.1",
"href":"\/RestDemoUpdateSite.nsf\/api\/calendar"
},
{
"name":"Core",
"enabled":true,
"version":"9.0.1",
"href":"\/RestDemoUpdateSite.nsf\/api\/core"
}
]
}
A GET request to my servlet http://<>/RestDemoUpdateSite.nsf/serviceapi/student gives the error
HTTP Web Server: Couldn't find design note - serviceapi/student [/RestDemoUpdateSite.nsf/serviceapi/student] Anonymous
Any suggestion or hints as to what might be going wrong would be of great help.
Thank you
The first step is to make sure your plugin is being loaded by the OSGi framework. Execute the following server console command:
tell http osgi ss {bundle.name}
For example, tell http osgi ss com.ibm.domino.services lists all the plugins matching the given name. The listing tells you whether a plugin is ACTIVE, RESOLVED, INSTALLED, etc.
Assuming your plugin is being loaded, the next step is to make sure you are defining your servlet correctly. You said you included a web.xml file, but OSGi servlets are typically defined in plugin.xml. They implement the org.eclipse.equinox.http.registry.servlets extension. You can find more details in these slides. See the section starting with "Creating, deploying & debugging a simple servlet".

Switch java spring maven project from linux to windows

I am new to spring development so i am stuck here. Is there any configuration while switching spring + maven project from linux to windows. I am running on tomcat server 7. The project is initially developed in linux. I have moved all the file from linux to wondows. While running on server, i get error The requested resource (/myproject/login/) is not available. Do i need to make any changes or add add in configuation.
Thanks in advance.
I think you have missed something.
Try this.but i'am not sure this is working or not.
Tomcat, by default invoker servlet disabled (commented out in the web.xml file). You have to create a 'servlet' and a 'servlet-mapping' entry in your web.xml.
Once you do, you can get rid of the "servlet/" part of your url.
Check out the following URL for more information regarding the invoker servlet:
http://faq.javaranch.com/view?InvokerServlet

How to Enable Java Persistence 2.0 for Weblogic 10.3.6

I am using eclipse with weblogic server. In order to add the project to the weblogic server, it needs to support Java Persistance 2.0, however when trying to install it, I keep getting this message
Error Enabling Java Persistence 2.0 in Weblogic Server installation
I tried to follow the Oracle documents to solve this but they make no sense since I'm pretty novice with Weblogic.
http://docs.oracle.com/cd/E17904_01/web.1111/e13720/using_toplink.htm#CIHDJHHI
Please help! I understand the second part of the manual but I have no idea how to configure this Top Link stuff. Any help is greatly appreciated. Thank you!
Probably, the WebLogic Server Monitor was locking the weblogic.jar, so you couldn't upgrade the server.
I had the same issue and solved it by switching to a new workspace. There, I could add the server again and upgrade it, without being disturbed by the WebLogic Server Monitor.
I have enabled JPA 2.0 on a Unix-based system using a variation on the 'Installing Manually' steps in the Oracle doc you referenced. The key is to add the two JPA jars at the beginning of the classpath. In my case, we wanted JPA 2.0 support for a single managed server in the domain, so I added the following hack at the beginning of the setDomainEnv.sh script:
if [ "${SERVER_NAME}" = "TEST_Server1" ] ; then
JPA20="path/modules/javax.persistence_1.1.0.0_2-0.jar${CLASSPATHSEP}path/modules/com.oracle.jpa2support_1.0.0.0_2-1.jar"
if [ "${PRE_CLASSPATH}" != "" ] ; then
PRE_CLASSPATH="${JPA20}${CLASSPATHSEP}${PRE_CLASSPATH}"
export PRE_CLASSPATH
else
PRE_CLASSPATH="${JPA20}"
export PRE_CLASSPATH
fi
fi
Adjust the TEST_Server1 name (or just remove the if) and path
references to align with your environment.
I ended up using the 'Smart Update' utility that was located in: start->program files->Oracle WebLogic->Smart Update (Windows server, obviously)
The hardest part was locating the Oracle patch number for JPA 2 for my version of WebLogic (10.3.6).
For those of you in the same boat this is the info for the patch for version 10.3.6:
Smart Update patch 7BWI for WebLogic Server 10.3.6
Content:
This patch contains Smart Update patch 7BWI for WebLogic Server 10.3.6.0
Description:
Enable JPA2.0 support on Weblogic server.
Patch Installation Instructions:
copy content of this zip file with the exception of README file to your SmartUpdate cache directory (MW_HOME/utils/bsu/cache_dir by default)
apply patch using Smart Update utility
I am not sure how to attach files to this post or I would just include the patch. Message me if you want me to email a copy to you.

thread-max config not read by Resin 4.0.32

It seems to me the thread-max is always 128 no matter what I set:
Below is my config.
<server-default>
<jvm-arg-line>-Xmx2048m</jvm-arg-line>
<thread-max>64</thread-max>
</server-default>
<server id="" address="127.0.0.1" port="6800">
<-- More settings -->
<!-- Maximum number of threads. -->
<thread-max>20</thread-max>
</server>
Am I missing something about this? How do I get the config work?
I can set the value in by code:
com.caucho.util.ThreadPool.setThreadMax(6);
Had another problem with the com.caucho.util.ThreadPool.setThreadMax(6). If I debug or run through Eclipse, it is OK. However, when I run in the Cmd with ant, it reports: [java] java.lang.NoClassDefFoundError: com/caucho/util/ThreadPool exception.
I am using Resin 4.0.32 with Java 1.6_16. Eclipse version is 4.2 if this matters.
Any suggestion or comments are appreciated.
I found the problem,
The reason I get the exception when run with ant but didn't get it while in Eclipse IDE is because in the project, I am referring the resin.jar of version 3.0.21 and the API has been changed in resin 4.0.32 for ThreadPool related functions. It is no longer in com.caucho.util. When I debug using Eclipse, resin 3.0.21 is in the class path. But when I ran with ant, we are using resin 4.0.32.
I guess it is the same reason for the first question. I am not using the right function to read the stats.
Hope this helps.

unable to redeploy web application on glassfish3

I m trying to deploy a web application using netbeans to glassfish 3.01 but i m not able to do so
Glassfish says
Inconsistent Module State
the web app has some jars and a ejb jar for a local ejb
Open the domain.xml file that you will find in this folder:
"your glassfish installation"/domains/"your domain"/config
In this file look for your application deployment configuration to manually remove it:
1) Remove the web-module tag
<applications>
...
<web-module availability-enabled="false" context-root="yourapplicatoinContext" ... />
...
</applications>
2) Also remove the application-ref to your application:
<server config-ref="server-config" lb-weight="100" name="server">
...
<application-ref ... ref="your application name" ... />
...
</server>
Just try this:
undeploy
stop Glassfish
start Glassfish
deploy
If you can't undeploy, try the other steps anyway. If you don't have any luck, you could try it this way:
stop Glassfish
edit domain.xml (probably in domains/domain1/config)- back it up first; remove all references to your app (probably under application / application-ref); just make sure it's still valid xml
start Glassfish
deploy
It should have solved it. If still no luck anyway, remove every file or directory related to your app, probably under domains/domain1/generated and domains/domain1/applications/....
You could always recreate a new domain, but above steps will solve your problem.
You could be in such a situation after stopping Glassfish middle in a deploiyment, for example.
The other answers are really extreme. There is no need to create a new domain or re-install if you cannot redeploy your web application during development.
If you app is very complex, then consider scripting any clean up needed in a Production environment. The below steps will keep you up and working in the short term.
To re-deploy a web app to a single domain on Glassfish 3.1, do the following:
Stop Glassfish from the command line.
Delete all the files in the following directories:
glassfish\domains\domain1\generated
glassfish\domains\domain1\applications
Start Glassfish from the command line.
Deploy your app via the Admin Tool or command line.
In Glassfish 5, I searched for my app name in the domain.xml and deleted all the tags mentioning it. There was one occurence in the beginning (<system-applications>) and one at the end at approx. line 460 (<applications>). Then redeploy worked!

Categories