Quantcast
Channel: GlassFish Related Items on Java.net
Viewing all 1091 articles
Browse latest View live

XA transaction errors on non-XA connection pools?

$
0
0

I have a GlassFish server that is set up to use NON-XA data sources in its
connection pools.

The log for that domain (yes, that domain, no, I'm not mixing up domains
but good question :-)) contains various XA errors. Here's a short snippet:

Caused by: javax.transaction.xa.XAException:
com.sun.appserv.connectors.internal.api.PoolingException:
javax.resource.spi.LocalTransactionException: Connection not established
at
com.sun.enterprise.resource.ConnectorXAResource.handleResourceException(ConnectorXAResource.java:115)
at
com.sun.enterprise.resource.ConnectorXAResource.start(ConnectorXAResource.java:150)
at
com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.enlistResource(JavaEETransactionManagerSimplified.java:378)

Given that XA is nowhere in evidence, I was wondering if there is some way
that GlassFish could be starting XA transactions anyway? At sea here.

Thanks,
Laird

--
http://about.me/lairdnelson


JMS HA has issues

$
0
0

Configuration:

glassfish1.corp.local

  • cluster
  • ssh node glassfish1
  • instance1

glassfish2.corp.local

  • ssh node glassfish2
  • instance2

Firstly, I started with a conventional cluster with master broker, but if you lose the master broker (i.e. power it off), the rest of the instances on the other servers accept messages, but they never reach the MDB (onMessage), see comment http://www.java.net/forum/topic/glassfish/glassfish/orb-not-listening-se....

Secondly, I tried a conventional cluster of peer brokers using HA-JDBC and Derby on both GlassFish servers to provide the JMS configuration store with HA as well. When I power off the glassfish2 server, messages will send (via ORB or direct) without error, but never be picked up from the queue. You can see on glassfish1 that instance2 is in stopped state, so it detects the host going down.

