Questions About Appserver

secure cookies when https is done on balancer, but balancer->appserver is http

We're trying to maintain PCI compliance for our application and after an audit, the report was telling us that we need to set the secure flag on our cookies. The site is HTTPS (using pound for https termination) sitting in front of haproxy which serves to a number of backened appservers, as follows:

CLIENT ->(https)-> [Pound]->[HAProxy] ->(http)-> { app001 | app002 | appNNN }

I've done some research (googling) around but haven't been able to find anything definitive about this, but would there be any issue with an appserver setting a secure cookie over http between it and the balancer, and would it make it through to the client over https?

Our staging environment doesn't have SSL set up the same way as production so I'm unable to test this, but I'm trying to come up with a plan of action and see if there's anything I'm missing before we try to move forward with this.

http://www.serverfault.com/questions/495241/secure-cookies-when-https-is-done-on-balancer-but-balancer-appserver-is-http

JSR-160 access to a secured WebSphere AppServer

I'm trying to access a WebSphere 7 AppServer, which has security enabled, using JSR-160 classes. I can get a connection going with the following, provided I define the java.ext.dirs system property pointing at various WebSphere lib directories:

Hashtable env = new Hashtable();
env.put("java.naming.factory.initial", "com.ibm.websphere.naming.WsnInitialContextFactory");
env.put("java.naming.provider.url", "corbaloc:iiop:myhost:2809/WsnAdminNameService");
env.put("jmx.remote.credentials", new String[] { "admin", "password" });
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL("service:jmx:rmi:///jndi/JMXConnector"), env);

But as soon as I access something like the stats attribute on an MBean, I get the following error:

javax.management.JMRuntimeException:
        >> SERVER (id=4773e3aa, host=myhost) TRACE START:
        >>    javax.management.JMRuntimeException: ADMN0022E: Access is denied f
    
http://www.stackoverflow.com/questions/12915971/jsr-160-access-to-a-secured-websphere-appserver

How to implement extensions mechanism in appserver?

I developing the servlet that should work 24/7. And I want to create some extensions mechanism: placing new jar in classpath must be detected by the main servlet and some class should loaded (without appserver restart).

Purpose: main servlet recieves events and redirect data to process to loaded classes (extensions). Extensions implements some interface (e.g. IMyExtension).

Maybe there is way to find all classes that implements particular interface? Or what do you suggest?

http://stackoverflow.com/questions/2369727/how-to-implement-extensions-mechanism-in-appserver

Websphere ND Dmgr - AppServer collocation disadvantages

In a Websphere Network Deployment Architecture, what would be the drawbacks of collocating a deployment manager server with one or more managed application servers on the same host?

In other words, should I collocate Dmgr with other servers or have a dedicated host for it?

It would be interesting to hear about bad experiences anyone had while following the first approach.

http://www.serverfault.com/questions/464344/websphere-nd-dmgr-appserver-collocation-disadvantages

Is it right to use full Java EE in this approach vs just a Web and Persistence Tier?

I want to devlop a site for managing sport stats. Lets say soccer stats. I want to pusblish a front end site with nice presentation for the public, no login required.

Im building a second site for the soccer leagues back office. This sites is where the soccer leagues will register their games anotation sheet so the statitics of each player will be calculated from that game. Here the league will register the instructors, catogories (range of age), and players.

I thougth using Full Java EE architecture. Develope an EJB project common both for front end and back office webapps, and a Front End and Back Office as I mentioned. Im planning using wicket for both sites. But I'm planning to publish on a 1GB RAM VPS with Glassfish 3.

Another option is to make a common project(eclipse), and make 2 webapps using that common project. That common project is a JPA project and have some common dependencies (Apache commons lang), that I will use in all projects. So deploy t

http://www.stackoverflow.com/questions/14490001/is-it-right-to-use-full-java-ee-in-this-approach-vs-just-a-web-and-persistence-tier

servletConfig.getInitParameterNames() is not working

I need to show two URLs into a JSP, but I want to pass some init parameters to the JSP page for doing this.

So, this is my web.xml :

<web-app ... >
<servlet>
    <servlet-name>index1</servlet-name>
    <jsp-file>/index.jsp</jsp-file>
    <init-param>
        <param-name>p1</param-name>
        <param-value>http://www.google.com</param-value>
    </init-param>
    <init-param>
        <param-name>p2</param-name>
        <param-value>/pagina2.jsp</param-value>
    </init-param>
</servlet>
<servlet-mapping>
    <servlet-name>index1</servlet-name>
    <url-pattern>/index.jsp</url-pattern>
</servlet-mapping>

In the index.jsp, I wrote the following code:

<%
    // This is only a test code. Obviously, it doesn't show the URLs
      java.util.Enumeration e = getServletConfig
    
