创建JAVA中找不到的活动RAR + ResourceAdapterImpl类时出错

时间:2013-12-17 03:06:30

标签: java jdbc glassfish ejb dbconnection

我已经分别用Glassfish V 4.0和postgre sql创建了一个EJB包作为服务器和数据库。 Glassfish和postgre远程安装。

我创建了一个连接池和JNDI

如果需要更多细节,请告诉我

当我运行我的类文件时,它会给我以下错误

Dec 17, 2013 10:47:16 AM com.sun.enterprise.connectors.ActiveRAFactory   
createActiveResourceAdapter

SEVERE: RAR6001 : Class Not found : com.sun.gjc.spi.ResourceAdapterImpl
Dec 17, 2013 10:47:16 AM com.sun.enterprise.connectors.ActiveRAFactory  
createActiveResourceAdapter
SEVERE: 
com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Error in creating  
active RAR
at  com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:111)
at com.sun.enterprise.connectors.service.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:210)
at com.sun.enterprise.connectors.ConnectorRuntime.createActiveResourceAdapter(ConnectorRuntime.java:427)
at com.sun.enterprise.resource.naming.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:107)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:527)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:487)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at sg.edu.astar.taxi360.dao.impl.DBConnection.<clinit>(DBConnection.java:24)
at sg.edu.astar.taxi360.dao.dummy.main(dummy.java:22)

Caused by: java.lang.ClassNotFoundException: com.sun.gjc.spi.ResourceAdapterImpl
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:102)
... 10 more

我的类文件有主要方法

public static void main(String args[])
{
    dummy p = new dummy();
    PreparedStatement stmt = null;
    String sql="";
    try(Connection connection = DBConnection.getConnection();)
    {
        sql = "INSERT INTO databasename.request (requestId)" +
            "VALUES (?)";
        stmt = connection.prepareStatement(sql);
        stmt.setString(1, "1324");
        stmt.executeQuery();
    }
    catch(Exception ex){

    }
}

DBConnection类文件包含以下详细信息

public class DBConnection {
    private static DataSource ds;
    static {
        try {
            InitialContext ctx = new InitialContext();
            ds = (DataSource) ctx.lookup("jdbc/databasename");
        } catch (NamingException ex) {
            Logger.getLogger(DBConnection.class.getName()).log(Level.SEVERE,null,ex);
        }
    }


    public static Connection getConnection() {
        Connection connection = null;
        try {
            connection = ds.getConnection();

        } catch (SQLException ex) {
            Logger.getLogger(DBConnection.class.getName()).log(Level.SEVERE, null, ex);
        }
        return connection;
    }
}

提前致谢

1 个答案:

答案 0 :(得分:0)