This is the code I use in my unit test to see if the queue is empty:

    public final void waitForEmptyQueue(final QueueSession queueSession,
            final Queue queue) throws Exception {
        log.debug("waitForEmptyQueue");
        // Wait for queue to empty
        boolean hasMoreItem = true;
        while (hasMoreItem) {
            final QueueBrowser browser = queueSession.createBrowser(queue);
            hasMoreItem = browser.getEnumeration().hasMoreElements();
            browser.close();
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

Then if I power on glassfish2, but do not start GlassFish then things work as expected. This is a big issue since you cannot guarantee a host will come back online in a timely manner. Is there some type of configuration that will prevent this zombie condition?

I also tried this with glassfish1 (leaving glassfish2 running) and the hang only occurs going direct:

13:47:49.705 [main] WARN  javax.jms - [C4003]: Error occurred on connection creation [glassfish1.corp.local:27676]. - cause: java.net.ConnectException: Connection refused
13:47:52.936 [main] WARN  javax.jms - [C4003]: Error occurred on connection creation [glassfish1.corp.local:27676]. - cause: java.net.ConnectException: Connection refused
13:47:56.051 [main] DEBUG com.bhn.services.jms.ClusterTest - waitForEmptyQueue

When I power glassfish1 back on things start working again. It appears that the host must be up even if GlassFish is not running on it.

Error creating custom realm on Glassfish 3.1.2.2 (Build 5)

$
0
0

Dear All,

I have been trying to create a custom realm on Glassfish 3.1.2.2 (Build 5) using the Admin console and I got this error below:

Creation of Authrealm engcustomrealm failed. com.sun.enterprise.security.auth.realm.BadRealmException: java.lang.ClassNotFoundException: com.samplerealm.SimpleRealm not found by org.glassfish.main.security [271]

I had previously created a jar file for the custom realm and dropped it in the folder: C:\Program Files\glassfish-3.1.2.2\glassfish\domains\domain1\lib as well updating the file C:\Program Files\glassfish-3.1.2.2\glassfish\domains\domain1\login.conf with the details of the new realm

The jar file contents are as follows:

package com.samplerealm;

import com.sun.enterprise.security.auth.realm.IASRealm;
import com.sun.enterprise.security.auth.realm.InvalidOperationException;
import com.sun.enterprise.security.auth.realm.NoSuchUserException;
import java.util.Enumeration;
import java.util.Vector;
public class SimpleRealm extends IASRealm {

@Override
public String getAuthType() {
return "simple";
}

@Override
public Enumeration getGroupNames(String string) throws InvalidOperationException, NoSuchUserException {
Vector vector = new Vector();
vector.add("Users"); vector.add("Admin");
return vector.elements();
}
@Override
public String getJAASContext()
{
return "simpleRealm";
}
public boolean loginUser(String userName, char[] password)
{
boolean loginSuccessful = false;
if ("glassfish".equals(userName) &&"secret".equals(password.toString()))
{ loginSuccessful = true; }
return loginSuccessful;
}
}

package com.samplerealm;

import com.sun.appserv.security.AppservPasswordLoginModule;
import com.sun.enterprise.security.auth.realm.InvalidOperationException;
import com.sun.enterprise.security.auth.realm.NoSuchUserException;
import java.util.Enumeration;
import javax.security.auth.login.LoginException;

public class SimpleLoginModule extends AppservPasswordLoginModule {

@Override
protected void authenticateUser() throws LoginException {
Enumeration userGroupsEnum = null;
String[] userGroupsArray = null;
SimpleRealm simpleRealm;
if (!(_currentRealm instanceof SimpleRealm))
{
throw new LoginException();
}
else
{
simpleRealm = (SimpleRealm) _currentRealm;
}
if (simpleRealm.loginUser(_username, _passwd))
{
try
{ userGroupsEnum = simpleRealm.getGroupNames(_username); }
catch (InvalidOperationException e)
{ throw new LoginException(e.getMessage()); }
catch (NoSuchUserException e)
{ throw new LoginException(e.getMessage()); }
userGroupsArray = new String[2]; int i = 0;
while (userGroupsEnum.hasMoreElements())
{ userGroupsArray[i++] = ((String) userGroupsEnum.nextElement()); }
}
else
{
throw new LoginException();
}
commitUserAuthentication(userGroupsArray);
}

}

Expecting your contributions guys

Regards,
Tony

Re: XA transaction errors on non-XA connection pools?

$
0
0

http://docs.oracle.com/cd/E26576_01/doc.312/e24936/tuning-glassfish.htm#...

Make sure the order of settings is as specified in the doc (otherwise it
will fail)

-marina

On 12/22/12 10:16 AM, Mo Maison wrote:
> Le 22/12/2012 00:32, Marina Vatkina a écrit :
>> On 12/21/12 3:03 PM, Laird Nelson wrote:
>>>
>>> Since flushing the connection pool is a known bug (i.e. there's no
>>> way from the admin console to flush a pool without causing an error;
>>> see http://java.net/jira/browse/GLASSFISH-14130 for an example; this
>>> is true even of our initialized pools on 3.1.2.2), can I somehow
>>> tell GlassFish to dump and refill the pool at the first sign of
>>> connection trouble? I didn't see anything obvious in
>>> http://docs.oracle.com/cd/E26576_01/doc.312/e24928/jdbc.htm#gharo.
>>
>> Hmmmm ... connection validation should be documented...
>
> I would also appreciate such a documentation : have the same exact problem
> where a restart of the database server (this is very unlikely but hey
> : it may
> happen in HA environments in case of master/slave switch for example)
> generates domain connections errors looong after the DB server is up.
> I presume these are caused by staled pooled connections.
> I tried to tweak some validations parameters (validation by a SQL query
> for example), but could not get to something to work.
>
> Any advice ?
>
> Regards,
> M. Maison
>

Auto undeploying application

$
0
0

We have one application deployed in glassfish 3.1.
It automatically undeploy the application from the server.
We disabled the auto deploy and reload checkbox in the application
configuration tab.
Is there any reason for auto undeploying the application ?
we really need your help.Please suggest the solution ASAP ....

Glassfish and special symbols

$
0
0

Hi guys.
I have some problems with the latest glassfish and with html special symbols.
My application works fine on glassfish 3.1. Then I have updated my glassfish to the latest version (3.1.2). And now glassfish replaces all symbols (like < >) by the special symbols ( &gt;&lt;).

An example of a page (3.1)

&lt;body onload="document.forms[0].submit();"&gt;
&lt;form&gt;
&lt;input type="hidden" name="ORDER" value="123" /&gt;
&lt;/form&gt;
&lt;/body&gt;

An example of a page (3.1.2)

<body onload="document.forms[0].submit();">
<form>
<input type="hidden" name="ORDER" value="123" />
</form>
</body>


what is going on?

how many users can access one application deployed in glassfish

$
0
0

how many users can access one application deployed in glassfish server?
Is there like number of user restriction for glassfish edition ?
Because maximum 10 users are able to access the application.

What to follow up for glassfish server better performance

$
0
0

For better performance of glassfish what should we follow up.
sometime we get java heap space error,out of memory or memory leakage error.
what could be the reason for memory leakage?
How to handle the memory leakage error.


Accessing an EJB in an ear from a war

$
0
0

Hi everyone,

we have the following scenario, please bear with the lengthy explanation!

We are running Glassfish 3.1.2 and we do development in Netbeans. We have TestEar.ear containing TestWeb.war and TestEjb.jar which contains some stateless session beans. Then we have VirtualWeb.war which we deploy to the same Glassfish instance but a separate virtual server. VirtualWeb.war needs to access the EJBs in TestEjb.jar (in the ear).

We add TestEjb.jar to the libraries of VirtualWeb.war so that it can compile.

From within VirtualWeb.war, we try to lookup a reference to an EJB (say Ejb1) using the JNDI name "java:global/TestEar/TestEjb/Ejb1", however this fails. If we instead lookup "java:global/VirtualWeb/Ejb1", this works.

This means that separate EJB components are created when deploying VirtualWeb.war.
How can this be prevented? All we want to do is access the already deployed EJBs in TestEar.ear.

Any help would be appreciated!

EJB Timer Service is not available, am getting these errors when i try to deploy an war file with ejb timere any help is appreci

$
0
0

[#|2012-12-26T22:49:19.677-0500|SEVERE|glassfish3.1|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=87;_ThreadName=Thread-1;|Exception while invoking class org.glassfish.ejb.startup.EjbApplication start method
java.lang.RuntimeException: EJB Timer Service is not available
at com.sun.ejb.containers.BaseContainer.startApplication(BaseContainer.java:3987)
at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:174)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:286)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.InstanceDeployCommand.execute(InstanceDeployCommand.java:186)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1048)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:465)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:222)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)
|#]