http://www.stackoverflow.com/questions/14083619/servletconfig-getinitparameternames-is-not-working

Glassfish can not find JNDI DataSource while deploying

I am trying to deploy an ear in glassfish, but it fails to depoly it complaining that it can't find the DataSource written in the persistence.xml

In persistence.xml DataSource is configured asjava:app/jdbc/mysqlDS but it is looking for java:app/jdbc/mysqlDS__pm. This is weird. Any idea?

EDIT I have created following dtasources

  • mysqlDS
  • mysqlDS__pm

EDIT END

Here are some detail:

  • ear application
  • uses maven
  • application is deployed from eclipse

here goes the persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
  xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persiste
    
http://www.stackoverflow.com/questions/14084606/glassfish-can-not-find-jndi-datasource-while-deploying

Deploy from maven released repository to application

I just figured out, how to release to CB hosted maven "release" repository. I am trying to figure out, how to deploy tagged version to CB application. I understand, I can manually upload WAR file but is there any script. As far as I know maven plugin for CB doesn't support it.

I have one appserver is running snapshot builds from jenkins. I have other appserver, which I want to deploy only tagged/released artifact.

http://www.stackoverflow.com/questions/14096988/deploy-from-maven-released-repository-to-application

Glassfish Error when deploying WAR - Error occurred during deployment: Exception while preparing the app : Invalid resource :

I'm trying to deploy a WAR file called "VodfoneContractsDB.war". Its a simple web service created using Netbean's "RESTful Web Service from Database" wizard.

"Vodafone" is the name of my database connection.

I get the following error message:

Error occurred during deployment: Exception while preparing the app : Invalid resource : Vodafone__pm. Please see server.log for more details.

This is the log file:

[#|2012-10-01T09:23:35.542+0400|WARNING|glassfish3.1.2|org.apache.catalina.connector.Request|_ThreadID=119;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context , because request parameters have already been read, or ServletRequest.getReader() has already been called|#]

[#|2012-10-01T09:23:36.052+0400|INFO|glassfish3.1.2|org.glassfish.admingui|_ThreadID=119;_ThreadName=Thread-2;|GUI deployment: uploadToTempfile|#]

[#|2012-10-01T09:23:36.052+0400|INFO|glassfish3
    
http://www.stackoverflow.com/questions/12667937/glassfish-error-when-deploying-war-error-occurred-during-deployment-exception-while-preparing-the-app-

UNION statement in query

I wrote a query but I got following error, Any ideas ?!

Error :

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in E:\AppServ\www\admin\index.php on line 545

Code :

                    require_once '../_db/databaseConnect.php';
                    $db = new databaseConnect();
                    $db->connect();
                    $queryResult = mysql_query("(SELECT * FROM tabelcomments WHERE publishStatus = 2) UNION (SELECT appTitleFa FROM tableapps WHERE appID = '$appID');");
                    for ($dataCnt = 0; $dataCnt < mysql_num_rows($queryResult); $dataCnt++) 
                      {
                         //codes...
                      }
                    $db->close();
http://www.stackoverflow.com/questions/12677463/union-statement-in-query

Import Image works on GAE but not in dev_appserver.py

I'm using PIL for a GAE application, and have been importing the PIL modules directly using

import Image, ImageDraw, ImageChops,

The application works correctly with no complaints when uploaded to GAE but when trying to run with dev_appserver.py it refuses to import the modules.

Is there a way to force dev_appserver.py to recognize them, as GAE obviously supports them?

http://www.stackoverflow.com/questions/12683920/import-image-works-on-gae-but-not-in-dev-appserver-py

GAE can't import Web.py module in virtualenv

I'm trying to set up a Web.py (0.37) project in a virtualenv to run on Google App Engine (1.7.2) but I'm getting a ImportError: No module named web from the appserver.

I've installed web.py using python setup.py install from inside my virtualenv and can confirm that it's installed properly because I can import it from the python interpreter.

My actual GAE folder is outside the virtualenv but linked like so:

ln -s ~/Development/google_appengine $VIRTUAL_ENV/google_appengine

and added to my python path in $VIRTUAL_ENV/lib/python2.7/site-packages/gae.pth

There must be an extra step I'm missing, heres the error message:

    ERROR    2012-10-03 09:03:17,442 wsgi.py:203] 
Traceback (most recent call last):
  File "/home/sett/Development/google_appengine/google/appengine/runtime/wsgi.py", line 195, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  Fil
    
http://www.stackoverflow.com/questions/12705260/gae-can-t-import-web-py-module-in-virtualenv

Database connection not closed inspite of close statements

I am facing a problem in closing database conenctions. I am getting the below error

==================================================================================

267137 [http-8080-Processor23] FATAL com.abc.r2.dwrclasses.DBUtilities  - Failed to get a connection from DataSource JNDI/TPXSRUDB
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
    at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:103)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
    at com.abc.r2.dwrclasses.DBUtilities.getNativeConnection(DBUtilities.java:110)
    at com.abc.r2.dwrclasses.ProcedureCaller.callProcedure(ProcedureCaller.java:81)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 
    
http://www.stackoverflow.com/questions/12707510/database-connection-not-closed-inspite-of-close-statements

http 401 for Spring Tutorial when running "ant list"

I'm tired of Googling.

I'm getting this stacktrace when running "ant list" from the command-line:

/home/tgh/workspace/FiLTH/build.xml:138: java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8080/manager/html/list
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:230)
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:150)
at org.apache.catalina.ant.ListTask.execute(ListTask.java:51)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.Dispatc
    