我通过将//layout array D3D11_INPUT_ELEMENT_DESC vertexDesc3[] = { {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 0, D3D11_INPUT_PER_VERTEX_DATA, 0} }; D3DX11_PASS_DESC passDesc; mTech->GetPassByIndex(0)->GetDesc(&passDesc); HR(md3dDevice->CreateInputLayout(vertexDesc3, 2, passDesc.pIAInputSignature, passDesc.IAInputSignatureSize, &mInputLayout)); // buffers ID3D11Buffer* mBoxVB; ID3D11Buffer* mBoxVB2; ID3D11Buffer* buffers[2]; buffers[0] = mBoxVB; buffers[1] = mBoxVB2; XMFLOAT3 vertex[] = { XMFLOAT3(-1.0f, -1.0f, -1.0f) , XMFLOAT3(-1.0f, +1.0f, -1.0f) , XMFLOAT3(+1.0f, +1.0f, -1.0f) , XMFLOAT3(+1.0f, -1.0f, -1.0f) , XMFLOAT3(-1.0f, -1.0f, +1.0f) , XMFLOAT3(-1.0f, +1.0f, +1.0f) , XMFLOAT3(+1.0f, +1.0f, +1.0f) , XMFLOAT3(+1.0f, -1.0f, +1.0f) }; // vertex buffer D3D11_BUFFER_DESC vbd; vbd.Usage = D3D11_USAGE_IMMUTABLE; vbd.ByteWidth = sizeof(XMFLOAT3) * 8; vbd.BindFlags = D3D11_BIND_VERTEX_BUFFER; vbd.CPUAccessFlags = 0; vbd.MiscFlags = 0; vbd.StructureByteStride = 0; D3D11_SUBRESOURCE_DATA vinitData; vinitData.pSysMem = vertex; HR(md3dDevice->CreateBuffer(&vbd, &vinitData, &mBoxVB)); XMFLOAT4 color[] = { (const float*)&Colors::White , (const float*)&Colors::Black , (const float*)&Colors::Red , (const float*)&Colors::Green , (const float*)&Colors::Blue , (const float*)&Colors::Yellow , (const float*)&Colors::Cyan , (const float*)&Colors::Magenta }; // where the namespace Colors is defined like namespace Colors { XMGLOBALCONST XMVECTORF32 White = {1.0f, 1.0f, 1.0f, 1.0f}; XMGLOBALCONST XMVECTORF32 Black = {0.0f, 0.0f, 0.0f, 1.0f}; XMGLOBALCONST XMVECTORF32 Red = {1.0f, 0.0f, 0.0f, 1.0f}; XMGLOBALCONST XMVECTORF32 Green = {0.0f, 1.0f, 0.0f, 1.0f}; XMGLOBALCONST XMVECTORF32 Blue = {0.0f, 0.0f, 1.0f, 1.0f}; XMGLOBALCONST XMVECTORF32 Yellow = {1.0f, 1.0f, 0.0f, 1.0f}; XMGLOBALCONST XMVECTORF32 Cyan = {0.0f, 1.0f, 1.0f, 1.0f}; XMGLOBALCONST XMVECTORF32 Magenta = {1.0f, 0.0f, 1.0f, 1.0f}; }; // color buffer D3D11_BUFFER_DESC vbd2; vbd2.Usage = D3D11_USAGE_IMMUTABLE; vbd2.ByteWidth = sizeof(XMFLOAT4) * 8; vbd2.BindFlags = D3D11_BIND_VERTEX_BUFFER; vbd2.CPUAccessFlags = 0; vbd2.MiscFlags = 0; vbd2.StructureByteStride = 0; D3D11_SUBRESOURCE_DATA initData2; initData2.pSysMem = color; // here is our problem: HR(md3dDevice->CreateBuffer(&vbd2, &initData2, &mBoxVB2)); // inside DrawScene(): UINT stride[] = {sizeof(XMFLOAT3), sizeof(XMFLOAT4)}; UINT offset[] = {0,0}; md3dImmediateContext->IASetVertexBuffers(0, 2, buffers, stride, offset); md3dImmediateContext->IASetIndexBuffer(mBoxIB, DXGI_FORMAT_R32_UINT, 0); // and the shaders cbuffer cbPerObject { float4x4 gWorldViewProj; }; struct VertexIn { float3 PosL : POSITION; float4 Color : COLOR; }; struct VertexOut { float4 PosH : SV_POSITION; float4 Color : COLOR; }; VertexOut VS(VertexIn vin) { VertexOut vout; vout.PosH = mul(float4(vin.PosL, 1.0f), gWorldViewProj); vout.Color = vin.Color; return vout; } float4 PS(VertexOut pin) : SV_Target { return pin.Color; } technique11 ColorTech { pass P0 { SetVertexShader( CompileShader( vs_5_0, VS() ) ); SetGeometryShader( NULL ); SetPixelShader( CompileShader( ps_5_0, PS() ) ); } } 添加到DWORD shaderFlags = 0; #if defined( DEBUG ) || defined( _DEBUG ) shaderFlags |= D3D10_SHADER_DEBUG; shaderFlags |= D3D10_SHADER_SKIP_OPTIMIZATION; #endif ID3D10Blob* compiledShader = 0; ID3D10Blob* compilationMsgs = 0; HRESULT hr = D3DX11CompileFromFile(L"FX/color.fx", 0, 0, 0, "fx_5_0", shaderFlags, 0, 0, &compiledShader, &compilationMsgs, 0); // compilationMsgs can store errors or warnings. if( compilationMsgs != 0 ) { MessageBoxA(0, (char*)compilationMsgs->GetBufferPointer(), 0, 0); ReleaseCOM(compilationMsgs); } // Even if there are no compilationMsgs, check to make sure there were no other errors. if(FAILED(hr)) { DXTrace(__FILE__, (DWORD)__LINE__, hr, L"D3DX11CompileFromFile", true); } HR(D3DX11CreateEffectFromMemory(compiledShader->GetBufferPointer(), compiledShader->GetBufferSize(), 0, md3dDevice, &mFX)); // Done with compiled shader. ReleaseCOM(compiledShader); mTech = mFX->GetTechniqueByName("ColorTech"); mfxWorldViewProj = mFX->GetVariableByName("gWorldViewProj")->AsMatrix();

来解决了这个问题
glassfish-embedded-all