[#|2012-12-26T22:49:19.680-0500|SEVERE|glassfish3.1|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=87;_ThreadName=Thread-1;|Exception while loading the app|#]

[#|2012-12-26T22:49:19.700-0500|SEVERE|glassfish3.1|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=87;_ThreadName=Thread-1;|Exception while loading the app : EJB Timer Service is not available|#]
t com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1181)
at com.sun.enterprise.resource.pool.datastructure.ListDataStructure.addResource(ListDataStructure.java:126)
... 92 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: Communications link failure

The last packet successfully received from the server was 1,356,580,159,489 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.
at com.sun.enterprise.resource.allocator.ConnectorAllocator.createResource(ConnectorAllocator.java:168)
at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:903)
... 94 more
Caused by: javax.resource.spi.ResourceAllocationException: Connection could not be allocated because: Communications link failure

The last packet successfully received from the server was 1,356,580,159,489 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.
at com.sun.gjc.spi.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:128)
at com.sun.enterprise.resource.allocator.ConnectorAllocator.createResource(ConnectorAllocator.java:147)
... 95 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1,356,580,159,489 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2214)
at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:773)
at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:439)
at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:137)
at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:107)
at com.mysql.jdbc.jdbc2.optional.MysqlXADataSource.getXAConnection(MysqlXADataSource.java:47)
at com.sun.gjc.spi.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:113)
... 96 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1,356,580,159,489 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:341)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2137)
... 110 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)