http://www.stackoverflow.com/questions/12718804/http-401-for-spring-tutorial-when-running-ant-list

error while creating adminclient for websphere 7.0.0.11

I need to develop an application for managing WebSphere Application Server v7.0.0.11. I explored a bit and found out that we can use Mbeans. Actually I need to create something similar as Web-sphere's web console.

My problem is that the application should be in C# .net so is there any connector/Adapter to invoke web-sphere's management API. Please point me in right direction.

I am a C#.net developer and a total newbie in java/websphere, I tried creating Admin Client Example from IBM site by using packages found at IBM/Webshpere/Cimrepos directory. The name of Jar file is com.ibm.wplc.was_7.0.0.11.jar I unzipped that jar file in the same folder.

So now My App is starts, connects to websphere successfully and finds mbean on the nodeAgent. The problem I am facing in invoking mbean. I am getting following error message.

exception invoking launchProcess : javax.management.ReflectionExcetion: Target Method not

http://www.stackoverflow.com/questions/12740658/error-while-creating-adminclient-for-websphere-7-0-0-11

https only connects in local using Apache

I'have configured apache to use ssl certificates, when I type https://mysite.com it connects on local, but when I try outside of the server, it doesn't connect.

Here are my config and other details, I hope some one can help me.

Firewall exception for port 443 is enabled.

OS :

windows server 2008 R2

Web server:

AppServ 2.5.10(Apache 2.2.8,PHP 5.2.6,MySQL 5.0.51b,phpMyAdmin-2.10.3)

Note: I have purchased the domain at godaddy.com , when I type, www.mysite or mysite.com it works good(it have been working good since 2 years ago)

httpd.conf file

Added :

Listen 443

uncomment:

LoadModule ssl_module modules/mod_ssl.so

added:

<VirtualHost 23.23.95.84:80>
DocumentRoot  C:/AppServ/www/SaresInterno 
ServerName staging.soluntech.com 
SSLEngine on
SSLCertificateFile C:/AppServ/Apache2.2/conf/c
    
http://www.serverfault.com/questions/438365/https-only-connects-in-local-using-apache

Puppet Can't Start Service That Can Be Started By Hand?

On Debian, I have written a simple init script for a Pyramid application using pserve. I am not 100% sure that it is complete/correct, but it works for now:

DAEMON="/home/project/.virtualenvs/project/bin/pserve /home/project/production.ini"
PIDFILE=/home/project/project.pid
USER=project
GROUP=project
CWD=/home/project
LOGFILE=/home/project/project.appserver.log

case "$1" in
  start|stop|restart|status)
    echo "$1 project app server: "
    cd $CWD
    $DAEMON $1 --pid-file=$PIDFILE --user=$USER --group=$GROUP --log-file=$LOGFILE
    RETVAL=$?
    if [ "$RETVAL" -eq "0" ]; then
        echo "Success"
    fi
    ;;
  *)
    echo "Usage: /etc/init.d/project {start|stop|restart|status}"
    exit 1
    ;;
esac

exit 0

When I log in as root, I can run the following without issue:

~# service project start
start project app server: 
Changing user to project:project (200:1001)
Entering daemon mode
Success

I put the followi

http://www.serverfault.com/questions/444015/puppet-can-t-start-service-that-can-be-started-by-hand

GlassFish cluster-targeted jdbc is not enabled

I have a GlassFish cluster.

When I tried to add node and a instance, DAS saids a bunch of error messages telling

Resource [ jdbc/xxxx ] of type [ jdbc ] is not enabled

[#|2012-11-14T12:07:04.318+0900|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=2803;_ThreadName=Thread-2;|java.lang.StackOverflowError
        at java.io.FileOutputStream.writeBytes(Native Method)
        at java.io.FileOutputStream.write(FileOutputStream.java:318)
        at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122)
        at java.io.PrintStream.write(PrintStream.java:480)
        at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
        at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
        at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
        at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
        at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
   
    
http://www.serverfault.com/questions/448467/glassfish-cluster-targeted-jdbc-is-not-enabled