Look up the remote EJB 3.1 on glassfish 3.1.2.2 with a client application (another machine)

$
0
0

Hi everbody!

First, sorry for my english.

I have a problem that I trying to solve on last 5 days, but I don't found the anwser in anywhere of Internet. Yes, I read many tutorials, forums and Oracle Documentation, I understood the mechanism used in the examples and it works when the client and the EJB are in the same machine, therefore when I put the EJB project in different machine (a server), the problem came.

In my client application, I included all of .jar files that are in GLASSFISH_HOME/glassfish/modules/ and I don't forgot the GLASSFISH_HOME/glassfish/lib/gf-client.jar that are included too.

The command "telnet www.myremotehost.com 3700" works fine, I obtain a connection, so I concluded the host and port are able to receive connections.

This is my EJB code which just get the IP address from the server:

//TestEJBRemote.java
package com.test;

public interface TestEJBRemote {
    public String message();
}

//TestEJB.java
package com.test;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.Stateless;
import javax.ejb.Remote;

@Stateless(name="TesteEJB", mappedName="ejb/TesteEJB")
@Remote(TestEJBRemote.class)
public class TestEJB implements TestEJBRemote {
    @Override
    public String message() {
        String msg = "IP: ";
        try {
            msg += InetAddress.getLocalHost().getHostAddress() + " / " + InetAddress.getLocalHost().getHostName();
        } catch (UnknownHostException ex) {
            Logger.getLogger(TestEJB.class.getName()).log(Level.SEVERE, null, ex);
        }
        return msg;
    }
}

And here it's my client code:

package test.client;

import com.test.TestEJBRemote;
import javax.naming.InitialContext;

public class Main {
    public static void main(String[] args) {
        try {
            InitialContext ctx = new InitialContext();
            TestEJBRemote remote = (TestEJBRemote) ctx.lookup( "java:global/teste-ejb/TesteEJB" );
            System.out.println( remote.message() );
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

When I execute the client application I use the following parameters

-Dorg.omg.CORBA.ORBInitialHost=www.myremotehost.com
-Dorg.omg.CORBA.ORBInitialPort=3700

but nothing occur, it's like the program ignores the parameter and try to connect the localhost again, it doesn't try to connect the server.

Just for information, I tried many JNDI names to ctx.lookup(name), and I used the
InitialContext ctx = new InitialContext(); without props because it is recomended in Glassfish FAQ.

How can I told to program to try a remote connection?

Injecting EJB to Servlet - ClassNotFoundException

$
0
0

I am getting classnotfound exception for all EJBs when trying to inject EJBs to a servlet.
Both EJBs and servlet are in same EAR file.

org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class com.naveen.samples.jeesample1.servlets.TestServlet.

My EJB:
@Stateless
public class TestService implements TestServiceLocal {

@Override
public String greet(final String name) {
return "Hello " + name;
}

}
EJB Local Interface:
@Local
public interface TestServiceLocal {

String greet(final String name);

}

Servlet:
@WebServlet(name = "TestServlet", urlPatterns = {"/test"})
public class TestServlet extends HttpServlet {

@EJB
private TestServiceLocal local;
}

I haven't changed any configuration files or anything. Is there anything I am missing. I can deploy the same ear file to JBOSS and it works fine.

Do you plan to deliver a new Glassfish 3.X maintenance release ?

$
0
0

Hi,

Glassfish 3.1.2.2 is runnning quite fine.

But when using composite components with JSF 2.1.6, there are a couple of critical/major bugs fixed in 2.1.7 and following versions.

Should Glassfish users upgrade themselves the JSF component ?

Best regards.

Glassfish / APEX listener configuratin issue

$
0
0

Hi,
I recently configured glassfish v3 to accept secure connections- I connect to the admin portal as follows:

https://192.168.1.47:4848

Next, I deployed application express listener (v2.0.0.354.17.05) and verified in the server.log that it was starting correctly. Everything in the gui appears to match the documentation

However, when it comes time for me to connect to Application Express listener admin, I am unable to do so

The docs say I should be connecting to:
http://:
/apex/listenerConfigure

For my setup that would be
http://192.168.1.47:8080/apex/listenerConfigure
which doesnt work. Connection just times out.
I've also tried
http://192.168.1.47:8181/apex/listenerConfigure

When I try this method, I typically throw the following exception-
PWC1406: Servlet.service() for servlet HttpEndPoint threw exception
java.lang.IllegalStateException: PWC3990: getWriter() has already been called for this response

Any suggestions as to what I am doing wrong would be greatly apprecited.

Glassfish 3.1.2 exception due to cache

$
0
0

I have posted this question on other forums across the net but no response. I have a Rest Web service deployed on Glassfish 3.1.2. I sporadically get a particular exception on it.

[#|2012-12-20T10:48:33.796+0530|WARNING|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=28;_ThreadName=Thread-2;|StandardWrapperValve[Jersey REST Service]: PWC1406: Servlet.service() for servlet Jersey REST Service threw exception
    org.codehaus.jackson.map.JsonMappingException: WEB9031: WebappClassLoader unable to load resource [java.util.TimeZone], because it has not yet been started, or was already stopped (through reference chain: spreadsheet.Exceldatalist["globalContext"]->spreadsheet.GlobalContext["dateOfCreation"])
    at org.codehaus.jackson.map.JsonMappingException.wrapWithPath(JsonMappingException.java:218)
    at org.codehaus.jackson.map.JsonMappingException.wrapWithPath(JsonMappingException.java:183)
    at org.codehaus.jackson.map.ser.std.SerializerBase.wrapAndThrow(SerializerBase.java:140)
    at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:158)
    at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112)
    at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:446)
    at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150)
    at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112)
    at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:610)
    at org.codehaus.jackson.map.ser.StdSerializerProvider.serializeValue(StdSerializerProvider.java:256)
    at org.codehaus.jackson.map.ObjectMapper.writeValue(ObjectMapper.java:1604)
    at org.codehaus.jackson.jaxrs.JacksonJsonProvider.writeTo(JacksonJsonProvider.java:558)
    at com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy.writeTo(JacksonProviderProxy.java:160)
    at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1437)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [java.util.TimeZone], because it has not yet been started, or was already stopped
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1401)
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
    at java.lang.Class.getDeclaredMethods(Class.java:1791)
    at org.codehaus.jackson.map.introspect.AnnotatedClass._addMemberMethods(AnnotatedClass.java:620)
    at org.codehaus.jackson.map.introspect.AnnotatedClass.resolveMemberMethods(AnnotatedClass.java:408)
    at org.codehaus.jackson.map.introspect.BasicClassIntrospector.classWithCreators(BasicClassIntrospector.java:185)
    at org.codehaus.jackson.map.introspect.BasicClassIntrospector.collectProperties(BasicClassIntrospector.java:157)
    at org.codehaus.jackson.map.introspect.BasicClassIntrospector.forSerialization(BasicClassIntrospector.java:96)
    at org.codehaus.jackson.map.introspect.BasicClassIntrospector.forSerialization(BasicClassIntrospector.java:16)
    at org.codehaus.jackson.map.SerializationConfig.introspect(SerializationConfig.java:974)
    at org.codehaus.jackson.map.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:251)
    at org.codehaus.jackson.map.ser.StdSerializerProvider._createUntypedSerializer(StdSerializerProvider.java:782)
    at org.codehaus.jackson.map.ser.StdSerializerProvider._createAndCacheUntypedSerializer(StdSerializerProvider.java:735)
    at org.codehaus.jackson.map.ser.StdSerializerProvider.findValueSerializer(StdSerializerProvider.java:344)
    at org.codehaus.jackson.map.ser.impl.PropertySerializerMap.findAndAddSerializer(PropertySerializerMap.java:39)
    at org.codehaus.jackson.map.ser.BeanPropertyWriter._findAndAddDynamic(BeanPropertyWriter.java:463)
    at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:441)
    at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150)
</pre>
<pre>

My Web service marshals an xml on the server after processing. The xml contains a time set in a tagGregorianCalendar gc = (GregorianCalendar) GregorianCalendar
.getInstance();
    globalContextObj.setDateOfCreation(DatatypeFactory.newInstance()
.newXMLGregorianCalendar(gc));
The jaxb xml object is private member var of the class, changing the access modifier from static to none is not affecting the exception. I read about the `WEB9031` exception that it is caused by the classloader not being able to load the TimeZone class library. Glassfish documentation suggests that while deploying we must mention the common libraries in the console. But I have no common libraries. I think that the java.util.timezone class mentioned in the exception is getting unloaded or something like that.

If anyone has any idea to resolve this please let me know!!


Issue connecting to a remote JMS queue from standalone client

$
0
0

I had already posted this issue in JMS Forum and was suggested to post here too.

-------------------------------------------------------------------------------------

I am new to JMS and have an issue connecting to a remote JMS queue from my standalone client. Any hints on resolving this issue would be highly appreciated.

Right now I have a JavaFX standalone application that runs on multiple clients and a glassfish server 3.1.2.2 running on a remote Unix machine. I am having a hard time pushing messages from my standalone app on to the queue that is residing on the server.

-------------------------------------------------------------------------------------
Client Mc: Windows PC (No server installed)
Remote Mc: Unix (GlassFish 3.1.2.2 installed)
-------------------------------------------------------------------------------------

*JMS resources on the server:*

+JMS Destination Resource+

JNDI Name: jms/ReferralQueue
Physical Destination Name: ReferralQueue
Resource Type: javax.jms.Queue

+JMS Connection Factory+

Pool Name: jms/ReferralConnectionFactory
JNDI Name: jms/ReferralConnectionFactory
Resource Type: javax.jms.QueueConnectionFactory

JMS Service Type: Embedded
JMS Message Store Type: File

*Client Side Code to connect to the server:*

+jms.properties:+

org.omg.CORBA.ORBInitialHost=UNIX MC URL
org.omg.CORBA.ORBInitialPort=3700
java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory
java.naming.factory.url.pkgs=com.sun.enterprise.naming
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl

+Service Locator design to implement resource caching+

public class JMSServiceLocator {    private static JMSServiceLocator singletonService = null;
    private static QueueConnectionFactory qFactory;
    private static Queue queue;
    private InitialContext context;
    private static Properties properties = new Properties();
    private Map cache;    static {
        try {
            singletonService = new JMSServiceLocator();
        } catch (Exception e) {
            //error handling
        }
    }    private JMSServiceLocator() {
        try {
            loadProperties();
            context = new InitialContext(properties);
            cache = Collections.synchronizedMap(new HashMap());
        } catch (Exception e) {
            //error handling
        }
    }    public static JMSServiceLocator getInstance() {
        return singletonService;
    }    public QueueConnectionFactory getQueueConnectionFactory() {        String qConnFactoryName = "jms/ReferralConnectionFactory";
        qFactory = null;
        try {            System.out.println("/********************Comment after Testing*****************************/");
            Hashtable env = context.getEnvironment();
            System.out.println("**env.size::" + env.size());
            Enumeration names = env.keys();
            while (names.hasMoreElements()) {
                String str = (String) names.nextElement();
                System.out.println("**" + str + "=" + env.get(str));
            }
            System.out.println("/**********************************************************************/");            if (cache.containsKey(qConnFactoryName)) {
                qFactory = (QueueConnectionFactory) cache.get(qConnFactoryName);
            } else {
                qFactory = (QueueConnectionFactory) context.lookup(qConnFactoryName);
                cache.put(qConnFactoryName, qFactory);
            }
        } catch (Exception e) {
            //error handling
        }
        return qFactory;
    }    public Queue getQueue() {
        String queueName = "jms/ReferralQueue";
        queue = null;
        try {
            if (cache.containsKey(queueName)) {
                queue = (Queue) cache.get(queueName);
            } else {
                queue = (Queue) context.lookup(queueName);
                cache.put(queueName, queue);
            }
        } catch (Exception e) {
          //error handling
        }
return queue;
    }    private static void loadProperties() {
        //Load jms properties
    }
}

+Eventually sending message to the server:+

JMSServiceLocator jmsLocator = JMSServiceLocator.getInstance();QueueConnectionFactory qConnFactory = jmsLocator.getQueueConnectionFactory();
qConnection = qConnFactory.createQueueConnection();
session = qConnection.createSession(false, ession.AUTO_ACKNOWLEDGE);
queue = jmsLocator.getQueue();// Push and publish the message
messageProducer = session.createProducer(queue);
textMessage = session.createTextMessage();
textMessage.setText(message);
messageProducer.send(textMessage);

-------------------------------------------------------------------------------------

However using the above implementation, I am unsuccessful in achieving this. However I am able to achieve this if I have a server installed on the local system too, with 'addresslist' property defined to my local server connection factory. As I cannot install server on every client machine, this would not work in my case.

Any hints on resolving this would be highly appreciated.

Thanks.

Gc Log in Sun Glassfish Server

$
0
0

Hi,

I want to generate gc.log file in my application server.It was generated gclog when i putting following command in JVM option in glass fish server.

-Xloggc:${com.sun.aas.instanceRoot}/logs/gc.log

But i want to store gc log /home partition of aix server

Kindly help me

Regards,
J Manivel

Development Guidelines

$
0
0

Hi folks. Happy new year!

After lots of research, I'm stuck so I came here for asking some development guidelines so I can learn it myself and maybe go forward in my ideas :-)

I want to develop a Java RESTFul WebService to be consumed by an iOS/Android app, after input a username, password and captcha code. The idea is build an API so other apps/websites can consume my Java RESTFul WebService.

Since I rather use official development tools, I'm using Netbeans IDE and Glassfish Web Container.

So witch authorization system do I use, OAuth, OAuth2, SAML or another one? Witch one can be consumed by both iOS/Android apps and websites? How so? Where can I find some code examples?

Is it possible to generate a captcha code and use it as a RESTFul WebService authentication parameter? How so? Where can I find some code examples?

For now I guess this is it. Thanks in advance.

Virtual hosts and wildcard dns

$
0
0

Hello. I don't believe, that it impossible to use in glassfish virtual hosts wildcard. But when I write in hosts filed of virtual server "*.aaa.com" I cann't achieve the site by "bbb.aaa.com". Please say, how I can do it.

Java EE + Glassfish + Eclipse and Server

$
0
0

Hello!
When we developed projects on php, we used the followind scheme: server (apache+php) and client side - developer (eclipse). But now we want to start using java for web development. So, we have several questions:
1. Why cann't we install JAVA EE libraries without glassfish? I mean when we download JAVA EE we download flassfish?
2. Is it necessary to install glassfish on every machine of developer in order developer could work upon project. As far as I understand here are two problems - a)developer must access some jar libraries b)is it possible to deploy and run from eclipse to remote server?

Viewing all 1091 articles
Browse latest View live


Latest Images